From 7213e06f6fec1c0132b6381b6c2b3b027b48f110 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Fri, 8 Feb 2013 18:13:15 +0200 Subject: [PATCH] ard.lua: Add Ard.container_from function --- share/lua/website/ard.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/share/lua/website/ard.lua b/share/lua/website/ard.lua index ed307de..cec5d69 100644 --- a/share/lua/website/ard.lua +++ b/share/lua/website/ard.lua @@ -139,6 +139,11 @@ function Ard.height_from(suffix) if h then return h..'p' end end +function Ard.container_from(suffix) + return suffix:match('^(...):') or suffix:match('%.(...)$') + or suffix:match('%.(...)$') or 'mp4' +end + function Ard.iter_formats(page) local r = {} local s = 'mediaCollection%.addMediaStream' @@ -155,13 +160,12 @@ function Ard.iter_formats(page) if webx then webx = 'web' .. webx:lower() end local t = { - url = u, - container = suffix:match('^(...):') or suffix:match('%.(...)$') - or suffix:match('%.(...)$') or 'mp4', + container = Ard.container_from(suffix), encoding = suffix:match('%.(h264)%.'), quality = Ard.quality_from(suffix), height = Ard.height_from(suffix), - webx = webx + webx = webx, + url = u } table.insert(r,t) end -- 2.11.4.GIT