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():
|
||||
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.")
|
||||
|
|
Loading…
Reference in a new issue