From dbb9449efa7e23700affd36cb289f2070b9a2a81 Mon Sep 17 00:00:00 2001 From: stephen Date: Fri, 26 Jun 2026 16:20:45 +1000 Subject: [PATCH] putting the flashcard back into review_tab --- anki_exporter.py | 23 +++++++++++++++++++---- spanish_trainer.db | Bin 217088 -> 217088 bytes 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/anki_exporter.py b/anki_exporter.py index 91efb07..78980be 100644 --- a/anki_exporter.py +++ b/anki_exporter.py @@ -48,7 +48,21 @@ def compile_anki_package(records, output_path, deck_name): for idx, record in enumerate(records): en_text = record["en_text"] es_text = record["es_text"] - notes = f"Context: {record['source_context'] or ''} | {record['notes'] or ''}".strip(" | ") + + # Extract and parse tags for native Anki tag support (split comma-separated text) + raw_tags = record.get("tags") or "" + note_tags = [t.strip().replace(" ", "_") for t in raw_tags.split(",") if t.strip()] + + # Build text for visual notes area, appending tags if they exist + notes_parts = [] + if record.get('source_context'): + notes_parts.append(f"Context: {record['source_context']}") + if record.get('notes'): + notes_parts.append(f"Notes: {record['notes']}") + if raw_tags: + notes_parts.append(f"Tags: {raw_tags}") + + notes_display_text = " | ".join(notes_parts) # Generate unique filenames for the media assets en_audio_filename = f"en_audio_{idx}.mp3" @@ -79,14 +93,15 @@ def compile_anki_package(records, output_path, deck_name): except Exception: es_audio_field = "" - # Build the card note stack + # Build the card note stack, natively injecting the parsed Anki tags list note = genanki.Note( model=anki_model, - fields=[en_text, es_text, notes, en_audio_field, es_audio_field] + fields=[en_text, es_text, notes_display_text, en_audio_field, es_audio_field], + tags=note_tags ) deck.add_note(note) # Build package collection mapping archive pipelines package = genanki.Package(deck) package.media_files = media_files - package.write_to_file(output_path) \ No newline at end of file + package.write_to_file(output_path) diff --git a/spanish_trainer.db b/spanish_trainer.db index 66228e771e63098e785ac7bed447981c894115f4..56c75e9f43b73324d12ba7f81e03f4262e616df7 100644 GIT binary patch delta 130 zcmZozz}v8ZcY-t{??f4AM&6AHOZ53z`7IgvkMVc&7xD-5TW%IqQ0JGD;AS=yPRz^B zj4v)ticd*R&W_JZ%uV$%Fqj-{zY(aVje-9;e;fZ?{xkfWfm%xV#l@Hn88LNmH_!EN QpX<*E#7xuY`ZFg30Fomp9{>OV delta 72 zcmZozz}v8ZcY-t{+e8^>Mz)O!OZ0hI_=6evkMVc&7xD*h7F2NNpB!wzk&T6aE(8Db c%{&fO{1YcgHqZ5MpX<*E#7xuY`ZFg30089{W&i*H