From ccd7c110282a91c83be0e406574e816c15efc836 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Wed, 12 Sep 2012 15:37:32 +0300 Subject: [PATCH] media/arte.lua: Rewrite for can_parse_url --- share/media/arte.lua | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/share/media/arte.lua b/share/media/arte.lua index f61fe4f..9138a04 100644 --- a/share/media/arte.lua +++ b/share/media/arte.lua @@ -25,12 +25,10 @@ local Arte = {} -- Utility functions unique to to this script. -- Identify the media script. function ident(qargs) - local A = require 'quvi/accepts' - local r = { - accepts = A.accepts(qargs.input_url, - {"videos%.arte%.tv"}, {"/%w+/videos/"}) + return { + can_parse_url = Arte.can_parse_url(qargs), + domains = table.concat({'videos.arte.tv'}, ',') } - return r end -- Parse media properties. @@ -57,6 +55,19 @@ end -- Utility functions -- +function Arte.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('^videos%.arte%.tv$') + and t.path and t.path:lower():match('^/%w+/videos/') + then + return true + else + return false + end +end + function Arte.get_config(qargs, L, P) -- Collect all config data for all available (language) streams. -- 2.11.4.GIT