Proposal for a standard-included playlist script...
Posted: 11 Aug 2012 09:50
This playlist script would be named zzzzzzzz.lua. As I understand it, this would force it to be run last... so if there is a more relevant playlist script, that one would take over and this ignored.
Furthermore, assuming it hits a webpage at all, its probe() would return true. This means it will attempt to parse any webpage VLC is pointed at. In the parse() function, it looks for a single line, a <link> element.
If it finds that <link> element, it should prompt the user with a dialog asking if they want to install the lua script that is implied by the link element's href. If they click yes, it would then install the lua script in the appropriate place.
Three things would have to happen for this to work:
1. The above lua script would be one of the standard files included in the VLC install packages.
2. Playlist scripts would need access to the dialog functionality (only extensions have this now).
3. Playlist scripts would need (limited) filesystem access with which to install the downloaded script. There are security implications there that I don't claim to be an expert on.
Does anyone have an opinion? Does anyone have suggestions on improvements to the idea? Does anyone know who I'd have to talk to just to get this made a standard?
Furthermore, assuming it hits a webpage at all, its probe() would return true. This means it will attempt to parse any webpage VLC is pointed at. In the parse() function, it looks for a single line, a <link> element.
Code: Select all
-- Probe function.
function probe()
if vlc.access ~= "http" and vlc.access ~= "https" then
return false
end
return true
end
-- Parse function.
function parse()
dhead = "\27[1;35mzzzzzzzz.lua debug: "
dtail = "\27[0m"
-- vlc.msg.dbg( dhead .. 'debug message here' .. dtail )
while true do
line = vlc.readline()
if not line then break end
if string.match( line, "<link rel='derp .-' href='" ) then
_,_,where,lua = string.find( line, "rel='derp (.-)' href='(.-)'" )
vlc.msg.dbg( dhead .. 'found a lua playlist script to install: ' .. lua .. dtail )
if string.match( lua, "^/") then
_,_,domain = string.find( vlc.path, "^(.-)/?" )
lua = vlc.access .. '://' .. domain .. lua
elseif not string.match( lua, "^http" ) then
_,_,domainandpath = string.find( vlc.path, "^(.+/)" )
lua = vlc.access .. '://' .. domainandpath .. lua
end
vlc.msg.dbg( dhead .. 'fullpath should be ' .. lua .. dtail )
-- We need to download the "lua" link and place it whereever "where" says.
-- Of course, we should insist on sane values, prompt the user if they want to allow or deny it, etc.
-- But we have no access to the filesystem or to dialog prompts. That sucks. :(
-- Here we need to take and reload vlc.path now that they have a playlist that will presumably parse this page.
--return { { path = vlc.path } }
return nil
end
end
end
Three things would have to happen for this to work:
1. The above lua script would be one of the standard files included in the VLC install packages.
2. Playlist scripts would need access to the dialog functionality (only extensions have this now).
3. Playlist scripts would need (limited) filesystem access with which to install the downloaded script. There are security implications there that I don't claim to be an expert on.
Does anyone have an opinion? Does anyone have suggestions on improvements to the idea? Does anyone know who I'd have to talk to just to get this made a standard?