4 Copyright (c) 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/.*%?pid=.*" )
31 then -- This is the HTML page's URL
32 local _,_,pid = string.find( vlc.path, "pid(%d-)%-" )
33 local id, name, description, arturl
35 -- Try to find the video's title
36 local line = vlc.readline()
37 if not line then break end
38 -- vlc.msg.dbg( line )
39 if string.match( line, "aVideos" ) then
40 if string.match( line, "CONTENT_ID.*=" ) then
41 _,_,id = string.find( line, "\"(.-)\"" )
42 elseif string.match( line, "CONTENT_VNC_TITRE" ) then
43 _,_,arturl = string.find( line, "src=\"(.-)\"" )
44 _,_,name = string.find( line, "title=\"(.-)\"" )
45 elseif string.match( line, "CONTENT_VNC_DESCRIPTION" ) then
46 _,_,description = string.find( line, "\"(.-)\"" )
48 if id and string.match( line, "new Array" ) then
49 add_item( p, id, name, description, arturl )
58 add_item( p, id, name, description, arturl )
61 elseif string.match( vlc.path, "embed%-video%-player" ) then
63 local line = vlc.readline()
64 if not line then break end
66 if string.match( line, "<hi" ) then
67 local _,_,path = string.find( line, "%[(http.-)%]" )
68 return { { path = path } }
74 function get_url_param( url, name )
75 local _,_,ret = string.find( url, "[&?]"..name.."=([^&]*)" )
79 function add_item( p, id, name, description, arturl )
80 --[[vlc.msg.dbg( "id: " .. tostring(id) )
81 vlc.msg.dbg( "name: " .. tostring(name) )
82 vlc.msg.dbg( "arturl: " .. tostring(arturl) )
83 vlc.msg.dbg( "description: " .. tostring(description) )
85 --local path = "http://www.canalplus.fr/flash/xml/configuration/configuration-embed-video-player.php?xmlParam="..id.."-"..get_url_param(vlc.path,"pid")
86 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")
87 table.insert( p, { path = path; name = name; description = description; arturl = arturl } )