mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Fix mpv loadfile syntax change 2 (#3711)
* Revert "Fix mpv loadfile syntax change (#3105)"
This reverts commit 111f3bd138
.
* Fix mpv loadfile syntax change 2
This commit is contained in:
parent
4c34a2d133
commit
53be365678
2 changed files with 10 additions and 2 deletions
|
@ -88,7 +88,6 @@ class MPVBase:
|
|||
"--keep-open=no",
|
||||
"--autoload-files=no",
|
||||
"--gapless-audio=no",
|
||||
"--reset-on-next-file=pause",
|
||||
]
|
||||
|
||||
if is_win:
|
||||
|
|
|
@ -427,6 +427,12 @@ class MpvManager(MPV, SoundOrVideoPlayer):
|
|||
if self._on_done:
|
||||
self._on_done()
|
||||
|
||||
m = re.search(r"(\d+)\.(\d+)\.(\d+)", self.get_property("mpv-version"))
|
||||
if m:
|
||||
self.mpv_version = (int(m[1]), int(m[2]), int(m[3]))
|
||||
else:
|
||||
self.mpv_version = None
|
||||
|
||||
try:
|
||||
self.command("keybind", "q", "stop")
|
||||
self.command("keybind", "Q", "stop")
|
||||
|
@ -442,7 +448,10 @@ class MpvManager(MPV, SoundOrVideoPlayer):
|
|||
filename = hooks.media_file_filter(tag.filename)
|
||||
path = os.path.join(self.media_folder, filename)
|
||||
|
||||
self.command("loadfile", path, "replace")
|
||||
if self.mpv_version is None or self.mpv_version >= (0, 38, 0):
|
||||
self.command("loadfile", path, "replace", -1, "pause=no")
|
||||
else:
|
||||
self.command("loadfile", path, "replace", "pause=no")
|
||||
gui_hooks.av_player_did_begin_playing(self, tag)
|
||||
|
||||
def stop(self) -> None:
|
||||
|
|
Loading…
Reference in a new issue