]> git.sesse.net Git - vlc/blob - share/lua/playlist/lelombrik.lua
82fb47228039d0e9198d5d22f7a0025f2d743239
[vlc] / share / lua / playlist / lelombrik.lua
1 --[[
2  French humor site: http://lelombrik.net
3
4  $Id$
5
6  Copyright © 2007 the VideoLAN team
7
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 --]]
22
23 -- Probe function.
24 function probe()
25     return vlc.access == "http"
26         and string.match( vlc.path, "lelombrik.net/videos" ) 
27 end
28
29 -- Parse function.
30 function parse()
31     vidtitle = ""
32     while true do
33         line = vlc.readline()
34         if not line then break end
35         if string.match( line, "id=\"nom_fichier\">" ) then
36             vidtitle = string.gsub( line, ".*\"nom_fichier\">([^<]*).*", "%1" )
37         end
38         if string.match( line, "flvplayer.swf" ) then
39             -- fallback: retrieve the title from the url if we didn't find it
40             if vidtitle == "" then
41                 vidtitle = string.gsub( vlc.path, ".*/([^.]*).*", "%1" )
42             end
43             return { { path = string.gsub( line, ".*flashvars=\"&file=([^&]*).*", "%1" ); arturl = string.gsub( line, ".*&image=([^&]*).*", "%1" ); title = vidtitle } }
44         end
45     end
46 end