mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 23:27:12 -05:00
no need to exclude/dedupe audio anymore
because audio is stripped from FrontSide, we don't need to jump through hoops to ensure audio plays correctly anymore
This commit is contained in:
parent
2616e95348
commit
bd80f31c48
1 changed files with 6 additions and 11 deletions
|
|
@ -10,22 +10,17 @@ from anki.utils import namedtmp, tmpdir, isWin, isMac
|
||||||
# Shared utils
|
# Shared utils
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def playFromText(text, exclude=""):
|
_soundReg = "\[sound:(.*?)\]"
|
||||||
reg = "\[sound:(.*?)\]"
|
|
||||||
fnames = {}
|
def playFromText(text):
|
||||||
for match in re.findall(reg, exclude):
|
for match in re.findall(_soundReg, text):
|
||||||
fnames[match] = True
|
|
||||||
for match in re.findall(reg, text):
|
|
||||||
if match in fnames:
|
|
||||||
continue
|
|
||||||
fnames[match] = True
|
|
||||||
play(match)
|
play(match)
|
||||||
|
|
||||||
def stripSounds(text):
|
def stripSounds(text):
|
||||||
return re.sub("\[sound:.*?\]", "", text)
|
return re.sub(_soundReg, "", text)
|
||||||
|
|
||||||
def hasSound(text):
|
def hasSound(text):
|
||||||
return re.search("\[sound:.*?\]", text) is not None
|
return re.search(_soundReg, text) is not None
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue