[tunein] Ignore reliability if it's >90% (#4097)

This commit is contained in:
Philipp Hagemeister 2015-01-08 14:09:43 +01:00
parent 796858a53f
commit ec3a6a3137

View File

@ -24,7 +24,7 @@ class TuneInIE(InfoExtractor):
_INFO_DICT = { _INFO_DICT = {
'id': '34682', 'id': '34682',
'title': 'Jazz 24 on 88.5 Jazz24 - KPLU-HD2', 'title': 'Jazz 24 on 88.5 Jazz24 - KPLU-HD2',
'ext': 'AAC', 'ext': 'aac',
'thumbnail': 're:^https?://.*\.png$', 'thumbnail': 're:^https?://.*\.png$',
'location': 'Tacoma, WA', 'location': 'Tacoma, WA',
} }
@ -78,14 +78,21 @@ def _real_extract(self, url):
for stream in streams: for stream in streams:
if stream.get('Type') == 'Live': if stream.get('Type') == 'Live':
is_live = True is_live = True
reliability = stream.get('Reliability')
format_note = (
'Reliability: %d%%' % reliability
if reliability is not None else None)
formats.append({ formats.append({
'preference': (
0 if reliability is None or reliability > 90
else 1),
'abr': stream.get('Bandwidth'), 'abr': stream.get('Bandwidth'),
'ext': stream.get('MediaType'), 'ext': stream.get('MediaType').lower(),
'acodec': stream.get('MediaType'), 'acodec': stream.get('MediaType'),
'vcodec': 'none', 'vcodec': 'none',
'url': stream.get('Url'), 'url': stream.get('Url'),
# Sometimes streams with the highest quality do not exist 'source_preference': reliability,
'preference': stream.get('Reliability'), 'format_note': format_note,
}) })
self._sort_formats(formats) self._sort_formats(formats)