]> git.sesse.net Git - vlc/blob - share/luaplaylist/lelombrik.lua
lua: update lelombrik script
[vlc] / share / luaplaylist / lelombrik.lua
1 -- $Id$
2 -- French humor site: http://lelombrik.net
3
4 -- Probe function.
5 function probe()
6     return vlc.access == "http"
7         and string.match( vlc.path, "lelombrik.net/videos" ) 
8 end
9
10 -- Parse function.
11 function parse()
12     vidtitle = ""
13     while true do
14         line = vlc.readline()
15         if not line then break end
16         if string.match( line, "id=\"nom_fichier\">" ) then
17             vidtitle = string.gsub( line, ".*\"nom_fichier\">([^<]*).*", "%1" )
18         end
19         if string.match( line, "flvplayer.swf" ) then
20             -- fallback: retrieve the title from the url if we didn't find it
21             if vidtitle == "" then
22                 vidtitle = string.gsub( vlc.path, ".*/([^.]*).*", "%1" )
23             end
24             return { { path = string.gsub( line, ".*flashvars=\"&file=([^&]*).*", "%1" ); arturl = string.gsub( line, ".*&image=([^&]*).*", "%1" ); title = vidtitle } }
25         end
26     end
27 end