From d49a340088b5c9eeaa476156ac6d5a003adf60f3 Mon Sep 17 00:00:00 2001 From: Etoh Date: Tue, 11 Jun 2013 15:01:25 +0200 Subject: [PATCH] Add load-file command to VLC LUA script, verup to 0.0.8 --- resources/syncplay.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/resources/syncplay.lua b/resources/syncplay.lua index 9a5902a..5cf98d7 100644 --- a/resources/syncplay.lua +++ b/resources/syncplay.lua @@ -4,7 +4,7 @@ Author: Etoh Project: http://syncplay.pl/ - Version: 0.0.7 + Version: 0.0.8 --[==========================================================================[ @@ -58,6 +58,9 @@ Note: You may have to copy the VLC 'modules' folder to make it a sub-directory o display-osd: [placement on screen
], [duration in seconds], [message] ? >> display-osd-error: no-input + load-file: [filepath] + * >> load-file-attempted + close-vlc [Unknown command] @@ -289,6 +292,7 @@ end function display_osd ( argument ) -- [Used by display-osd command] + local errormsg local osdarray local input = vlc.object.input() @@ -303,6 +307,13 @@ function display_osd ( argument ) return errormsg end +function load_file (filepath) + -- [Used by load-file command] + + local uri = vlc.strings.make_uri(filepath) + vlc.playlist.add({{path=uri}}) + return "load-file-attempted" +end function do_command ( command, argument) -- Processes all commands sent by Syncplay (see protocol, above). @@ -323,6 +334,7 @@ function do_command ( command, argument) elseif command == "set-playstate" then errormsg = set_playstate(argument) elseif command == "set-rate" then errormsg = set_var("rate", tonumber(argument)) elseif command == "display-osd" then errormsg = display_osd(argument) + elseif command == "load-file" then response = load_file(argument) elseif command == "close-vlc" then vlc.misc.quit() else errormsg = unknowncommand end