czech_plus.logic.compiler#

Module for the card compiler.

Module Contents#

Classes#

Compiler

Compile a card (note in Anki) to processed and ready to use data.

class Compiler(anki_collection_getter: Callable[[], anki.collection.Collection])[source]#

Compile a card (note in Anki) to processed and ready to use data.

So in this way we solve two problems in once: 1. We can use compiled content for TTS addon. 2. We can use it on mobile.

property _anki_collection: anki.collection.Collection[source]#

Get the Anki collection object.

compile_all_notes() None[source]#

Compile all notes.

Just fetches all notes via _get_notes_ids() and calls compile_note() for each of them.

compile_note(note_id: int, note_type: str) None[source]#

Compile a note.

Parameters:
  • note_id – ID of the note.

  • note_type – Name of the note type.

_get_notes_ids() list[tuple[int, str]][source]#

Get IDs of all notes with needed note types.

Returns:

List of tuples with note ID and note type name.