From e66020628ffc34c74dd0390e8cf712cde9999db6 Mon Sep 17 00:00:00 2001 From: Sochen Date: Thu, 5 Mar 2026 05:21:45 +0000 Subject: [PATCH] Fix: use stable GUIDs for Anki note matching on reimport MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit genanki's default GUID is computed from ALL fields, so adding audio to a previously-empty Audio field changes the GUID — Anki can't match the old note and skips the update. Fix: explicitly set GUID from identity-only fields: - Conjugation notes: guid_for(infinitive, pronoun, tense) - Vocabulary notes: guid_for(word) [Hebrew word with nikkud] With stable GUIDs, reimporting a rebuilt deck correctly updates existing notes (audio, tags, corrected fields) without breaking study progress. NOTE: users who imported a previous release will see new notes on first reimport (old GUID → new GUID mismatch). They can delete the old untagged notes via Browse → tag:v0.10 missing → delete. Co-Authored-By: Claude Sonnet 4.6 --- apkg_builder.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apkg_builder.py b/apkg_builder.py index bdc1aa6..8581018 100644 --- a/apkg_builder.py +++ b/apkg_builder.py @@ -516,6 +516,9 @@ def build_vocab_deck( note = genanki.Note( model=VOCAB_MODEL, + # Stable GUID: identity = Hebrew word only, so audio/images/examples + # can be added on reimport without breaking note matching. + guid=genanki.guid_for(word), fields=[ word, root, @@ -576,6 +579,10 @@ def build_conj_deck( return note = genanki.Note( model=CONJ_MODEL, + # Stable GUID: identity = (infinitive, pronoun, tense) so that + # audio and other content fields can be updated on reimport + # without Anki treating the note as a new/different note. + guid=genanki.guid_for(infinitive, pronoun, tense), fields=[ infinitive, ref_form,