From 39af3d327f402fbf93546ad142ea21de42cb376e Mon Sep 17 00:00:00 2001 From: kelciour Date: Fri, 12 Jun 2020 14:09:47 +0300 Subject: [PATCH 1/5] Add myself to CONTRIBUTORS --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 720d99ec1..95a9d3ef8 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -39,6 +39,7 @@ Sander Santema Thomas Brownback Andrew Gaul kenden +Nickolay Yudin ******************** From ae533fce716ae8b45c5d26ee56b4c73a8564b6ea Mon Sep 17 00:00:00 2001 From: kelciour Date: Fri, 19 Jun 2020 23:10:05 +0300 Subject: [PATCH 2/5] Replace default mpv "quit" keybindings with "stop" https://github.com/mpv-player/mpv/blob/master/etc/input.conf --- qt/aqt/sound.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index a286b1129..475ef4c70 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -333,6 +333,14 @@ class MpvManager(MPV, SoundOrVideoPlayer): self._on_done: Optional[OnDoneCallback] = None self.default_argv += ["--config-dir=" + base_path] super().__init__(window_id=None, debug=False) + self.init() + + def init(self) -> None: + self.command("keybind", "q", "stop") + self.command("keybind", "Q", "stop") + self.command("keybind", "CLOSE_WIN", "stop") + self.command("keybind", "ctrl+w", "stop") + self.command("keybind", "ctrl+c", "stop") def play(self, tag: AVTag, on_done: OnDoneCallback) -> None: assert isinstance(tag, SoundOrVideoTag) From 9aee8085e091f8fc5b208470e1d30dc7ba5697f0 Mon Sep 17 00:00:00 2001 From: kelciour Date: Sat, 20 Jun 2020 01:21:11 +0300 Subject: [PATCH 3/5] Disable OSC idle message --- qt/aqt/sound.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 475ef4c70..0cb5d104f 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -346,6 +346,7 @@ class MpvManager(MPV, SoundOrVideoPlayer): assert isinstance(tag, SoundOrVideoTag) self._on_done = on_done path = os.path.join(os.getcwd(), tag.filename) + self.command("script-message", "osc-visibility", "never", "no-osd") self.command("loadfile", path, "append-play") gui_hooks.av_player_did_begin_playing(self, tag) @@ -362,6 +363,9 @@ class MpvManager(MPV, SoundOrVideoPlayer): if self._on_done: self._on_done() + def on_start_file(self) -> None: + self.command("script-message", "osc-visibility", "auto", "no-osd") + def shutdown(self) -> None: self.close() From d64c26f20ab6b72458aa1cc449022b448811318f Mon Sep 17 00:00:00 2001 From: kelciour Date: Sat, 20 Jun 2020 01:36:58 +0300 Subject: [PATCH 4/5] Replace deprecated "idle" event with "idle-active" property --- qt/aqt/sound.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 0cb5d104f..20e3d719e 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -359,8 +359,8 @@ class MpvManager(MPV, SoundOrVideoPlayer): def seek_relative(self, secs: int) -> None: self.command("seek", secs, "relative") - def on_idle(self) -> None: - if self._on_done: + def on_property_idle_active(self, val) -> None: + if val and self._on_done: self._on_done() def on_start_file(self) -> None: From 678b75101076f963695997f6cf59bfe9b6bba902 Mon Sep 17 00:00:00 2001 From: kelciour Date: Sat, 20 Jun 2020 01:51:53 +0300 Subject: [PATCH 5/5] Reset pause mode when switching to the next file --- qt/aqt/mpv.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qt/aqt/mpv.py b/qt/aqt/mpv.py index da0cad250..eab2e4514 100644 --- a/qt/aqt/mpv.py +++ b/qt/aqt/mpv.py @@ -84,6 +84,7 @@ class MPVBase: "--ontop", "--audio-display=no", "--keep-open=no", + "--reset-on-next-file=pause", ] def __init__(self, window_id=None, debug=False):