mux: mp4: fix recording of rtsp
[vlc.git] / share / lua / playlist / metacafe.lua
blob63415a74b4e13ff57a82550640a2ff12460232ce
1 --[[
2 $Id$
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.
19 --]]
21 -- Probe function.
22 function probe()
23 local path = vlc.path:gsub("^www%.", "")
24 return vlc.access == "http"
25 and string.match( vlc.path, "^metacafe%.com/" )
26 and ( string.match( vlc.path, "watch/" )
27 or string.match( vlc.path, "mediaURL=" ) )
28 end
30 -- Parse function.
31 function parse()
32 vlc.msg.warn("FIXME")
33 if string.match( vlc.path, "watch/" )
34 then -- This is the HTML page's URL
35 while true do
36 -- Try to find the video's title
37 line = vlc.readline()
38 if not line then break end
39 if string.match( line, "<meta name=\"title\"" ) then
40 _,_,name = string.find( line, "content=\"Metacafe %- (.-)\"" )
41 end
42 if string.match( line, "<meta name=\"description\"" ) then
43 _,_,description = string.find( line, "content=\"(.-)\"" )
44 end
45 if string.match( line, "<link rel=\"image_src\"" ) then
46 _,_,arturl = string.find( line, "href=\"(.-)\"" )
47 end
48 if name and description and arturl then break end
49 end
50 return { { path = string.gsub( vlc.path, "^.*watch/(.*[^/])/?$", "http://www.metacafe.com/fplayer/%1.swf" ); name = name; description = description; arturl = arturl; } }
51 else -- This is the flash player's URL
52 local _,_,path = string.find( vlc.path, "mediaURL=([^&]*)" )
53 return { { path = path } }
54 end
55 end