From 07e6e2376496b131cb4b1183212e7638a10780b2 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Wed, 12 Sep 2012 15:38:09 +0300 Subject: [PATCH] media/gaskrank.lua: Rewrite for can_parse_url --- share/media/gaskrank.lua | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/share/media/gaskrank.lua b/share/media/gaskrank.lua index a68e2fb..10bc62f 100644 --- a/share/media/gaskrank.lua +++ b/share/media/gaskrank.lua @@ -23,11 +23,10 @@ local Gaskrank = {} -- Utility functions unique to this script -- Identify the media script. function ident(qargs) - local A = require 'quvi/accepts' - local r = { - accepts = A.accepts(qargs.input_url, {"gaskrank%.tv"}, {"/tv/"}) + return { + can_parse_url = Gaskrank.can_parse_url(qargs), + domains = table.concat({'gaskrank.tv'}, ',') } - return r end -- Parse media properties. @@ -49,6 +48,19 @@ end -- Utility functions. -- +function Gaskrank.can_parse_url(qargs) + local U = require 'quvi/url' + local t = U.parse(qargs.input_url) + if t and t.scheme and t.scheme:lower():match('^http$') + and t.host and t.host:lower():match('gaskrank%.tv$') + and t.path and t.path:lower():match('^/tv/') + then + return true + else + return false + end +end + function Gaskrank.iter_streams(p) local u = p:match("(http://movies.-%.flv)") or error("no match: media stream URL") -- 2.11.4.GIT