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.")