diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-11-08 22:10:46 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-11-08 22:10:46 +0100 |
commit | 882725dcd878172b477335039a4bbb07ea424fe4 (patch) | |
tree | bed4f4757777a1671b3df6482a8181e3941f516f /bulk-audio/bulk-audio.py | |
parent | a4e236f13426f9df5db864edda63eecf26c386c7 (diff) |
update for anki 23.10
Diffstat (limited to 'bulk-audio/bulk-audio.py')
-rwxr-xr-x | bulk-audio/bulk-audio.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/bulk-audio/bulk-audio.py b/bulk-audio/bulk-audio.py index 15ab33f..2ac307e 100755 --- a/bulk-audio/bulk-audio.py +++ b/bulk-audio/bulk-audio.py @@ -108,13 +108,10 @@ def main(): if options.clear_audio: if not options.dry_run: note[options.audio_field] = "" - note.flush() + col.update_note(note) print(f"cleared \"{options.audio_field}\" field!") continue - # autosave deck every 20 cards - if note_index % 20 == 0: col.save() - # skip any notes that already have audio if not options.force_override and len(note[options.audio_field]) > 0: print("skipped -> audio field not empty") @@ -132,7 +129,7 @@ def main(): if exit_code != 0: if not options.dry_run: note[options.audio_field] = "noaudio" - note.flush() + col.update_note(note) edited_notes += 1 print("skipped -> no recording available, marked as 'noaudio'") continue @@ -150,12 +147,10 @@ def main(): audio_str = f"[sound:{filename}]" if not options.dry_run: note[options.audio_field] = audio_str - note.flush() + col.update_note(note) print(f"written audio as {audio_str}") edited_notes += 1 - # save collection (and exit) - col.save() if edited_notes == 0: print("-- Done: no edits --") else: |