From 5c8f45b2c44b76ecb0c1b962796a856a55ab50a2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 4 Jul 2012 18:18:54 +0900 Subject: [PATCH] make question replaying a deck property; add exclude arg to play --- anki/collection.py | 1 - anki/decks.py | 1 + anki/sound.py | 7 +++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/anki/collection.py b/anki/collection.py index d619f7aaa..57e82a60c 100644 --- a/anki/collection.py +++ b/anki/collection.py @@ -33,7 +33,6 @@ defaultConf = { 'sortType': "noteFld", 'sortBackwards': False, 'addToCur': True, # add new to currently selected deck? - 'replayBoth': True, # include question when replaying answer? } # this is initialized by storage.Collection diff --git a/anki/decks.py b/anki/decks.py index 512efe572..fe116e32f 100644 --- a/anki/decks.py +++ b/anki/decks.py @@ -73,6 +73,7 @@ defaultConf = { 'maxTaken': 60, 'timer': 0, 'autoplay': True, + 'replayq': True, 'mod': 0, 'usn': 0, } diff --git a/anki/sound.py b/anki/sound.py index 6184d34c0..1fdfa68c9 100644 --- a/anki/sound.py +++ b/anki/sound.py @@ -10,9 +10,12 @@ from anki.utils import namedtmp, tmpdir, isWin, isMac # Shared utils ########################################################################## -def playFromText(text): +def playFromText(text, exclude=""): + reg = "\[sound:(.*?)\]" fnames = {} - for match in re.findall("\[sound:(.*?)\]", text): + 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