diff --git a/resources/lua/intf/syncplay.lua b/resources/lua/intf/syncplay.lua index f160d95dc..66bac0c6b 100644 --- a/resources/lua/intf/syncplay.lua +++ b/resources/lua/intf/syncplay.lua @@ -5,7 +5,7 @@ Principal author: Etoh Other contributors: DerGenaue, jb Project: http://syncplay.pl/ - Version: 0.2.5 + Version: 0.2.6 Note: * This interface module is intended to be used in conjunction with Syncplay. @@ -38,6 +38,9 @@ You may also need to re-copy the syncplay.lua file when you update VLC. get-interface-version * >> interface-version: [syncplay connector version] + get-vlc-version + * >> vlc-version: [VLC version] + get-duration * >> duration: [] @@ -81,7 +84,8 @@ You may also need to re-copy the syncplay.lua file when you update VLC. --]==========================================================================] -local connectorversion = "0.2.5" +local connectorversion = "0.2.6" +local vlcversion = vlc.misc.version() local durationdelay = 500000 -- Pause for get_duration command etc for increased reliability (uses microseconds) local loopsleepduration = 2500 -- Pause for every event loop (uses microseconds) local quitcheckfrequency = 20 -- Check whether VLC has closed every X loops @@ -473,6 +477,7 @@ function do_command ( command, argument) local response = "" if command == "get-interface-version" then response = "interface-version"..msgseperator..connectorversion..msgterminator + elseif command == "get-vlc-version" then response = "vlc-version"..msgseperator..vlcversion..msgterminator elseif command == "get-duration" then response = "duration"..msgseperator..errormerge(get_duration())..msgterminator elseif command == "get-filepath" then response = "filepath"..msgseperator..errormerge(get_filepath())..msgterminator elseif command == "get-filename" then response = "filename"..msgseperator..errormerge(get_filename())..msgterminator @@ -523,7 +528,7 @@ function set_playstate(argument) return errormsg end -if string.sub(vlc.misc.version(),1,2) == "1." then +if string.sub(vlcversion,1,2) == "1." then vlc.msg.err("This version of VLC is not known to support the Syncplay interface module. Please use VLC 2+.") quit_vlc() else diff --git a/syncplay/__init__.py b/syncplay/__init__.py index b2c90aa92..d27e4d8f2 100644 --- a/syncplay/__init__.py +++ b/syncplay/__init__.py @@ -1,4 +1,4 @@ version = '1.3.0' milestone = 'Chami' -release_number = '7' +release_number = '8' projectURL = 'http://syncplay.pl/' diff --git a/syncplay/constants.py b/syncplay/constants.py index dadbba794..54c8d3248 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -62,8 +62,8 @@ COMMANDS_AUTH = ['a','auth'] COMMANDS_TOGGLE = ['t','toggle'] MPC_MIN_VER = "1.6.4" -VLC_MIN_VERSION = "2.0.0" -VLC_INTERFACE_MIN_VERSION = "0.2.5" +VLC_MIN_VERSION = "2.2.1" +VLC_INTERFACE_MIN_VERSION = "0.2.6" VLC_LATENCY_ERROR_THRESHOLD = 2.0 CONTROLLED_ROOMS_MIN_VERSION = "1.3.0" USER_READY_MIN_VERSION = "1.3.0" diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index a0e04933c..87fd7b2c8 100644 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -191,17 +191,11 @@ def lineReceived(self, line): self._filechanged = True self._filename = value.decode('utf-8') self._filenameAsk.set() - elif line.startswith("interface-version: "): - interface_version = line[19:24] - if int(interface_version.replace(".", "")) < int(constants.VLC_INTERFACE_MIN_VERSION.replace(".", "")): - self._client.ui.showErrorMessage(getMessage("vlc-interface-version-mismatch").format(str(interface_version), str(constants.VLC_INTERFACE_MIN_VERSION))) - elif line[:16] == "VLC media player": - vlc_version = line[17:22] - if int(vlc_version.replace(".", "")) < int(constants.VLC_MIN_VERSION.replace(".", "")): + elif line.startswith("vlc-version: "): + vlc_version = line.split(': ')[1].replace(' ','-').split('-')[0] + if not utils.meetsMinVersion(vlc_version, constants.VLC_MIN_VERSION): self._client.ui.showErrorMessage(getMessage("vlc-version-mismatch").format(str(vlc_version), str(constants.VLC_MIN_VERSION))) self._vlcready.set() - self._listener.sendLine("get-interface-version") - @staticmethod def run(client, playerPath, filePath, args): @@ -262,6 +256,7 @@ def drop(self): class __Listener(threading.Thread, asynchat.async_chat): def __init__(self, playerController, playerPath, filePath, args, vlcReady, vlcClosed): self.__playerController = playerController + self.requestedVLCVersion = False call = [playerPath] if filePath: if utils.isASCII(filePath): @@ -277,7 +272,7 @@ def _usevlcintf(vlcIntfPath, vlcIntfUserPath): for line in interfacefile: if "local connectorversion" in line: interface_version = line[26:31] - if int(interface_version.replace(".", "")) >= int(constants.VLC_INTERFACE_MIN_VERSION.replace(".", "")): + if utils.meetsMinVersion(interface_version, constants.VLC_INTERFACE_MIN_VERSION): return True else: playerController._client.ui.showErrorMessage(getMessage("vlc-interface-oldversion-ignored")) @@ -362,6 +357,9 @@ def found_terminator(self): def sendLine(self, line): if self.connected: + if not self.requestedVLCVersion: + self.requestedVLCVersion = True + self.sendLine("get-vlc-version") try: self.push(line + "\n") self.__playerController._client.ui.showDebugMessage("player >> {}".format(line))