From 8cac607588875d3700ee2e66f7b3d6ee6b171cac 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 095df2f6f8c7d4705a8e7c435ba4a1df1836d6b6 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")