From 37a2bad7d01c584211e18446f8da64e1f5eacf3b Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Tue, 3 Nov 2009 12:15:36 +0300 Subject: [PATCH] LUA playlist: add support for pinkbike videos. --- share/lua/playlist/pinkbike.lua | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 share/lua/playlist/pinkbike.lua diff --git a/share/lua/playlist/pinkbike.lua b/share/lua/playlist/pinkbike.lua new file mode 100644 index 0000000000..06105d7d87 --- /dev/null +++ b/share/lua/playlist/pinkbike.lua @@ -0,0 +1,58 @@ +--[[ + $Id$ + + Copyright © 2009 the VideoLAN team + + Authors: Konstantin Pavlov (thresh@videolan.org) + + 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, "pinkbike.com/video/%d+" ) +end + +-- Parse function. +function parse() + p = {} + + if string.match ( vlc.path, "pinkbike.com/video/%d+" ) then + while true do + line = vlc.readline() + if not line then break end + -- Try to find video id + if string.match( line, "video_src.+swf.id=(.*)\"") then + _,_,videoid = string.find( line, "video_src.+swf.id=(.*)\"") + catalog = math.floor( tonumber( videoid ) / 10000 ) + end + -- Try to find the video's title + if string.match( line, "(.*)" ) then + _,_,name = string.find (line, "(.*)") + end + -- Try to find server which has our video + if string.match( line, "