I’m running into a strange issue where my addon performs the change and then it automatically undoes the change. So the field will change and change back. The only way to see the change is do Edit → Undo Update Note
def button_pressed(self):
global batch
batch = False
note = self.note
notetype = self.note.note_type()['name']
get_config_note(notetype)
for k, v in field_names.items():
text_field = k
audio_field = v
term = process_text(note[text_field])
# Download the audio and update the audio field
result = get_forvo_results(term)
# Only update the card if we actually found audio
if result:
if result.count(separator) < len(term) - 1 and not note.hasTag(tag_missing):
note.addTag(tag_missing)
if add_tag:
note.addTag(add_tag)
note[audio_field] = result
mw.col.update_note(note)
showInfo("Card Updated.")
return