From 3840f012be79986cd6d25b793f1a36be4c16b7ce Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 5 Oct 2017 15:46:20 +1000 Subject: [PATCH] catch errors caused by old mpv versions --- aqt/main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aqt/main.py b/aqt/main.py index eccbff87c..59f39a235 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -24,6 +24,7 @@ import aqt.stats import aqt.mediasrv from aqt.utils import showWarning import anki.sound +import anki.mpv from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \ restoreState, getOnlyText, askUser, applyStyles, showText, tooltip, \ openHelp, openLink, checkInvalidFilename, getFile @@ -309,8 +310,14 @@ close the profile or restart Anki.""")) anki.sound.setupMPV() except FileNotFoundError: showWarning(_("mpv is not installed - audio and video on cards will not work.")) - anki.sound._player = lambda file: 1 - anki.sound._queueEraser = lambda: 1 + self.disableSound() + except anki.mpv.MPVProcessError: + showWarning(_("mpv failed to start - please ensure it is version 0.17 or later.")) + self.disableSound() + + def disableSound(self): + anki.sound._player = lambda file: 1 + anki.sound._queueEraser = lambda: 1 # Collection load/unload ##########################################################################