[vlc-devel] [PATCH] Lua playlist script to handle www.ted.com URLs

Gregor Wegberg gregor at wegberg.ch
Mon Jan 17 22:52:22 CET 2011


On Mon, Jan 17, 2011 at 10:11 PM, Jean-Baptiste Kempf <jb at videolan.org> wrote:
> On Mon, Jan 17, 2011 at 09:09:13PM +0100, Gregor Wegberg wrote :
>> Would be really great if someone could  check this and push it...
>
> I haven't seen the original patch.

Ok that's new. I sent it CC to myself and it worked. Here it is:

---
 share/lua/playlist/ted.lua |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 share/lua/playlist/ted.lua

diff --git a/share/lua/playlist/ted.lua b/share/lua/playlist/ted.lua
new file mode 100644
index 0000000..67ef7ae
--- /dev/null
+++ b/share/lua/playlist/ted.lua
@@ -0,0 +1,44 @@
+--[[
+ $Id$
+
+ Copyright <a9> 2011 VideoLAN and AUTHORS
+
+ Authors: Gregor Wegberg <gregor at dev-job dot ch>
+
+ 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.
+--]]
+
+
+function probe()
+       -- http://ted.com redirects to http://www.ted.com so I don't
check for the http://ted.com version
+       return vlc.access == "http" and string.match(vlc.path,
"^www.ted.com/talks/")
+end
+
+function parse()
+       filepath = ""
+
+       while true do
+               line = vlc.readline()
+               if not line then break end
+
+               _,_,filepath = string.find(line, '<a href="(.-)">Watch
high%-res video')
+
+               if filepath ~= nil then
+                       return { { path =
"http://www.ted.com"..filepath;options={":demux=avformat,ffmpeg"} } }
+               end
+       end
+
+       return { }
+end
--
1.7.3.4



More information about the vlc-devel mailing list