mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 23:42:23 -04:00
don't needlessly copy recorded audio
This commit is contained in:
parent
b6665230d1
commit
7054281bb8
1 changed files with 7 additions and 4 deletions
|
@ -964,14 +964,17 @@ class FactEditor(object):
|
|||
return
|
||||
self._addSound(file, widget=w)
|
||||
|
||||
def _addSound(self, file, widget=None):
|
||||
def _addSound(self, file, widget=None, copy=True):
|
||||
self.initMedia()
|
||||
if widget:
|
||||
w = widget
|
||||
else:
|
||||
w = self.focusedEdit()
|
||||
if copy:
|
||||
path = self._addMedia(file)
|
||||
self.maybeDelete(path, file)
|
||||
else:
|
||||
path = file
|
||||
anki.sound.play(path)
|
||||
w.insertHtml('[sound:%s]' % path)
|
||||
|
||||
|
@ -998,7 +1001,7 @@ to enable recording.'''), parent=self.parent)
|
|||
return
|
||||
raise
|
||||
if file:
|
||||
self._addSound(unicode(file), widget=w)
|
||||
self._addSound(file, w, copy=False)
|
||||
|
||||
class FactEdit(QTextEdit):
|
||||
|
||||
|
|
Loading…
Reference in a new issue