From c38aa05f25e1ba2851b9663be2dc094f7a325348 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Sat, 4 Aug 2012 09:17:27 +0300 Subject: [PATCH] Add website/lego.lua (#107) Adds support for city.lego.com . ref: http://sourceforge.net/apps/trac/quvi/ticket/107 --- share/Makefile.am | 1 + share/lua/website/lego.lua | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 share/lua/website/lego.lua diff --git a/share/Makefile.am b/share/Makefile.am index 7030977..e45ba18 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -32,6 +32,7 @@ DIST_lua=\ lua/website/guardian.lua \ lua/website/imdb.lua \ lua/website/justintv.lua \ + lua/website/lego.lua \ lua/website/liveleak.lua \ lua/website/mgnetwork.lua \ lua/website/metacafe.lua \ diff --git a/share/lua/website/lego.lua b/share/lua/website/lego.lua new file mode 100644 index 0000000..5c2fe43 --- /dev/null +++ b/share/lua/website/lego.lua @@ -0,0 +1,60 @@ + +-- libquvi-scripts +-- Copyright (C) 2012 Ross Burton +-- +-- This file is part of libquvi-scripts . +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library 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 +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +-- 02110-1301 USA +-- + +-- Identify the script. +function ident(self) + package.path = self.script_dir .. '/?.lua' + local C = require 'quvi/const' + local r = {} + r.domain = "city%.lego%.com" + r.formats = "default" + r.categories = C.proto_http + local U = require 'quvi/util' + r.handles = U.handles(self.page_url, {r.domain}, {"/.+/Movies/.+$"}) + return r +end + +-- Query available formats. +function query_formats(self) + self.formats = "default" + return self +end + +-- Parse video URL. +function parse(self) + self.host_id = "lego" + local p = quvi.fetch(self.page_url) + + local s = p:match('(.+)') + or error("no match: tracking name") + local index = s:find("-") + + self.title = s:sub(0, index-1) + self.id = s:sub(index+1) + + -- TODO self.thumbnail_url + + self.url = {p:match('(.+)') + or error("no match: media stream URL")} + + return self +end -- 2.11.4.GIT