From b88d8346b6a7f04952652609e31db7a5c41a8944 Mon Sep 17 00:00:00 2001 From: Ren Tatsumoto Date: Fri, 2 Dec 2022 16:33:02 +0300 Subject: [PATCH] update updater --- antp/updater.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/antp/updater.py b/antp/updater.py index b5df291..5def02f 100644 --- a/antp/updater.py +++ b/antp/updater.py @@ -36,20 +36,21 @@ def send_note_type(model: NoteType): def update_note_type(): - stored_models = { + anki_models = request_model_names() + models_on_disk = { (model := read_model(dir_name)).name: model for dir_name in os.listdir(NOTE_TYPES_DIR) } updatable_models = [ - model_name for model_name in stored_models - if model_name in request_model_names() + model_name for model_name in models_on_disk + if model_name in anki_models ] if not updatable_models: print("No note types can be updated.") return if model_name := select(updatable_models): print(f"Selected note type: {model_name}") - model = stored_models[model_name] + model = models_on_disk[model_name] store_fonts(get_used_fonts(model.css)) send_note_type(model) print("Done.")