mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
commit
f24321dc65
3 changed files with 16 additions and 2 deletions
|
@ -39,6 +39,7 @@ Sander Santema <github.com/sandersantema/>
|
||||||
Thomas Brownback <https://github.com/brownbat/>
|
Thomas Brownback <https://github.com/brownbat/>
|
||||||
Andrew Gaul <andrew@gaul.org>
|
Andrew Gaul <andrew@gaul.org>
|
||||||
kenden
|
kenden
|
||||||
|
Nickolay Yudin <kelciour@gmail.com>
|
||||||
|
|
||||||
********************
|
********************
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ class MPVBase:
|
||||||
"--ontop",
|
"--ontop",
|
||||||
"--audio-display=no",
|
"--audio-display=no",
|
||||||
"--keep-open=no",
|
"--keep-open=no",
|
||||||
|
"--reset-on-next-file=pause",
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, window_id=None, debug=False):
|
def __init__(self, window_id=None, debug=False):
|
||||||
|
|
|
@ -333,11 +333,20 @@ class MpvManager(MPV, SoundOrVideoPlayer):
|
||||||
self._on_done: Optional[OnDoneCallback] = None
|
self._on_done: Optional[OnDoneCallback] = None
|
||||||
self.default_argv += ["--config-dir=" + base_path]
|
self.default_argv += ["--config-dir=" + base_path]
|
||||||
super().__init__(window_id=None, debug=False)
|
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:
|
def play(self, tag: AVTag, on_done: OnDoneCallback) -> None:
|
||||||
assert isinstance(tag, SoundOrVideoTag)
|
assert isinstance(tag, SoundOrVideoTag)
|
||||||
self._on_done = on_done
|
self._on_done = on_done
|
||||||
path = os.path.join(os.getcwd(), tag.filename)
|
path = os.path.join(os.getcwd(), tag.filename)
|
||||||
|
self.command("script-message", "osc-visibility", "never", "no-osd")
|
||||||
self.command("loadfile", path, "append-play")
|
self.command("loadfile", path, "append-play")
|
||||||
gui_hooks.av_player_did_begin_playing(self, tag)
|
gui_hooks.av_player_did_begin_playing(self, tag)
|
||||||
|
|
||||||
|
@ -350,10 +359,13 @@ class MpvManager(MPV, SoundOrVideoPlayer):
|
||||||
def seek_relative(self, secs: int) -> None:
|
def seek_relative(self, secs: int) -> None:
|
||||||
self.command("seek", secs, "relative")
|
self.command("seek", secs, "relative")
|
||||||
|
|
||||||
def on_idle(self) -> None:
|
def on_property_idle_active(self, val) -> None:
|
||||||
if self._on_done:
|
if val and self._on_done:
|
||||||
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:
|
def shutdown(self) -> None:
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue