Commit 8a16cc00 authored by Antoine Cellerier's avatar Antoine Cellerier

Update lua playlist scripts to new API. (untested)

parent 32601584
...@@ -37,9 +37,9 @@ function parse() ...@@ -37,9 +37,9 @@ function parse()
or string.match( line, "http://images.apple.com/movies/.*%.mov" ) or string.match( line, "http://images.apple.com/movies/.*%.mov" )
then then
if string.match( line, "http://movies.apple.com/movies/.*%.mov" ) then if string.match( line, "http://movies.apple.com/movies/.*%.mov" ) then
path = vlc.decode_uri( string.gsub( line, "^.*(http://movies.apple.com/movies/.*%.mov).*$", "%1" ) ) path = vlc.strings.decode_uri( string.gsub( line, "^.*(http://movies.apple.com/movies/.*%.mov).*$", "%1" ) )
elseif string.match( line, "http://images.apple.com/movies/.*%.mov" ) then elseif string.match( line, "http://images.apple.com/movies/.*%.mov" ) then
path = vlc.decode_uri( string.gsub( line, "^.*(http://images.apple.com/movies/.*%.mov).*$", "%1" ) ) path = vlc.strings.decode_uri( string.gsub( line, "^.*(http://images.apple.com/movies/.*%.mov).*$", "%1" ) )
end end
if string.match( path, "480p" ) then if string.match( path, "480p" ) then
extraname = " (480p)" extraname = " (480p)"
...@@ -54,11 +54,11 @@ function parse() ...@@ -54,11 +54,11 @@ function parse()
end end
if string.match( line, "<title>" ) if string.match( line, "<title>" )
then then
title = vlc.decode_uri( string.gsub( line, "^.*<title>([^<]*).*$", "%1" ) ) title = vlc.strings.decode_uri( string.gsub( line, "^.*<title>([^<]*).*$", "%1" ) )
end end
if string.match( line, "<meta name=\"Description\"" ) if string.match( line, "<meta name=\"Description\"" )
then then
description = vlc.resolve_xml_special_chars( string.gsub( line, "^.*name=\"Description\" content=\"([^\"]*)\".*$", "%1" ) ) description = vlc.strings.resolve_xml_special_chars( string.gsub( line, "^.*name=\"Description\" content=\"([^\"]*)\".*$", "%1" ) )
end end
end end
return p return p
......
...@@ -26,7 +26,7 @@ end ...@@ -26,7 +26,7 @@ end
-- Parse function. -- Parse function.
function parse() function parse()
p = {} p = {}
--vlc.msg_dbg( vlc.path ) --vlc.msg.dbg( vlc.path )
if string.match( vlc.path, "www.canalplus.fr/index.php%?pid=" ) if string.match( vlc.path, "www.canalplus.fr/index.php%?pid=" )
then -- This is the HTML page's URL then -- This is the HTML page's URL
local id, name, description, arturl local id, name, description, arturl
...@@ -34,7 +34,7 @@ function parse() ...@@ -34,7 +34,7 @@ function parse()
-- Try to find the video's title -- Try to find the video's title
local line = vlc.readline() local line = vlc.readline()
if not line then break end if not line then break end
-- vlc.msg_dbg( line ) -- vlc.msg.dbg( line )
if string.match( line, "aVideos" ) then if string.match( line, "aVideos" ) then
if string.match( line, "CONTENT_ID.*=" ) then if string.match( line, "CONTENT_ID.*=" ) then
id = string.gsub( line, "^.*\"(.-)\".*$", "%1" ) id = string.gsub( line, "^.*\"(.-)\".*$", "%1" )
...@@ -61,10 +61,10 @@ function parse() ...@@ -61,10 +61,10 @@ function parse()
while true do while true do
local line = vlc.readline() local line = vlc.readline()
if not line then break end if not line then break end
--vlc.msg_dbg( line ) --vlc.msg.dbg( line )
if string.match( line, "<hi>" ) then if string.match( line, "<hi>" ) then
local path = string.gsub( line, "^.*%[(.-)%].*$", "%1" ) local path = string.gsub( line, "^.*%[(.-)%].*$", "%1" )
vlc.msg_err("Path is: " .. tostring( path ) ) vlc.msg.err("Path is: " .. tostring( path ) )
return { { path = path } } return { { path = path } }
end end
end end
...@@ -76,10 +76,10 @@ function get_url_param( url, name ) ...@@ -76,10 +76,10 @@ function get_url_param( url, name )
end end
function add_item( p, id, name, description, arturl ) function add_item( p, id, name, description, arturl )
--[[vlc.msg_dbg( "id: " .. tostring(id) ) --[[vlc.msg.dbg( "id: " .. tostring(id) )
vlc.msg_dbg( "name: " .. tostring(name) ) vlc.msg.dbg( "name: " .. tostring(name) )
vlc.msg_dbg( "arturl: " .. tostring(arturl) ) vlc.msg.dbg( "arturl: " .. tostring(arturl) )
vlc.msg_dbg( "description: " .. tostring(description) ) vlc.msg.dbg( "description: " .. tostring(description) )
--]] --]]
--local path = "http://www.canalplus.fr/flash/xml/configuration/configuration-embed-video-player.php?xmlParam="..id.."-"..get_url_param(vlc.path,"pid") --local path = "http://www.canalplus.fr/flash/xml/configuration/configuration-embed-video-player.php?xmlParam="..id.."-"..get_url_param(vlc.path,"pid")
local path = "http://www.canalplus.fr/flash/xml/module/embed-video-player/embed-video-player.php?video_id="..id.."&pid="..get_url_param(vlc.path,"pid") local path = "http://www.canalplus.fr/flash/xml/module/embed-video-player/embed-video-player.php?video_id="..id.."&pid="..get_url_param(vlc.path,"pid")
......
...@@ -36,8 +36,8 @@ function parse() ...@@ -36,8 +36,8 @@ function parse()
if not line then break end if not line then break end
if string.match( line, "param name=\"flashvars\" value=\".*video=" ) if string.match( line, "param name=\"flashvars\" value=\".*video=" )
then then
arturl = vlc.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*preview=([^&]*).*$", "%1" ) ) arturl = vlc.strings.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*preview=([^&]*).*$", "%1" ) )
videos = vlc.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*video=([^&]*).*$", "%1" ) ) videos = vlc.strings.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*video=([^&]*).*$", "%1" ) )
--[[ we get a list of different streams available, at various codecs --[[ we get a list of different streams available, at various codecs
and resolutions: and resolutions:
/A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264 /A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264
...@@ -62,7 +62,7 @@ function parse() ...@@ -62,7 +62,7 @@ function parse()
local bestcodec local bestcodec
for codec,_ in pairs(available) do for codec,_ in pairs(available) do
if pref[codec] == nil then if pref[codec] == nil then
vlc.msg_warn( "Unknown codec: " .. codec ) vlc.msg.warn( "Unknown codec: " .. codec )
pref[codec] = 42 -- try the 1st unknown codec if other fail pref[codec] = 42 -- try the 1st unknown codec if other fail
end end
if pref[codec] < score then if pref[codec] < score then
...@@ -76,8 +76,8 @@ function parse() ...@@ -76,8 +76,8 @@ function parse()
end end
if string.match( line, "<meta name=\"description\"" ) if string.match( line, "<meta name=\"description\"" )
then then
name = vlc.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ (.*) %w+ %w+ %w+ %w+ Videos\..*$", "%1" ) ) name = vlc.strings.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ (.*) %w+ %w+ %w+ %w+ Videos\..*$", "%1" ) )
description = vlc.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ .* %w+ %w+ %w+ %w+ Videos\. ([^\"]*)\".*$", "%1" ) ) description = vlc.strings.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ .* %w+ %w+ %w+ %w+ Videos\. ([^\"]*)\".*$", "%1" ) )
end end
if path and name and description and arturl then break end if path and name and description and arturl then break end
end end
......
...@@ -46,7 +46,7 @@ function parse() ...@@ -46,7 +46,7 @@ function parse()
if oldtime then if oldtime then
table.insert( p, { path = video; name = name; duration = time - oldtime; options = { ':start-time='..tostring(oldtime); ':stop-time='..tostring(time) } } ) table.insert( p, { path = video; name = name; duration = time - oldtime; options = { ':start-time='..tostring(oldtime); ':stop-time='..tostring(time) } } )
end end
name = vlc.resolve_xml_special_chars( string.gsub( line, "^.*>(.*)<..*$", "%1" ) ) name = vlc.strings.resolve_xml_special_chars( string.gsub( line, "^.*>(.*)<..*$", "%1" ) )
end end
end end
if oldtime then if oldtime then
......
...@@ -37,7 +37,7 @@ function parse() ...@@ -37,7 +37,7 @@ function parse()
if string.match( line, "src=\"/googleplayer.swf" ) then if string.match( line, "src=\"/googleplayer.swf" ) then
url = string.gsub( line, ".*videoUrl=([^&]*).*" ,"%1" ) url = string.gsub( line, ".*videoUrl=([^&]*).*" ,"%1" )
arturl = string.gsub( line, ".*thumbnailUrl=([^\"]*).*", "%1" ) arturl = string.gsub( line, ".*thumbnailUrl=([^\"]*).*", "%1" )
return { { path = vlc.decode_uri(url), title = title, arturl = vlc.decode_uri(arturl) } } return { { path = vlc.strings.decode_uri(url), title = title, arturl = vlc.strings.decode_uri(arturl) } }
end end
end end
end end
...@@ -60,7 +60,7 @@ function parse() ...@@ -60,7 +60,7 @@ function parse()
if c < 16 and c > 3 then key = 61 + mod if c < 16 and c > 3 then key = 61 + mod
elseif c < 96 and c > 67 then key = 189 + mod elseif c < 96 and c > 67 then key = 189 + mod
elseif c < 20 and c > 6 then key = 65 elseif c < 20 and c > 6 then key = 65
else vlc.msg_err("Oops, please report URL to developers") else vlc.msg.err("Oops, please report URL to developers")
end end
i = i + 1 i = i + 1
path = path .. string.char(key - c) path = path .. string.char(key - c)
......
...@@ -25,7 +25,7 @@ end ...@@ -25,7 +25,7 @@ end
function get_arturl( path, video_id ) function get_arturl( path, video_id )
if string.match( vlc.path, "iurl=" ) then if string.match( vlc.path, "iurl=" ) then
return vlc.decode_uri( get_url_param( vlc.path, "iurl" ) ) return vlc.strings.decode_uri( get_url_param( vlc.path, "iurl" ) )
end end
if not arturl then if not arturl then
return "http://img.youtube.com/vi/"..video_id.."/default.jpg" return "http://img.youtube.com/vi/"..video_id.."/default.jpg"
......
...@@ -34,7 +34,7 @@ function parse() ...@@ -34,7 +34,7 @@ function parse()
for _path, _artist, _name in string.gmatch( line, "href=\"(/watch%?v=[^\"]*)\" onclick=\"_hbLink%('([^']*)','Vid[^\']*'%);\">([^<]*)</a><br/>" ) for _path, _artist, _name in string.gmatch( line, "href=\"(/watch%?v=[^\"]*)\" onclick=\"_hbLink%('([^']*)','Vid[^\']*'%);\">([^<]*)</a><br/>" )
do do
path = "http://www.youtube.com" .. _path path = "http://www.youtube.com" .. _path
name = vlc.resolve_xml_special_chars( _name ) name = vlc.strings.resolve_xml_special_chars( _name )
artist = _artist artist = _artist
end end
for _min, _sec in string.gmatch( line, "<span class=\"runtime\">(%d*):(%d*)</span>" ) for _min, _sec in string.gmatch( line, "<span class=\"runtime\">(%d*):(%d*)</span>" )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment