Proper version checking for MPlayer.
This commit is contained in:
parent
4ca88ddd02
commit
f86f55a300
@ -273,6 +273,8 @@ class SyncplayClient(object):
|
|||||||
return self._globalPaused
|
return self._globalPaused
|
||||||
|
|
||||||
def updateFile(self, filename, duration, path):
|
def updateFile(self, filename, duration, path):
|
||||||
|
if not path:
|
||||||
|
return
|
||||||
size = os.path.getsize(path)
|
size = os.path.getsize(path)
|
||||||
self.userlist.currentUser.setFile(filename, duration, size)
|
self.userlist.currentUser.setFile(filename, duration, size)
|
||||||
self.sendFile()
|
self.sendFile()
|
||||||
@ -584,3 +586,4 @@ class UiManager(object):
|
|||||||
def promptFor(self, prompt):
|
def promptFor(self, prompt):
|
||||||
return self.__ui.promptFor(prompt)
|
return self.__ui.promptFor(prompt)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ VLC_OPEN_MAX_WAIT_TIME = 10
|
|||||||
VLC_SOCKET_OPEN_WAIT_TIME = 0.5
|
VLC_SOCKET_OPEN_WAIT_TIME = 0.5
|
||||||
|
|
||||||
#These are not changes you're looking for
|
#These are not changes you're looking for
|
||||||
MPLAYER_SLAVE_ARGS = [ '-slave', '-nomsgcolor', '-msglevel', 'all=1:global=4']
|
MPLAYER_SLAVE_ARGS = [ '-slave', '-nomsgcolor', '-msglevel', 'all=1:global=4:cplayer=4']
|
||||||
MPV_SLAVE_ARGS = [ '--slave-broken', '-msglevel', 'all=1:global=4']
|
MPV_SLAVE_ARGS = [ '--slave-broken', '-msglevel', 'all=1:global=4']
|
||||||
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_]+)=(.+)$"
|
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_]+)=(.+)$"
|
||||||
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
|
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
|
||||||
|
|||||||
@ -37,6 +37,7 @@ en = {
|
|||||||
|
|
||||||
"mplayer-file-required-notification" : "Syncplay using mplayer requires you to provide file when starting",
|
"mplayer-file-required-notification" : "Syncplay using mplayer requires you to provide file when starting",
|
||||||
"mplayer-file-required-notification/example" : "Usage example: syncplay [options] [url|path/]filename",
|
"mplayer-file-required-notification/example" : "Usage example: syncplay [options] [url|path/]filename",
|
||||||
|
"mplayer2-required" : "Syncplay is incompatible with MPlayer 1.x, please use mplayer2",
|
||||||
|
|
||||||
"unrecognized-command-notification" : "Unrecognized command",
|
"unrecognized-command-notification" : "Unrecognized command",
|
||||||
"commandlist-notification" : "Available commands:",
|
"commandlist-notification" : "Available commands:",
|
||||||
|
|||||||
@ -154,22 +154,28 @@ class MplayerPlayer(BasePlayer):
|
|||||||
if os.access(path, os.X_OK):
|
if os.access(path, os.X_OK):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def drop(self):
|
def notMplayer2(self):
|
||||||
|
print getMessage("en", "mplayer2-required")
|
||||||
self._listener.sendLine('quit')
|
self._listener.sendLine('quit')
|
||||||
|
self._client.stop(True)
|
||||||
|
|
||||||
|
def _takeLocksDown(self):
|
||||||
self._durationAsk.set()
|
self._durationAsk.set()
|
||||||
self._filenameAsk.set()
|
self._filenameAsk.set()
|
||||||
self._pathAsk.set()
|
self._pathAsk.set()
|
||||||
self._positionAsk.set()
|
self._positionAsk.set()
|
||||||
self._pausedAsk.set()
|
self._pausedAsk.set()
|
||||||
|
|
||||||
|
def drop(self):
|
||||||
|
self._listener.sendLine('quit')
|
||||||
|
self._takeLocksDown()
|
||||||
self._client.stop(False)
|
self._client.stop(False)
|
||||||
for line in self._listener.readStderrLine():
|
|
||||||
self._client.ui.showMessage(line, True, True)
|
|
||||||
|
|
||||||
class __Listener(threading.Thread):
|
class __Listener(threading.Thread):
|
||||||
def __init__(self, playerController, playerPath, filePath, args):
|
def __init__(self, playerController, playerPath, filePath, args):
|
||||||
self.__playerController = playerController
|
self.__playerController = playerController
|
||||||
if(not filePath):
|
if(not filePath):
|
||||||
raise ValueError
|
raise ValueError()
|
||||||
call = [playerPath, filePath]
|
call = [playerPath, filePath]
|
||||||
call.extend(playerController.SLAVE_ARGS)
|
call.extend(playerController.SLAVE_ARGS)
|
||||||
if(args):
|
if(args):
|
||||||
@ -178,6 +184,9 @@ class MplayerPlayer(BasePlayer):
|
|||||||
threading.Thread.__init__(self, name="MPlayer Listener")
|
threading.Thread.__init__(self, name="MPlayer Listener")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
line = self.__process.stdout.readline()
|
||||||
|
if("MPlayer2" not in line):
|
||||||
|
self.__playerController.notMplayer2()
|
||||||
while(self.__process.poll() is None):
|
while(self.__process.poll() is None):
|
||||||
line = self.__process.stdout.readline()
|
line = self.__process.stdout.readline()
|
||||||
line = line.rstrip("\r\n")
|
line = line.rstrip("\r\n")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user