summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2014-01-16 10:26:33 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2014-01-16 10:37:31 +0100
commit62e2b51f80406736b209c1a4c47773afb3cb447a (patch)
tree3a257c405ccdab8491e3fbf0170cc112f03b5ec1
parent2c61c0295635649193e7e97256dcfb251a6a0dd9 (diff)
downloaddotfiles-62e2b51f80406736b209c1a4c47773afb3cb447a.tar.gz
dotfiles-62e2b51f80406736b209c1a4c47773afb3cb447a.tar.bz2
dotfiles-62e2b51f80406736b209c1a4c47773afb3cb447a.zip
quvi/zdf: Show either height or quality string in format
The quality string is only needed if height is unavailable.
-rw-r--r--.local/share/libquvi-scripts/lua/website/zdfmediathek.lua21
1 files changed, 8 insertions, 13 deletions
diff --git a/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua b/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua
index 0004cba..e82f25b 100644
--- a/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua
+++ b/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua
@@ -73,8 +73,7 @@ function ZDFmediathek.table_add_format(t, fmt)
-- of better quality than "veryhigh" classified http streams.
-- Example: 2256k instead of 1496k
if fmt.quality == "high" and fmt.type == "h264_aac_f4f_http_f4m_http" then
- local new = { type = "h264_aac_mp4_http_na_na",
- container = "mp4", quality = "veryhigh_ext" }
+ local new = { type = "h264_aac_mp4_http_na_na", container = "mp4" }
new.url = ZDFmediathek.http_mp4_from_f4m(fmt.url)
if new.url then
table.insert(t, ZDFmediathek.merge_format(fmt, new))
@@ -158,14 +157,14 @@ end
function ZDFmediathek.http_mp4_from_f4m(f4m_url)
local c = quvi.fetch(f4m_url, {fetch_type='config'})
+ local p = '<media href="(.-)/manifest%.f4m%?hdcore" bitrate="(%d+)"/>'
local max_bitrate = 0
local path = nil
- for p, bitrate in c:gmatch('<media href="(.-)/manifest%.f4m%?hdcore"'..
- ' bitrate="(%d+)"/>') do
+ for _path, bitrate in c:gmatch(p) do
if tonumber(bitrate) > max_bitrate then
max_bitrate = tonumber(bitrate)
- path = p
+ path = _path
end
end
@@ -183,9 +182,7 @@ function ZDFmediathek.rank_type(f)
end
function ZDFmediathek.rank_quality(f)
- local rank = {
- hd = 6, veryhigh_ext = 5, veryhigh = 4, high = 3, med = 2, low = 1
- }
+ local rank = { hd = 5, veryhigh = 4, high = 3, med = 2, low = 1 }
return rank[f.quality] and rank[f.quality] or 0
end
@@ -213,11 +210,9 @@ end
ZDFmediathek.choose_default = ZDFmediathek.choose_best
function ZDFmediathek.to_s(t)
- return string.format("%s%s_%s%s",
- t.container,
- (t.proto ~= "http") and '_' .. t.proto or '',
- t.quality,
- (t.height) and '_' .. t.height ..'p' or '')
+ return table.concat({ t.container,
+ (t.proto ~= "http") and '_' .. t.proto or '',
+ '_', (t.height) and t.height ..'p' or t.quality })
end
-- vim: set ts=4 sw=4 tw=72 expandtab: