Bug fix, duplicate audio filenames
Fix the bug where old file name was referenced in the audio field. The problem was, if the audio file we were trying to save already existed it got automatically saved with a different name (the number was appended to the end), but inside the card the incorrect old filename was referenced.
This commit is contained in:
parent
1786110939
commit
9330e23d8a
@ -713,11 +713,11 @@ class AnkiConnect:
|
|||||||
skip = skipHash == m.hexdigest()
|
skip = skipHash == m.hexdigest()
|
||||||
|
|
||||||
if not skip:
|
if not skip:
|
||||||
|
audioFilename = self.media().writeData(audio['filename'], data)
|
||||||
for field in audio['fields']:
|
for field in audio['fields']:
|
||||||
if field in ankiNote:
|
if field in ankiNote:
|
||||||
ankiNote[field] += u'[sound:{}]'.format(audio['filename'])
|
ankiNote[field] += u'[sound:{}]'.format(audioFilename)
|
||||||
|
|
||||||
self.media().writeData(audio['filename'], data)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errorMessage = str(e).replace("&", "&").replace("<", "<").replace(">", ">")
|
errorMessage = str(e).replace("&", "&").replace("<", "<").replace(">", ">")
|
||||||
for field in audio['fields']:
|
for field in audio['fields']:
|
||||||
|
Loading…
Reference in New Issue
Block a user