From: Toni Gundogdu Date: Fri, 8 Feb 2013 16:13:15 +0000 (+0200) Subject: ard.lua: Add Ard.container_from function X-Git-Tag: v0.4.12~10^2~2 X-Git-Url: https://repo.or.cz/w/libquvi-scripts.git/commitdiff_plain/7213e06f6fec1c0132b6381b6c2b3b027b48f110 ard.lua: Add Ard.container_from function --- 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