summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2014-01-16 10:14:37 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2014-01-16 10:14:37 +0100
commit2c61c0295635649193e7e97256dcfb251a6a0dd9 (patch)
tree4bf8d9bb5909c780368ccc1ef17dd6eef2ce0478
parentad458f47debcdda8295fa477a1b7c1e20603be4d (diff)
downloaddotfiles-2c61c0295635649193e7e97256dcfb251a6a0dd9.tar.gz
dotfiles-2c61c0295635649193e7e97256dcfb251a6a0dd9.tar.bz2
dotfiles-2c61c0295635649193e7e97256dcfb251a6a0dd9.zip
quvi/zdf: Use xml_get from util.lua (libquvi-scripts 0.4.21)
-rw-r--r--.local/share/libquvi-scripts/lua/website/zdfmediathek.lua20
1 files changed, 6 insertions, 14 deletions
diff --git a/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua b/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua
index d5075ef..0004cba 100644
--- a/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua
+++ b/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua
@@ -117,6 +117,7 @@ function ZDFmediathek.iter_formats(c)
end
function ZDFmediathek.get_config(self)
+ local U = require 'quvi/util'
self.host_id = "zdfmediathek"
self.id = self.page_url:match('/ZDFmediathek/#?/?beitrag/video/(%d+)') or
@@ -128,16 +129,16 @@ function ZDFmediathek.get_config(self)
local c = quvi.fetch(table.concat(xml), {fetch_type='config'})
if not(c:match('<statuscode>ok</statuscode>')) then
- error(table.concat({'error:', xml_get(c, 'statuscode', false), '-',
- xml_get(c, 'debuginfo', false)}, ' '))
+ error(table.concat({'error:', U.xml_get(c, 'statuscode', false), '-',
+ U.xml_get(c, 'debuginfo', false)}, ' '))
end
- self.title = xml_get(c, 'title', false)
+ self.title = U.xml_get(c, 'title', false)
self.thumbnail_url =
c:match('<teaserimage alt=".-" key="946x532">([^<]+)</teaserimage>')
-- Quirks for broken stream descriptors
- if xml_get(c, 'type', false) == "livevideo" then
+ if U.xml_get(c, 'type', false) == "livevideo" then
-- The server returns 403 without ?hdcore
c = c:gsub('manifest%.f4m</url>', 'manifest.f4m?hdcore</url>')
@@ -182,7 +183,7 @@ function ZDFmediathek.rank_type(f)
end
function ZDFmediathek.rank_quality(f)
- local r = {
+ local rank = {
hd = 6, veryhigh_ext = 5, veryhigh = 4, high = 3, med = 2, low = 1
}
return rank[f.quality] and rank[f.quality] or 0
@@ -219,13 +220,4 @@ function ZDFmediathek.to_s(t)
(t.height) and '_' .. t.height ..'p' or '')
end
-
---For very simple XML value extraction.
-function xml_get(d, e, is_cdata)
- local p = is_cdata and '.-%w+%[(.-)%].-' or '(.-)'
- local t = {'<',e,'>', p, '</',e,'>'}
- return d:match(table.concat(t))
- or error(table.concat({'no match: element: ',e}))
-end
-
-- vim: set ts=4 sw=4 tw=72 expandtab: