diff --git a/anki/deck.py b/anki/deck.py index 9e400fa99..fdf64e322 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -1516,7 +1516,7 @@ where id = :id""", pending) else: # memory-backed; need temp store if not self.tmpMediaDir and create: - self.tmpMediaDir = tempfile.mkdtemp() + self.tmpMediaDir = tempfile.mkdtemp(prefix="anki") dir = self.tmpMediaDir if not dir or not os.path.exists(dir): return None diff --git a/anki/latex.py b/anki/latex.py index e0163126c..e73af2868 100644 --- a/anki/latex.py +++ b/anki/latex.py @@ -27,7 +27,7 @@ regexps = { "math": re.compile(r"\[\$\$\](.+?)\[/\$\$\]", re.DOTALL | re.IGNORECASE), } -tmpdir = tempfile.mkdtemp(prefix="anki-latex") +tmpdir = tempfile.mkdtemp(prefix="anki") # add standard tex install location to osx if sys.platform == "darwin": diff --git a/anki/sound.py b/anki/sound.py index 9ea0a96b6..64e310531 100644 --- a/anki/sound.py +++ b/anki/sound.py @@ -46,7 +46,7 @@ processingChain = [ None, # placeholder ["sox", "tmp2.wav", "tmp3.wav", "norm", NORM_AMOUNT, "bass", BASS_AMOUNT, "fade", FADE_AMOUNT, "0"], - ["lame", "tmp3.wav", processingDst, "--noreplaygain"], + ["lame", "tmp3.wav", processingDst, "--noreplaygain", "--quiet"], ] queue = [] @@ -83,7 +83,7 @@ def checkForNoiseProfile(): if sys.platform.startswith("darwin"): # not currently supported processingChain = [ - ["lame", "tmp.wav", "tmp.mp3", "--noreplaygain"]] + ["lame", "tmp.wav", "tmp.mp3", "--noreplaygain", "--quiet"]] else: cmd = ["sox", processingSrc, "tmp2.wav"] if os.path.exists(noiseProfile): diff --git a/tests/test_exporting.py b/tests/test_exporting.py index 6fe7cceaa..3375654f6 100644 --- a/tests/test_exporting.py +++ b/tests/test_exporting.py @@ -28,7 +28,7 @@ def setup1(): def test_export_anki(): oldTime = deck.modified e = AnkiExporter(deck) - newname = unicode(tempfile.mkstemp()[1]) + newname = unicode(tempfile.mkstemp(prefix="ankitest")[1]) os.unlink(newname) e.exportInto(newname) assert deck.modified == oldTime @@ -36,7 +36,7 @@ def test_export_anki(): d2 = DeckStorage.Deck(newname) assert d2.cardCount == 4 # try again, limited to a tag - newname = unicode(tempfile.mkstemp()[1]) + newname = unicode(tempfile.mkstemp(prefix="ankitest")[1]) os.unlink(newname) e.limitTags = ['tag'] e.exportInto(newname) @@ -46,35 +46,17 @@ def test_export_anki(): @nose.with_setup(setup1) def test_export_textcard(): e = TextCardExporter(deck) - f = unicode(tempfile.mkstemp()[1]) + f = unicode(tempfile.mkstemp(prefix="ankitest")[1]) os.unlink(f) e.exportInto(f) e.includeTags = True e.exportInto(f) -# # test speed -# newname = unicode(tempfile.mkstemp()[1]) -# os.unlink(newname) -# d = DeckStorage.Deck("/home/resolve/speed.db") -# import time; t = time.time() -# e = TextCardExporter(d) -# e.exportInto(newname) -# print time.time() - t - @nose.with_setup(setup1) def test_export_textfact(): e = TextFactExporter(deck) - f = unicode(tempfile.mkstemp()[1]) + f = unicode(tempfile.mkstemp(prefix="ankitest")[1]) os.unlink(f) e.exportInto(f) e.includeTags = True e.exportInto(f) - -# # test speed -# newname = unicode(tempfile.mkstemp()[1]) -# os.unlink(newname) -# d = DeckStorage.Deck("/home/resolve/speed.db") -# import time; t = time.time() -# e = TextFactExporter(d) -# e.exportInto(newname) -# print time.time() - t