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:
kelciour 2025-01-10 11:16:08 +03:00 committed by GitHub
parent 4c34a2d133
commit 53be365678
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -88,7 +88,6 @@ class MPVBase:
"--keep-open=no",
"--autoload-files=no",
"--gapless-audio=no",
"--reset-on-next-file=pause",
]
if is_win:

View file

@ -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: