restore mpv/mplayer missing warning that got lost in the av changes

and ensure the UI doesn't get temporarily stuck after the command fails
This commit is contained in:
Damien Elmes 2020-02-29 21:05:37 +10:00
parent 56b2cc58ed
commit 8c0d4c8059
2 changed files with 9 additions and 8 deletions

View file

@ -82,12 +82,6 @@ your system's temporary folder may be incorrect."""
"Your firewall or antivirus program is preventing Anki from creating a connection to itself. Please add an exception for Anki." "Your firewall or antivirus program is preventing Anki from creating a connection to itself. Please add an exception for Anki."
) )
) )
if "install mplayer" in error:
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( return showWarning(
_( _(

View file

@ -1,6 +1,5 @@
# Copyright: Ankitects Pty Ltd and contributors # Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import atexit import atexit
import os import os
import re import re
@ -25,7 +24,7 @@ from aqt import gui_hooks
from aqt.mpv import MPV, MPVBase from aqt.mpv import MPV, MPVBase
from aqt.qt import * from aqt.qt import *
from aqt.taskman import TaskManager from aqt.taskman import TaskManager
from aqt.utils import restoreGeom, saveGeom, startup_info from aqt.utils import restoreGeom, saveGeom, showWarning, startup_info
# AV player protocol # AV player protocol
########################################################################## ##########################################################################
@ -291,6 +290,14 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method
except PlayerInterrupted: except PlayerInterrupted:
# don't fire done callback when interrupted # don't fire done callback when interrupted
return return
except FileNotFoundError:
showWarning(
_(
"Sound and video on cards will not function until mpv or mplayer is installed."
)
)
# must call cb() here, as we don't currently have another way
# to flag to av_player that we've stopped
cb() cb()