rampaa / JL

JL is a program for looking up Japanese words and expressions.
Apache License 2.0
198 stars 4 forks source link

Failing to create duplicate note still exports the word's audio to Anki #87

Closed Mansive closed 5 months ago

Mansive commented 5 months ago

If I create a note from Yomitan for "跳ね回る" that has [sound:NhkLocal_跳ね回る_はねまわる.mp3] in the note's Audio field, and I attempt to create a duplicate note from JL for "跳ね回る", then JL will prevent its creation as expected. However, using the Check Media option in Anki will show that JL_audio_はねまわる_跳ね回る.mp3 is in the media folder as an unused file despite JL not creating a note.

This does not happen for notes I've created from JL; for example, create a note from JL for "鮮やか" with [sound:JL_audio_あざやか_鮮やか.mp3] in the Audio field, and then attempt to create a duplicate note. JL will prevent the note creation and Anki does not show any new unused files.

rampaa commented 5 months ago

I think this is an AnkiConnect bug. Even if I simply call the canAddNotes action with a note that has audio, the audio file is still created under the collection.media folder. Same behavior is observed when addNote is called with its allowDuplicate option set to false.

Ideally this should be fixed by AnkiConnect itself. If that's not likely, I can probably sidestep this behavior somehow.