Update syncplay to 0.1.5 for VLC 2.1/2.2 Linux support

This commit is contained in:
Etoh 2013-10-04 22:20:32 +01:00
parent da6bd1186d
commit 7024103b38

View File

@ -4,7 +4,7 @@
Author: Etoh Author: Etoh
Project: http://syncplay.pl/ Project: http://syncplay.pl/
Version: 0.1.4 Version: 0.1.5
--[==========================================================================[ --[==========================================================================[
@ -77,7 +77,7 @@ else
require "host" require "host"
end end
local connectorversion = "0.1.3" local connectorversion = "0.1.5"
local durationdelay = 500000 -- Pause for get_duration command for increased reliability local durationdelay = 500000 -- Pause for get_duration command for increased reliability
local port local port
@ -99,6 +99,8 @@ local oldinputstate
local newfilepath local newfilepath
local newinputstate local newinputstate
local running = true
-- Start hosting Syncplay interface. -- Start hosting Syncplay interface.
port = tonumber(config["port"]) port = tonumber(config["port"])
@ -106,9 +108,22 @@ if (port == nil or port < 1) then port = 4123 end
vlc.msg.info("Hosting Syncplay interface on port: "..port) vlc.msg.info("Hosting Syncplay interface on port: "..port)
if string.sub(vlc.misc.version(),1,4) ~= "2.0." then function mightbewindows()
vlc.msg.err("This version of VLC is not known to support version " .. connectorversion .. " of the Syncplay interface module. Please use VLC 2.0.7+ rather than 2.1.* or 2.2.*.") -- Used to detect whether the Operating System might be Windows.
vlc.misc.quit() sysos = os.getenv("OS")
if sysos == nil then
return true
elseif sysos == "" or string.match(sysos:lower(), "windows") then
return true
else
return false
end
end
if mightbewindows() == true and string.sub(vlc.misc.version(),1,4) ~= "2.0." then
vlc.msg.err("This version of VLC is not known to support version " .. connectorversion .. " of the Syncplay interface module on Windows. Please use VLC 2.0.* rather than 2.1.* or 2.2.*.")
quit_vlc()
else else
h = host.host() h = host.host()
end end
@ -335,6 +350,11 @@ function load_file (filepath)
return "load-file-attempted\n" return "load-file-attempted\n"
end end
function quit_vlc()
running = false
vlc.misc.quit()
end
function do_command ( command, argument) function do_command ( command, argument)
-- Processes all commands sent by Syncplay (see protocol, above). -- Processes all commands sent by Syncplay (see protocol, above).
@ -355,7 +375,7 @@ function do_command ( command, argument)
elseif command == "set-rate" then errormsg = set_var("rate", tonumber(argument)) elseif command == "set-rate" then errormsg = set_var("rate", tonumber(argument))
elseif command == "display-osd" then errormsg = display_osd(argument) elseif command == "display-osd" then errormsg = display_osd(argument)
elseif command == "load-file" then response = load_file(argument) elseif command == "load-file" then response = load_file(argument)
elseif command == "close-vlc" then vlc.misc.quit() elseif command == "close-vlc" then quit_vlc()
else errormsg = unknowncommand else errormsg = unknowncommand
end end
@ -395,7 +415,7 @@ function set_playstate(argument)
end end
-- main loop, which alternates between writing and reading -- main loop, which alternates between writing and reading
while not vlc.misc.should_die() do while running do
-- accept new connections and select active clients -- accept new connections and select active clients
local write, read = h:accept_and_select() local write, read = h:accept_and_select()