Fixed mpv 0.5.0+ on linux

This commit is contained in:
Et0h 2014-08-25 19:20:47 +01:00
parent aa05ed473d
commit b63f0340fe
3 changed files with 10 additions and 3 deletions

View File

@ -105,7 +105,9 @@ STYLE_NOFILEITEM_COLOR = 'blue'
MPLAYER_SLAVE_ARGS = ['-slave', '--hr-seek=always', '-nomsgcolor', '-msglevel', 'all=1:global=4:cplayer=4'] 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 # --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', VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
'--play-and-pause'] '--play-and-pause']
VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file'] VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file']

View File

@ -127,7 +127,7 @@ class MplayerPlayer(BasePlayer):
def lineReceived(self, line): def lineReceived(self, line):
if line == "Error parsing option slave-broken (option not found)": 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) match = self.RE_ANSWER.match(line)
if not match: if not match:
@ -266,6 +266,7 @@ class MplayerPlayer(BasePlayer):
def sendLine(self, line): def sendLine(self, line):
try: try:
line = (line.decode('utf8') + u"\n").encode('utf8') line = (line.decode('utf8') + u"\n").encode('utf8')
print line
self.__process.stdin.write(line) self.__process.stdin.write(line)
except IOError: except IOError:
pass pass

View File

@ -1,9 +1,13 @@
from syncplay.players.mplayer import MplayerPlayer from syncplay.players.mplayer import MplayerPlayer
from syncplay import constants from syncplay import constants
import os import os, sys
class MpvPlayer(MplayerPlayer): class MpvPlayer(MplayerPlayer):
SLAVE_ARGS = constants.MPV_SLAVE_ARGS 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' POSITION_QUERY = 'time-pos'
OSD_QUERY = 'show_text' OSD_QUERY = 'show_text'