Fixed the deprecated calls in mpv, removed -no-msgcolor as it apparently didn't have any effect
This commit is contained in:
parent
68f619d3af
commit
b8f84c80c3
@ -86,10 +86,10 @@ VLC_MAX_PORT = 55000
|
||||
#These are not changes you're looking for
|
||||
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', '--no-msgcolor', '--quiet']
|
||||
MPV_SLAVE_ARGS = ['--slave-broken', '--hr-seek=always', '--quiet']
|
||||
VLC_SLAVE_ARGS = ['--extraintf=luaintf','--lua-intf=syncplay','--no-quiet','--no-input-fast-seek']
|
||||
VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance','--no-one-instance-when-started-from-file']
|
||||
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_]+)=(.+)$"
|
||||
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$"
|
||||
VLC_ANSWER_REGEX = r"(?:^(?P<command>[a-zA-Z_]+)(?:\: )?(?P<argument>.*))"
|
||||
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
|
||||
UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P<sign>[/+-])?(?P<time>\d{1,4}(?:[^\d\.](?:\d{1,6})){0,2}(?:\.(?:\d{1,3}))?)$"
|
||||
|
||||
@ -10,6 +10,9 @@ class MplayerPlayer(BasePlayer):
|
||||
speedSupported = True
|
||||
RE_ANSWER = re.compile(constants.MPLAYER_ANSWER_REGEX)
|
||||
SLAVE_ARGS = constants.MPLAYER_SLAVE_ARGS
|
||||
POSITION_QUERY = 'time_pos'
|
||||
OSD_QUERY = 'osd_show_text'
|
||||
|
||||
def __init__(self, client, playerPath, filePath, args):
|
||||
from twisted.internet import reactor
|
||||
self.reactor = reactor
|
||||
@ -75,7 +78,7 @@ class MplayerPlayer(BasePlayer):
|
||||
self._listener.sendLine("get_property {}".format(property_))
|
||||
|
||||
def displayMessage(self, message, duration=(constants.OSD_DURATION * 1000)):
|
||||
self._listener.sendLine(u'osd_show_text "{!s}" {} {}'.format(message, duration, constants.MPLAYER_OSD_LEVEL).encode('utf-8'))
|
||||
self._listener.sendLine(u'{} "{!s}" {} {}'.format(self.OSD_QUERY, message, duration, constants.MPLAYER_OSD_LEVEL).encode('utf-8'))
|
||||
|
||||
def setSpeed(self, value):
|
||||
self._setProperty('speed', "{:.2f}".format(value))
|
||||
@ -89,7 +92,7 @@ class MplayerPlayer(BasePlayer):
|
||||
|
||||
def setPosition(self, value):
|
||||
self._position = value
|
||||
self._setProperty('time_pos', "{}".format(value))
|
||||
self._setProperty(self.POSITION_QUERY, "{}".format(value))
|
||||
|
||||
def setPaused(self, value):
|
||||
if self._paused <> value:
|
||||
@ -108,7 +111,7 @@ class MplayerPlayer(BasePlayer):
|
||||
self._getProperty('pause')
|
||||
|
||||
def _getPosition(self):
|
||||
self._getProperty('time_pos')
|
||||
self._getProperty(self.POSITION_QUERY)
|
||||
|
||||
def _quoteArg(self, arg):
|
||||
arg = arg.replace('\\', '\\\\')
|
||||
@ -121,8 +124,7 @@ class MplayerPlayer(BasePlayer):
|
||||
if not match:
|
||||
return
|
||||
name, value = match.group(1).lower(), match.group(2)
|
||||
|
||||
if(name == "time_pos"):
|
||||
if(name == self.POSITION_QUERY):
|
||||
self._position = float(value)
|
||||
self._positionAsk.set()
|
||||
elif(name == "pause"):
|
||||
|
||||
@ -4,26 +4,35 @@ import os
|
||||
|
||||
class MpvPlayer(MplayerPlayer):
|
||||
SLAVE_ARGS = constants.MPV_SLAVE_ARGS
|
||||
|
||||
POSITION_QUERY = 'time-pos'
|
||||
OSD_QUERY = 'show_text'
|
||||
|
||||
def _setProperty(self, property_, value):
|
||||
self._listener.sendLine("no-osd set {} {}".format(property_, value))
|
||||
|
||||
def setPaused(self, value):
|
||||
if self._paused <> value:
|
||||
self._listener.sendLine('cycle pause')
|
||||
|
||||
@staticmethod
|
||||
def run(client, playerPath, filePath, args):
|
||||
return MpvPlayer(client, MpvPlayer.getExpandedPath(playerPath), filePath, args)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def getDefaultPlayerPathsList():
|
||||
l = []
|
||||
for path in constants.MPV_PATHS:
|
||||
p = MpvPlayer.getExpandedPath(path)
|
||||
if p:
|
||||
l.append(p)
|
||||
l.append(p)
|
||||
return l
|
||||
|
||||
|
||||
@staticmethod
|
||||
def isValidPlayerPath(path):
|
||||
if("mpv" in path and MpvPlayer.getExpandedPath(path)):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@staticmethod
|
||||
def getExpandedPath(playerPath):
|
||||
if not os.path.isfile(playerPath):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user