mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 15:17: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
|
||||
##########################################################################
|
||||
|
||||
def playFromText(text, exclude=""):
|
||||
reg = "\[sound:(.*?)\]"
|
||||
fnames = {}
|
||||
for match in re.findall(reg, exclude):
|
||||
fnames[match] = True
|
||||
for match in re.findall(reg, text):
|
||||
if match in fnames:
|
||||
continue
|
||||
fnames[match] = True
|
||||
_soundReg = "\[sound:(.*?)\]"
|
||||
|
||||
def playFromText(text):
|
||||
for match in re.findall(_soundReg, text):
|
||||
play(match)
|
||||
|
||||
def stripSounds(text):
|
||||
return re.sub("\[sound:.*?\]", "", text)
|
||||
return re.sub(_soundReg, "", 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