[vlc-devel] [PATCH] luascripts: add pluzz.fr
Francois Cartegnie
fcvlcdev at free.fr
Sat Jul 17 20:20:39 CEST 2010
---
share/lua/playlist/pluzz.lua | 108 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 108 insertions(+), 0 deletions(-)
create mode 100644 share/lua/playlist/pluzz.lua
diff --git a/share/lua/playlist/pluzz.lua b/share/lua/playlist/pluzz.lua
new file mode 100644
index 0000000..9bdcef4
--- /dev/null
+++ b/share/lua/playlist/pluzz.lua
@@ -0,0 +1,108 @@
+--[[
+ Extracts video URL from Pluzz.fr video pages.
+
+ $Id$
+
+ Copyright © 2008 the VideoLAN team
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+--]]
+
+-- Probe function.
+function probe()
+ return vlc.access == "http"
+ and (
+ string.match( vlc.path, "www.pluzz.fr" )
+ or
+ string.match( vlc.path, "info.francetelevisions.fr" )
+ )
+end
+
+-- Parse function.
+function parse()
+
+-- the video's html page
+ if string.match( vlc.path, "www.pluzz.fr" ) then
+ while true
+ do
+ line = vlc.readline()
+ if not line then break end
+
+ if string.match( line, " id=\"current_video\" " )
+ then
+ _,_,path = string.find( line, " href=\"(.-)\" " )
+ if path then
+ vlc.msg.dbg( "redirecting to resource " .. path )
+ return { { path = "http://" .. path } }
+ else
+ vlc.msg.warn( "video resource url not found" )
+ return { }
+ end
+ end
+ end
+ end
+
+-- the video's second html resource file
+ if string.match( vlc.path, "info.francetelevisions.fr" ) then
+ while true
+ do
+ line = vlc.readline()
+ if not line then break end
+
+ if string.match( line, " name=\"urls%-url%-video\" " )
+ then
+ _,_,path = string.find( line, " content=\"(.-)\"" )
+ if path then
+ path = string.gsub(path, "geoloc/", "")
+ path = "mms://videozones.francetv.fr/" .. path
+ vlc.msg.dbg( "video url found " .. path )
+ else
+ vlc.msg.warn( "video url not found" )
+ return { }
+ end
+ end
+
+ if string.match( line, " name=\"vignette%-titre%-court\" " )
+ then
+ _,_,name = string.find( line, " content=\"(.-)\"" )
+ name = vlc.strings.resolve_xml_special_chars( name )
+ end
+
+ if string.match( line, " name=\"description\" " )
+ then
+ _,_,description = string.find( line, " content=\"(.-)\"" )
+ description = vlc.strings.resolve_xml_special_chars( description )
+ end
+
+ if string.match( line, " name=\"vignette\" " )
+ then
+ _,_,arturl = string.find( line, " content=\"(.-)\"" )
+ if arturl then
+ arturl = "http://info.francetelevisions.fr" .. arturl
+ end
+ end
+
+ if string.match( line, " name=\"vignette%-duree\" " )
+ then
+ _,_,duration = string.find( line, " content=\"(.-)\"" )
+ end
+ end
+
+ return { { path = path; name = name; arturl = arturl; duration = duration; description = description } }
+ end
+
+ vlc.msg.warn( "video resource parsing failed" )
+ return { }
+end
--
1.6.4.4
More information about the vlc-devel
mailing list