4 Copyright © 2007 the VideoLAN team
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 return vlc.access == "http" and string.match( vlc.path, "www.canalplus.fr" )
29 --vlc.msg_dbg( vlc.path )
30 if string.match( vlc.path, "www.canalplus.fr/index.php%?pid=" )
31 then -- This is the HTML page's URL
32 local id, name, description, arturl
34 -- Try to find the video's title
35 local line = vlc.readline()
36 if not line then break end
37 -- vlc.msg_dbg( line )
38 if string.match( line, "aVideos" ) then
39 if string.match( line, "CONTENT_ID.*=" ) then
40 id = string.gsub( line, "^.*\"(.-)\".*$", "%1" )
41 elseif string.match( line, "CONTENT_VNC_TITRE" ) then
42 arturl = string.gsub( line, "^.*src=\"(.-)\".*$", "%1" )
43 name = string.gsub( line, "^.*alt=\"(.-)\".*$", "%1" )
44 elseif string.match( line, "CONTENT_VNC_DESCRIPTION" ) then
45 description = string.gsub( line, "^.*\"(.-)\".*$", "%1" )
47 if id and string.match( line, "new Array" ) then
48 add_item( p, id, name, description, arturl )
57 add_item( p, id, name, description, arturl )
60 elseif string.match( vlc.path, "embed%-video%-player" ) then
62 local line = vlc.readline()
63 if not line then break end
65 if string.match( line, "<hi>" ) then
66 local path = string.gsub( line, "^.*%[(.-)%].*$", "%1" )
67 vlc.msg_err("Path is: " .. tostring( path ) )
68 return { { path = path } }
74 function get_url_param( url, name )
75 return string.gsub( url, "^.*[&?]"..name.."=([^&]*).*$", "%1" )
78 function add_item( p, id, name, description, arturl )
79 --[[vlc.msg_dbg( "id: " .. tostring(id) )
80 vlc.msg_dbg( "name: " .. tostring(name) )
81 vlc.msg_dbg( "arturl: " .. tostring(arturl) )
82 vlc.msg_dbg( "description: " .. tostring(description) )
84 --local path = "http://www.canalplus.fr/flash/xml/configuration/configuration-embed-video-player.php?xmlParam="..id.."-"..get_url_param(vlc.path,"pid")
85 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")
86 table.insert( p, { path = path; name = name; description = description; arturl = arturl } )