Page 1 of 1

Trying to invoke httpd() in an interface script...

Posted: 14 Jun 2013 06:20
by NoMoreNicksLeft
I start VLC with the following command:

Code: Select all

/Applications/VLC.app/Contents/MacOS/VLC -vvv --extraintf=luaintf --lua-intf rest
This seems to find the rest.lua script located in ~/Library/Application\ Support/org.videolan.vlc/lua/intf directory (and boy was it tough figuring out the correct parameters... not to mention that the readme has the wrong directory for lua scripts, claims ~/Library/Preferences).

The lua script itself is currently barebones, has the following content:

Code: Select all

require "common" vlc.msg.info("Lua REST interface") h = vlc.httpd("*", 32009) a = h:handler("/test",nil,nil,test_f,nil)
Please note that I've only ever tried with non-privileged ports (1025 and above). I've tried various IP addresses, in addition to the * star. The output I get from Terminal.app always looks like this:

Code: Select all

[0x100280530] [rest] main interface debug: net: listening to * port 8080 [0x100280530] [rest] lua interface error: Error loading script /Users/john/Library/Application Support/org.videolan.vlc/lua/intf/rest.lua: ...plication Support/org.videolan.vlc/lua/intf/rest.lua:53: bad argument #4 to 'handler' (acl expected, got function)
Notice how it tries port 8080... I'm not sure if that's relevant, or only happens because my code is throwing other errors.

Can anyone help me get to a point where I have it serving up simple webpages (eventually I want it to serve JSON data) ?

Re: Trying to invoke httpd() in an interface script...

Posted: 14 Jun 2013 14:48
by mederi
Thank you for showing me how to start a custom interface script (\lua\intf\test - interface script.lua) from the CLI (Windows):

Code: Select all

vlc.exe --extraintf=luaintf --lua-intf="test - interface script"
Don't you know how to set a custom intf script in VLC preferences so that it starts automatically without the CLI? Is it possible?
Tools > Preferences > ( Show settings = All ) > Interface \ Main interfaces?

Re: Trying to invoke httpd() in an interface script...

Posted: 14 Jun 2013 14:54
by NoMoreNicksLeft
I've *never* been able to get an interface to start from the preferences dialog. The dialog makes it seem like it should be possible (and it needs to be, there's no way to set it to do so automatically in OS X where a new version won't blow it away), but it never works no matter what I try.