From b63f0340fecf06237e74fbba672d07d0d5dc59b3 Mon Sep 17 00:00:00 2001 From: Et0h Date: Mon, 25 Aug 2014 19:20:47 +0100 Subject: [PATCH] Fixed mpv 0.5.0+ on linux --- syncplay/constants.py | 4 +++- syncplay/players/mplayer.py | 3 ++- syncplay/players/mpv.py | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index 31613bf..49f8a1b 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -105,7 +105,9 @@ STYLE_NOFILEITEM_COLOR = 'blue' MPLAYER_SLAVE_ARGS = ['-slave', '--hr-seek=always', '-nomsgcolor', '-msglevel', 'all=1:global=4:cplayer=4'] # --quiet works with both mpv 0.2 and 0.3 -MPV_SLAVE_ARGS = ['--slave-broken', '--hr-seek=always', '--quiet', '--keep-open'] +MPV_SLAVE_ARGS = ['--hr-seek=always', '--quiet', '--keep-open'] +MPV_SLAVE_ARGS_WINDOWS = ['--slave-broken'] +MPV_SLAVE_ARGS_NONWINDOWS = ['--input-terminal=no','input-file=/dev/stdin'] VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek', '--play-and-pause'] VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file'] diff --git a/syncplay/players/mplayer.py b/syncplay/players/mplayer.py index 8dd89a5..4f2fbe3 100644 --- a/syncplay/players/mplayer.py +++ b/syncplay/players/mplayer.py @@ -127,7 +127,7 @@ class MplayerPlayer(BasePlayer): def lineReceived(self, line): if line == "Error parsing option slave-broken (option not found)": - self.quitReason = "This version of Syncplay is not compatible with mpv 0.5.0+. Use mpv 0.4.0 or check for an update to Syncplay." + self.quitReason = "This version of Syncplay is not compatible with mpv 0.5.0+ on Windows. Use mpv 0.4.3 or check for an update to Syncplay." match = self.RE_ANSWER.match(line) if not match: @@ -266,6 +266,7 @@ class MplayerPlayer(BasePlayer): def sendLine(self, line): try: line = (line.decode('utf8') + u"\n").encode('utf8') + print line self.__process.stdin.write(line) except IOError: pass diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index 3799ec7..11c54c3 100644 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -1,9 +1,13 @@ from syncplay.players.mplayer import MplayerPlayer from syncplay import constants -import os +import os, sys class MpvPlayer(MplayerPlayer): SLAVE_ARGS = constants.MPV_SLAVE_ARGS + if sys.platform.startswith('win'): + SLAVE_ARGS.extend(constants.MPV_SLAVE_ARGS_WINDOWS) + else: + SLAVE_ARGS.extend(constants.MPV_SLAVE_ARGS_NONWINDOWS) POSITION_QUERY = 'time-pos' OSD_QUERY = 'show_text'