diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-11-25 03:28:55 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-11-25 03:28:55 +0100 |
commit | c059bdd432911cff8c7426380a876c9679855ab5 (patch) | |
tree | aa8d29a5406f53eb42b786e5c21134bf8f25fc7d | |
parent | 02dbf93f0e98a56ed04b4a9e6a6d62efd6d801f9 (diff) |
Remove quality_name field and improve zdf extractor
-rw-r--r-- | youtube_dl/YoutubeDL.py | 2 | ||||
-rw-r--r-- | youtube_dl/extractor/common.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/zdf.py | 23 |
3 files changed, 17 insertions, 9 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 0578fe6c1..a896d9e63 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -871,8 +871,6 @@ class YoutubeDL(object): res = u'' if fdict.get('format_note') is not None: res += fdict['format_note'] + u' ' - if fdict.get('quality_name') is not None: - res += u'%s ' % fdict['quality_name'] if fdict.get('vcodec') is not None: res += u'%-5s' % fdict['vcodec'] elif fdict.get('vbr') is not None: diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 3c4781121..3d8ac8ba2 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -76,7 +76,6 @@ class InfoExtractor(object): * acodec Name of the audio codec in use * vbr Average video bitrate in KBit/s * vcodec Name of the video codec in use - * quality_name Human-readable name of the video quality. * filesize The number of bytes, if known in advance webpage_url: The url to the video webpage, if given to youtube-dl it should allow to get the same result again. (It will be set diff --git a/youtube_dl/extractor/zdf.py b/youtube_dl/extractor/zdf.py index a8d899883..07f830e80 100644 --- a/youtube_dl/extractor/zdf.py +++ b/youtube_dl/extractor/zdf.py @@ -52,6 +52,9 @@ class ZDFIE(InfoExtractor): (?P<proto>[^_]+)_(?P<index>[^_]+)_(?P<indexproto>[^_]+) ''', 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')) @@ -67,26 +70,34 @@ class ZDFIE(InfoExtractor): abr = int(fnode.find('./audioBitrate').text) // 1000 vbr = int(fnode.find('./videoBitrate').text) // 1000 - pref = (is_available, proto_pref, quality_pref, vbr, abr) + 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 return { - 'format_id': format_id, + 'format_id': format_id + u'-' + quality, 'url': video_url, - 'ext': format_m.group('container'), + 'ext': ext, 'acodec': format_m.group('acodec'), 'vcodec': format_m.group('vcodec'), 'abr': abr, 'vbr': vbr, 'width': int(fnode.find('./width').text), 'height': int(fnode.find('./height').text), - 'quality_name': quality, 'filesize': int(fnode.find('./filesize').text), - 'format_note': None if is_available else u'(unavailable)', + 'format_note': format_note, '_pref': pref, + '_available': is_available, } format_nodes = doc.findall('.//formitaeten/formitaet') - formats = sorted(map(xml_to_format, format_nodes), + formats = sorted(filter(lambda f: f['_available'], + map(xml_to_format, format_nodes)), key=operator.itemgetter('_pref')) return { |