fall back to mplayer if mpv not found or too old

ubuntu 14.04 looks to be using an ancient mpv version
This commit is contained in:
Damien Elmes 2017-10-05 17:24:55 +10:00
parent 33c5b5f9e7
commit d8d6430ec7
2 changed files with 3 additions and 9 deletions

View file

@ -72,7 +72,7 @@ Anki manual for more information.""")
if "Pyaudio not" in error: if "Pyaudio not" in error:
return showWarning(_("Please install PyAudio")) return showWarning(_("Please install PyAudio"))
if "install mplayer" in error: if "install mplayer" in error:
return showWarning(_("Please install mplayer")) return showWarning(_("Sound and video on cards will not function until mpv or mplayer is installed."))
if "no default input" in error.lower(): if "no default input" in error.lower():
return showWarning(_("Please connect a microphone, and ensure " return showWarning(_("Please connect a microphone, and ensure "
"other programs are not using the audio device.")) "other programs are not using the audio device."))

View file

@ -309,15 +309,9 @@ close the profile or restart Anki."""))
try: try:
anki.sound.setupMPV() anki.sound.setupMPV()
except FileNotFoundError: except FileNotFoundError:
showWarning(_("mpv is not installed - audio and video on cards will not work.")) print("mpv not found, reverting to mplayer")
self.disableSound()
except anki.mpv.MPVProcessError: except anki.mpv.MPVProcessError:
showWarning(_("mpv failed to start - please ensure it is version 0.17 or later.")) print("mpv too old, reverting to mplayer")
self.disableSound()
def disableSound(self):
anki.sound._player = lambda file: 1
anki.sound._queueEraser = lambda: 1
# Collection load/unload # Collection load/unload
########################################################################## ##########################################################################