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, "extreme%.com/." )
38 or string.match( vlc.path, "freecaster%.tv/." )
39 or string.match( vlc.path, "player%.extreme%.com/info/.")
44 if (string.match( vlc.path, "extreme%.com/." ) or string.match( vlc.path, "freecaster%.tv/." )) and not string.match( vlc.path, "player%.extreme%.com/info/") then
47 if not line then break end
48 -- Try to find id of the video
49 if string.match( line, "http://player.extreme.com/FCPlayer.swf" ) then
50 _,_,vid = string.find( line, "id=(.*)\"" )
54 return { { path = "http://player.extreme.com/info/" .. vid; name = "extreme.com video"; } }
57 if string.match( vlc.path, "player%.extreme%.com/info/." ) then
58 prefres = get_prefres()
62 if not line then break end
63 -- Try to find the video's title
64 if string.match( line, "title>(.*)<" ) then
65 _,_,name = string.find( line, "<title>(.*)<" )
68 -- Try to find image for thumbnail
69 if string.match( line, "<path>(*.)</path>" ) then
70 _,_,arturl = string.find( line, "<path>(*.)</path>" )
73 -- Try to find out if its a freecaster streaming or just a link to some
74 -- other video streaming website
75 -- We assume freecaster now streams in http
76 if string.match( line, "<streams type=\"5\" server=\"(.*)\">" )
78 _,_,videoserver = string.find( line, "<streams type=\"5\" server=\"(.*)\">" )
82 -- if we're going outside, we need to find out the path
84 if string.match( line, ">(.*)</stream>" ) then
85 _,_,path = string.find( line, "bitrate=\"0\" duration=\"\">(.*)</stream>" )
89 -- and if we're using freecaster, use appropriate resolution
90 if not gostraight then
91 if string.match( line, "height=\"(.*)\" duration" ) then
92 _,_,height = string.find( line, "height=\"(%d+)\" duration" )
93 _,_,playpath = string.find( line, "\">(.*)</stream>" )
94 if ( prefres < 0 or tonumber( height ) <= prefres ) then
95 path = videoserver .. playpath
101 return { { path = path; name = name; arturl = arturl } }