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

Discuss your Lua playlist, album art and interface scripts.
NoMoreNicksLeft
Blank Cone
Blank Cone
Posts: 21
Joined: 06 Aug 2012 19:39

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

Postby NoMoreNicksLeft » 14 Jun 2013 06:20

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) ?

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

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

Postby mederi » 14 Jun 2013 14:48

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?

NoMoreNicksLeft
Blank Cone
Blank Cone
Posts: 21
Joined: 06 Aug 2012 19:39

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

Postby NoMoreNicksLeft » 14 Jun 2013 14:54

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.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 2 guests