[dreisat] Use centralized format sorting
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 24 Dec 2013 11:35:02 +0000 (12:35 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 24 Dec 2013 11:35:08 +0000 (12:35 +0100)
youtube_dl/extractor/dreisat.py

index cb7226f82a6af167569286918a56cce64e796150..f141c850d61dac0baf2b1bb1bf9fd66925ca9b3b 100644 (file)
@@ -52,18 +52,12 @@ class DreiSatIE(InfoExtractor):
             'width': int(fe.find('./width').text),
             'height': int(fe.find('./height').text),
             'url': fe.find('./url').text,
-            'ext': determine_ext(fe.find('./url').text),
             'filesize': int(fe.find('./filesize').text),
             'video_bitrate': int(fe.find('./videoBitrate').text),
-            '3sat_qualityname': fe.find('./quality').text,
         } for fe in format_els
             if not fe.find('./url').text.startswith('http://www.metafilegenerator.de/')]
 
-        def _sortkey(format):
-            qidx = ['low', 'med', 'high', 'veryhigh'].index(format['3sat_qualityname'])
-            prefer_http = 1 if 'rtmp' in format['url'] else 0
-            return (qidx, prefer_http, format['video_bitrate'])
-        formats.sort(key=_sortkey)
+        self._sort_formats(formats)
 
         return {
             '_type': 'video',