Skip to content

Commit

Permalink
Check for VLC 2.2.1 (to avoid seek errors), upver to 1.3.0 Beta 3d
Browse files Browse the repository at this point in the history
  • Loading branch information
Et0h committed Apr 21, 2015
1 parent 2b1c243 commit c3025d9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
11 changes: 8 additions & 3 deletions resources/lua/intf/syncplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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: [<duration/no-input>]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion syncplay/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = '1.3.0'
milestone = 'Chami'
release_number = '7'
release_number = '8'
projectURL = 'http://syncplay.pl/'
4 changes: 2 additions & 2 deletions syncplay/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 8 additions & 10 deletions syncplay/players/vlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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"))
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit c3025d9

Please sign in to comment.