mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
cleanup recording on cancel
This commit is contained in:
parent
7a9508ea75
commit
95387af2cd
2 changed files with 6 additions and 2 deletions
|
@ -334,13 +334,16 @@ class _Recorder:
|
||||||
except:
|
except:
|
||||||
ret = True
|
ret = True
|
||||||
finally:
|
finally:
|
||||||
if os.path.exists(processingSrc):
|
self.cleanup()
|
||||||
os.unlink(processingSrc)
|
|
||||||
if ret:
|
if ret:
|
||||||
raise Exception(_(
|
raise Exception(_(
|
||||||
"Error running %s") %
|
"Error running %s") %
|
||||||
" ".join(cmd))
|
" ".join(cmd))
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
if os.path.exists(processingSrc):
|
||||||
|
os.unlink(processingSrc)
|
||||||
|
|
||||||
class PyAudioThreadedRecorder(threading.Thread):
|
class PyAudioThreadedRecorder(threading.Thread):
|
||||||
|
|
||||||
def __init__(self, startupDelay):
|
def __init__(self, startupDelay):
|
||||||
|
|
|
@ -40,6 +40,7 @@ def getAudio(parent, encode=True):
|
||||||
QApplication.instance().processEvents()
|
QApplication.instance().processEvents()
|
||||||
if mb.clickedButton() == mb.escapeButton():
|
if mb.clickedButton() == mb.escapeButton():
|
||||||
r.stop()
|
r.stop()
|
||||||
|
r.cleanup()
|
||||||
return
|
return
|
||||||
saveGeom(mb, "audioRecorder")
|
saveGeom(mb, "audioRecorder")
|
||||||
# ensure at least a second captured
|
# ensure at least a second captured
|
||||||
|
|
Loading…
Reference in a new issue