mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 23:42:23 -04:00
mention audio requirements, save recorder location, tweaks
This commit is contained in:
parent
559a896f24
commit
7f8c18ce35
2 changed files with 25 additions and 9 deletions
15
README
15
README
|
@ -1,4 +1,4 @@
|
||||||
Anki for Linux
|
Anki
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
|
@ -14,14 +14,19 @@ For graph generation:
|
||||||
- python-numpy (numpy)
|
- python-numpy (numpy)
|
||||||
- python-matplotlib (matplotlib)
|
- python-matplotlib (matplotlib)
|
||||||
|
|
||||||
|
For audio playing support:
|
||||||
|
|
||||||
|
- mplayer on Windows/Linux (Mac uses native libraries)
|
||||||
|
|
||||||
|
For audio recording support:
|
||||||
|
|
||||||
|
- sox
|
||||||
|
- pyaudio
|
||||||
|
|
||||||
For furigana generation:
|
For furigana generation:
|
||||||
|
|
||||||
- kakasi
|
- kakasi
|
||||||
|
|
||||||
For audio support:
|
|
||||||
|
|
||||||
- mplayer
|
|
||||||
|
|
||||||
Running / Installation
|
Running / Installation
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -6,21 +6,32 @@ from PyQt4.QtCore import *
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from anki.sound import Recorder, play
|
from anki.sound import Recorder, play
|
||||||
|
from ankiqt.ui.utils import saveGeom, restoreGeom
|
||||||
|
|
||||||
def getAudio(parent, string=""):
|
def getAudio(parent, string=""):
|
||||||
"Record and return filename"
|
"Record and return filename"
|
||||||
# record first
|
# record first
|
||||||
r = Recorder()
|
r = Recorder()
|
||||||
mb = QMessageBox(parent)
|
mb = QMessageBox(parent)
|
||||||
|
restoreGeom(mb, "audioRecorder")
|
||||||
|
mb.setWindowTitle("Anki")
|
||||||
|
mb.setIconPixmap(QPixmap(":/icons/media-record.png"))
|
||||||
but = QPushButton(_(" Stop"))
|
but = QPushButton(_(" Stop"))
|
||||||
but.setIcon(QIcon(":/icons/media-playback-stop.png"))
|
but.setIcon(QIcon(":/icons/media-playback-stop.png"))
|
||||||
but.setIconSize(QSize(32, 32))
|
#but.setIconSize(QSize(32, 32))
|
||||||
mb.addButton(but, QMessageBox.RejectRole)
|
mb.addButton(but, QMessageBox.RejectRole)
|
||||||
mb.show()
|
mb.show()
|
||||||
mb.setText("Recording..")
|
t = time.time()
|
||||||
QApplication.instance().processEvents()
|
|
||||||
r.start()
|
r.start()
|
||||||
mb.exec_()
|
QApplication.instance().processEvents()
|
||||||
|
while not mb.clickedButton():
|
||||||
|
txt =_("Recording...<br>Time: %0.1f")
|
||||||
|
mb.setText(txt % (time.time() - t))
|
||||||
|
QApplication.instance().processEvents()
|
||||||
|
# ensure at least a second captured
|
||||||
|
saveGeom(mb, "audioRecorder")
|
||||||
|
while time.time() - t < 1:
|
||||||
|
time.sleep(0.1)
|
||||||
r.stop()
|
r.stop()
|
||||||
# process
|
# process
|
||||||
r.postprocess()
|
r.postprocess()
|
||||||
|
|
Loading…
Reference in a new issue