aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/zdf.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-24 23:32:04 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-24 23:32:04 +0100
commitc7deaa4c745382634ac5a910cc68efa4211f7456 (patch)
treeab8a8a843b52ee5ace303150759fc035ecb1f89a /youtube_dl/extractor/zdf.py
parente6812ac99dfc9117f3dd78425bf4bbe01601ecfd (diff)
downloadyoutube-dl-c7deaa4c745382634ac5a910cc68efa4211f7456.zip
youtube-dl-c7deaa4c745382634ac5a910cc68efa4211f7456.tar.gz
youtube-dl-c7deaa4c745382634ac5a910cc68efa4211f7456.tar.bz2
[zdf] Use centralized sorting
Diffstat (limited to 'youtube_dl/extractor/zdf.py')
-rw-r--r--youtube_dl/extractor/zdf.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/youtube_dl/extractor/zdf.py b/youtube_dl/extractor/zdf.py
index 35ece35..94594c5 100644
--- a/youtube_dl/extractor/zdf.py
+++ b/youtube_dl/extractor/zdf.py
@@ -67,29 +67,13 @@ class ZDFIE(InfoExtractor):
''', format_id)
ext = format_m.group('container')
- is_supported = ext != 'f4f'
-
- PROTO_ORDER = ['http', 'rtmp', 'rtsp']
- try:
- proto_pref = -PROTO_ORDER.index(format_m.group('proto'))
- except ValueError:
- proto_pref = -999
+ proto = format_m.group('proto')
quality = fnode.find('./quality').text
- QUALITY_ORDER = ['veryhigh', '300', 'high', 'med', 'low']
- try:
- quality_pref = -QUALITY_ORDER.index(quality)
- except ValueError:
- quality_pref = -999
-
abr = int(fnode.find('./audioBitrate').text) // 1000
vbr = int(fnode.find('./videoBitrate').text) // 1000
- pref = (is_available, is_supported,
- proto_pref, quality_pref, vbr, abr)
format_note = u''
- if not is_supported:
- format_note += u'(unsupported)'
if not format_note:
format_note = None
@@ -105,14 +89,16 @@ class ZDFIE(InfoExtractor):
'height': int(fnode.find('./height').text),
'filesize': int(fnode.find('./filesize').text),
'format_note': format_note,
- '_pref': pref,
+ 'protocol': format_m.group('proto').lower(),
'_available': is_available,
}
format_nodes = doc.findall('.//formitaeten/formitaet')
- formats = sorted(filter(lambda f: f['_available'],
- map(xml_to_format, format_nodes)),
- key=operator.itemgetter('_pref'))
+ formats = list(filter(
+ lambda f: f['_available'],
+ map(xml_to_format, format_nodes)))
+
+ self._sort_formats(formats)
return {
'id': video_id,