Fix audio
This commit is contained in:
parent
c64e78addf
commit
dc8494f0fe
@ -464,8 +464,14 @@ class AnkiConnect:
|
|||||||
|
|
||||||
|
|
||||||
def addAudio(self, ankiNote, audioObjectOrList):
|
def addAudio(self, ankiNote, audioObjectOrList):
|
||||||
if audioObjectOrList is not None:
|
if audioObjectOrList is None:
|
||||||
audioList = audioObjectOrList if isinstance(audioObjectOrList, list) else [audioObjectOrList]
|
return
|
||||||
|
|
||||||
|
if isinstance(audioObjectOrList, list):
|
||||||
|
audioList = audioObjectOrList
|
||||||
|
else:
|
||||||
|
audioList = [audioObjectOrList]
|
||||||
|
|
||||||
for audio in audioList:
|
for audio in audioList:
|
||||||
if audio is not None and len(audio['fields']) > 0:
|
if audio is not None and len(audio['fields']) > 0:
|
||||||
try:
|
try:
|
||||||
@ -509,12 +515,11 @@ class AnkiConnect:
|
|||||||
if name in ankiNote:
|
if name in ankiNote:
|
||||||
ankiNote[name] = value
|
ankiNote[name] = value
|
||||||
|
|
||||||
audioObjectOrList = note['audio']
|
audioObjectOrList = note.get('audio')
|
||||||
self.addAudio(ankiNote, audioObjectOrList)
|
self.addAudio(ankiNote, audioObjectOrList)
|
||||||
|
|
||||||
ankiNote.flush()
|
ankiNote.flush()
|
||||||
|
|
||||||
|
|
||||||
@util.api()
|
@util.api()
|
||||||
def addTags(self, notes, tags, add=True):
|
def addTags(self, notes, tags, add=True):
|
||||||
self.startEditing()
|
self.startEditing()
|
||||||
|
Loading…
Reference in New Issue
Block a user