update updater
This commit is contained in:
parent
0bb4f3745e
commit
b88d8346b6
|
@ -36,20 +36,21 @@ def send_note_type(model: NoteType):
|
||||||
|
|
||||||
|
|
||||||
def update_note_type():
|
def update_note_type():
|
||||||
stored_models = {
|
anki_models = request_model_names()
|
||||||
|
models_on_disk = {
|
||||||
(model := read_model(dir_name)).name: model
|
(model := read_model(dir_name)).name: model
|
||||||
for dir_name in os.listdir(NOTE_TYPES_DIR)
|
for dir_name in os.listdir(NOTE_TYPES_DIR)
|
||||||
}
|
}
|
||||||
updatable_models = [
|
updatable_models = [
|
||||||
model_name for model_name in stored_models
|
model_name for model_name in models_on_disk
|
||||||
if model_name in request_model_names()
|
if model_name in anki_models
|
||||||
]
|
]
|
||||||
if not updatable_models:
|
if not updatable_models:
|
||||||
print("No note types can be updated.")
|
print("No note types can be updated.")
|
||||||
return
|
return
|
||||||
if model_name := select(updatable_models):
|
if model_name := select(updatable_models):
|
||||||
print(f"Selected note type: {model_name}")
|
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))
|
store_fonts(get_used_fonts(model.css))
|
||||||
send_note_type(model)
|
send_note_type(model)
|
||||||
print("Done.")
|
print("Done.")
|
||||||
|
|
Loading…
Reference in a new issue