fix failing to create notes when audio could not be downloaded
This commit is contained in:
parent
0ca55353fa
commit
795709b9ac
@ -647,8 +647,8 @@ class AnkiConnect:
|
|||||||
|
|
||||||
audio = note.get('audio')
|
audio = note.get('audio')
|
||||||
if audio is not None and len(audio['fields']) > 0:
|
if audio is not None and len(audio['fields']) > 0:
|
||||||
|
try:
|
||||||
data = download(audio['url'])
|
data = download(audio['url'])
|
||||||
if data is not None:
|
|
||||||
if audio['skipHash'] is None:
|
if audio['skipHash'] is None:
|
||||||
skip = False
|
skip = False
|
||||||
else:
|
else:
|
||||||
@ -662,6 +662,8 @@ class AnkiConnect:
|
|||||||
ankiNote[field] += u'[sound:{}]'.format(audio['filename'])
|
ankiNote[field] += u'[sound:{}]'.format(audio['filename'])
|
||||||
|
|
||||||
self.media().writeData(audio['filename'], data)
|
self.media().writeData(audio['filename'], data)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
collection = self.collection()
|
collection = self.collection()
|
||||||
self.startEditing()
|
self.startEditing()
|
||||||
|
Loading…
Reference in New Issue
Block a user