I’m starting to write a Python module to import notes from a CSV file along with scheduling data. I managed figure out how to create new cards and how to set their due date, but I can’t set the card’s interval. It seems like the interval gets overriden with the interval from the the current day to the due date when the collection is saved. Here’s my code:
from anki import collection
col = collection.Collection(‘/home/felipe/.local/share/Anki2/fromcsv01/collection.anki2’)
basic = col.models.by_name(‘Basic’)
note = col.new_note(basic)
note[‘Front’] = ‘This is the front of the card’
note[‘Back’] = ‘This is the back of the card’
deck = col.decks.by_name(‘my deck’)
card = note.cards()
card.ivl = 30
print(card.ivl) # outputs 30, as expected
card = col.get_card(card.id)
print(card.ivl) # outputs 365, I would hope for it to be 30
Is there any way around this?
I’m trying to avoid messing with the db directly, because I far as I understand its structure may change without notice in the future.