Hi. I wanna start creating decks for a class I am in. I am looking into tools which I can use to programmatically generate decks either as code or as configuration. I have looked through a few but I am not sure which one to commit to so I was hoping to get some input from people who have delved in this.
My main concern is that the projects aren’t actively updated. For example, genanki last tagged release was more than a year ago even though the main branch received commits a couple months ago. There are other options like genanki-rs but that is even less active.
Now this isn’t inherently problematic since I don’t expect the projects to receive updates for no reason. But I wanted to check regardless.
Any advice is welcome. Thank you very much for reading.
it should be okay to use tools built even older than you think. fundamentally the DB inside decks stay relatively unchanged, and Anki is able to import old decks anyways. (maybe not v2.0 era decks though? that’s like 7 years ago?)
There is a simpler way, do not have to install any additional tools or plug-ins, directly with anki desktop comes with a debugging console (ctrl + shift + ;), paste the code to execute can be.
For example, the following code is to automatically add 1 ~ 9 multiplication example:
from anki.notes import Note
from anki.collection import AddNoteRequest
from aqt import mw, gui_hooks
import random
deck_id = mw.col.decks.by_name('Default')['id']
note_id = mw.col.models.by_name('Cloze')['id']
requests = []
for x in range(1, 10):
for y in range(1, 10):
z = x * y
note = Note(mw.col, note_id)
note['Text'] = f'{{{{c1::{x}}}}} X {{{{c2::{y}}}}} = {{{{c3::{z}}}}}'
request = AddNoteRequest(note, deck_id)
requests.append(request)
changes = mw.col.add_notes(requests)
gui_hooks.operation_did_execute(changes, None)
Hey, I’m the anki-panky maintainer. If you end up using it and want some features let me know!!! I’d love to make the functionality better. I just need a reason to haha.
Also I suppose the one you go with will depend on your needs. My project excels at cards that utilise a lot of maths and code as it uses the Pandoc compiler underneath but out the box it excels at just regular front-back cards (more complicated cards would probably require some custom config hook or some bollocks to inject your own html maybe). Also it’s really good at nested decks as it just uses the file hierarchy as the deck structure. Cards also aren’t duplicated on import.