From 580e5618059b6e997918f8291142642870ff1a28 Mon Sep 17 00:00:00 2001 From: kelciour Date: Fri, 21 Aug 2020 02:17:21 +0300 Subject: [PATCH 1/2] Reset av_player.current_player after mpv restart --- qt/aqt/sound.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index fd8c637cb..91e17bbbb 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -335,6 +335,7 @@ class MpvManager(MPV, SoundOrVideoPlayer): super().__init__(window_id=None, debug=False) def on_init(self) -> None: + self.on_end_file() try: self.command("keybind", "q", "stop") self.command("keybind", "Q", "stop") From 54f8a7ded5098a0de0202f7a66d68e875f34df99 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 21 Aug 2020 11:10:30 +1000 Subject: [PATCH 2/2] Add comment --- qt/aqt/sound.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 91e17bbbb..6bde715a1 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -335,7 +335,10 @@ class MpvManager(MPV, SoundOrVideoPlayer): super().__init__(window_id=None, debug=False) def on_init(self) -> None: + # if mpv dies and is restarted, tell Anki the + # current file is done self.on_end_file() + try: self.command("keybind", "q", "stop") self.command("keybind", "Q", "stop")