4 Copyright © 2011 the VideoLAN team
6 Authors: Konstantin Pavlov (thresh@videolan.org)
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.
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.
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.
23 function get_prefres()
25 if vlc.var and vlc.var.inherit then
26 prefres = vlc.var.inherit(nil, "preferred-resolution")
27 if prefres == nil then
36 return vlc.access == "http"
37 and string.match( vlc.path, "zapiks.fr/(.*).html" )
38 or string.match( vlc.path, "zapiks.fr/view/." )
39 or string.match( vlc.path, "26in.fr/videos/." )
44 if string.match ( vlc.path, "zapiks.fr/(.+).html" ) or string.match( vlc.path, "26in.fr/videos/" ) then
47 if not line then break end
48 -- Try to find video id number
49 if string.match( line, "video_src(.+)file=(%d+)\"" ) then
50 _,_,id = string.find( line, "file=(%d+)")
53 if string.match( line, "(.*)</title>" ) then
54 _,_,name = string.find( line, "(.*)</title>" )
57 return { { path = "http://www.zapiks.fr/view/index.php?file=" .. id, name = name } }
60 if string.match ( vlc.path, "zapiks.fr/view/." ) then
61 prefres = get_prefres()
64 if not line then break end
65 -- Try to find URL of video
66 if string.match( line, "<file>(.*)</file>" ) then
67 _,_,path = string.find ( line, "<file>(.*)</file>" )
69 -- Try to find image for arturl
70 if string.match( line, "<image>(.*)</image>" ) then
71 _,_,arturl = string.find( line, "<image>(.*)</image>" )
73 if string.match( line, "title=\"(.*)\"" ) then
74 _,_,name = string.find( line, "title=\"(.*)\"" )
76 -- Try to find whether video is HD actually
77 if( prefres <0 or prefres >= 720 ) then
78 if string.match( line, "<hd.file>(.*)</hd.file>" ) then
79 _,_,path = string.find( line, "<hd.file>(.*)</hd.file>" )
83 return { { path = path; name = name; arturl = arturl } }
85 vlc.msg.err( "Could not extract the video URL from zapiks.fr" )