mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
identify temp files as anki, quiet lame
This commit is contained in:
parent
d4ac87bc19
commit
75d6123dc3
4 changed files with 8 additions and 26 deletions
|
@ -1516,7 +1516,7 @@ where id = :id""", pending)
|
||||||
else:
|
else:
|
||||||
# memory-backed; need temp store
|
# memory-backed; need temp store
|
||||||
if not self.tmpMediaDir and create:
|
if not self.tmpMediaDir and create:
|
||||||
self.tmpMediaDir = tempfile.mkdtemp()
|
self.tmpMediaDir = tempfile.mkdtemp(prefix="anki")
|
||||||
dir = self.tmpMediaDir
|
dir = self.tmpMediaDir
|
||||||
if not dir or not os.path.exists(dir):
|
if not dir or not os.path.exists(dir):
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -27,7 +27,7 @@ regexps = {
|
||||||
"math": re.compile(r"\[\$\$\](.+?)\[/\$\$\]", re.DOTALL | re.IGNORECASE),
|
"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
|
# add standard tex install location to osx
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
|
|
|
@ -46,7 +46,7 @@ processingChain = [
|
||||||
None, # placeholder
|
None, # placeholder
|
||||||
["sox", "tmp2.wav", "tmp3.wav", "norm", NORM_AMOUNT,
|
["sox", "tmp2.wav", "tmp3.wav", "norm", NORM_AMOUNT,
|
||||||
"bass", BASS_AMOUNT, "fade", FADE_AMOUNT, "0"],
|
"bass", BASS_AMOUNT, "fade", FADE_AMOUNT, "0"],
|
||||||
["lame", "tmp3.wav", processingDst, "--noreplaygain"],
|
["lame", "tmp3.wav", processingDst, "--noreplaygain", "--quiet"],
|
||||||
]
|
]
|
||||||
|
|
||||||
queue = []
|
queue = []
|
||||||
|
@ -83,7 +83,7 @@ def checkForNoiseProfile():
|
||||||
if sys.platform.startswith("darwin"):
|
if sys.platform.startswith("darwin"):
|
||||||
# not currently supported
|
# not currently supported
|
||||||
processingChain = [
|
processingChain = [
|
||||||
["lame", "tmp.wav", "tmp.mp3", "--noreplaygain"]]
|
["lame", "tmp.wav", "tmp.mp3", "--noreplaygain", "--quiet"]]
|
||||||
else:
|
else:
|
||||||
cmd = ["sox", processingSrc, "tmp2.wav"]
|
cmd = ["sox", processingSrc, "tmp2.wav"]
|
||||||
if os.path.exists(noiseProfile):
|
if os.path.exists(noiseProfile):
|
||||||
|
|
|
@ -28,7 +28,7 @@ def setup1():
|
||||||
def test_export_anki():
|
def test_export_anki():
|
||||||
oldTime = deck.modified
|
oldTime = deck.modified
|
||||||
e = AnkiExporter(deck)
|
e = AnkiExporter(deck)
|
||||||
newname = unicode(tempfile.mkstemp()[1])
|
newname = unicode(tempfile.mkstemp(prefix="ankitest")[1])
|
||||||
os.unlink(newname)
|
os.unlink(newname)
|
||||||
e.exportInto(newname)
|
e.exportInto(newname)
|
||||||
assert deck.modified == oldTime
|
assert deck.modified == oldTime
|
||||||
|
@ -36,7 +36,7 @@ def test_export_anki():
|
||||||
d2 = DeckStorage.Deck(newname)
|
d2 = DeckStorage.Deck(newname)
|
||||||
assert d2.cardCount == 4
|
assert d2.cardCount == 4
|
||||||
# try again, limited to a tag
|
# try again, limited to a tag
|
||||||
newname = unicode(tempfile.mkstemp()[1])
|
newname = unicode(tempfile.mkstemp(prefix="ankitest")[1])
|
||||||
os.unlink(newname)
|
os.unlink(newname)
|
||||||
e.limitTags = ['tag']
|
e.limitTags = ['tag']
|
||||||
e.exportInto(newname)
|
e.exportInto(newname)
|
||||||
|
@ -46,35 +46,17 @@ def test_export_anki():
|
||||||
@nose.with_setup(setup1)
|
@nose.with_setup(setup1)
|
||||||
def test_export_textcard():
|
def test_export_textcard():
|
||||||
e = TextCardExporter(deck)
|
e = TextCardExporter(deck)
|
||||||
f = unicode(tempfile.mkstemp()[1])
|
f = unicode(tempfile.mkstemp(prefix="ankitest")[1])
|
||||||
os.unlink(f)
|
os.unlink(f)
|
||||||
e.exportInto(f)
|
e.exportInto(f)
|
||||||
e.includeTags = True
|
e.includeTags = True
|
||||||
e.exportInto(f)
|
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)
|
@nose.with_setup(setup1)
|
||||||
def test_export_textfact():
|
def test_export_textfact():
|
||||||
e = TextFactExporter(deck)
|
e = TextFactExporter(deck)
|
||||||
f = unicode(tempfile.mkstemp()[1])
|
f = unicode(tempfile.mkstemp(prefix="ankitest")[1])
|
||||||
os.unlink(f)
|
os.unlink(f)
|
||||||
e.exportInto(f)
|
e.exportInto(f)
|
||||||
e.includeTags = True
|
e.includeTags = True
|
||||||
e.exportInto(f)
|
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
|
|
||||||
|
|
Loading…
Reference in a new issue