mirror of
https://github.com/ankitects/anki.git
synced 2025-11-14 16:47:12 -05:00
patch from saturnien to make mp3 encoding optional
This commit is contained in:
parent
5fed1f7f35
commit
03ae1d6ca7
1 changed files with 9 additions and 2 deletions
|
|
@ -242,9 +242,12 @@ except:
|
||||||
|
|
||||||
class _Recorder(object):
|
class _Recorder(object):
|
||||||
|
|
||||||
def postprocess(self):
|
def postprocess(self, encode=True):
|
||||||
|
self.encode = encode
|
||||||
for c in processingChain:
|
for c in processingChain:
|
||||||
#print c
|
#print c
|
||||||
|
if not self.encode and c[0] == 'lame':
|
||||||
|
continue
|
||||||
ret = retryWait(subprocess.Popen(c, startupinfo=si))
|
ret = retryWait(subprocess.Popen(c, startupinfo=si))
|
||||||
if ret:
|
if ret:
|
||||||
raise Exception(_("""
|
raise Exception(_("""
|
||||||
|
|
@ -303,6 +306,7 @@ class PyAudioRecorder(_Recorder):
|
||||||
os.unlink(t)
|
os.unlink(t)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
self.encode = False
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.thread = PyAudioThreadedRecorder()
|
self.thread = PyAudioThreadedRecorder()
|
||||||
|
|
@ -313,7 +317,10 @@ class PyAudioRecorder(_Recorder):
|
||||||
self.thread.join()
|
self.thread.join()
|
||||||
|
|
||||||
def file(self):
|
def file(self):
|
||||||
|
if self.encode:
|
||||||
return processingDst
|
return processingDst
|
||||||
|
else:
|
||||||
|
return tmpFiles[1]
|
||||||
|
|
||||||
# Default audio player
|
# Default audio player
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue