summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-01-08 14:09:43 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-01-08 16:14:50 +0100
commitec3a6a31378925c72facbed1005499780b2d78da (patch)
tree57c2d900d4afc5ceebd82c318950c8731965c20c
parent796858a53f3bb987e47ebe28fb0c1963703541cb (diff)
downloadyoutube-dl-ec3a6a31378925c72facbed1005499780b2d78da.tar.gz
youtube-dl-ec3a6a31378925c72facbed1005499780b2d78da.tar.xz
youtube-dl-ec3a6a31378925c72facbed1005499780b2d78da.zip
[tunein] Ignore reliability if it's >90% (#4097)
-rw-r--r--youtube_dl/extractor/tunein.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/youtube_dl/extractor/tunein.py b/youtube_dl/extractor/tunein.py
index 4ce5aeeba..b6b1f2568 100644
--- a/youtube_dl/extractor/tunein.py
+++ b/youtube_dl/extractor/tunein.py
@@ -24,7 +24,7 @@ class TuneInIE(InfoExtractor):
     _INFO_DICT = {
         'id': '34682',
         'title': 'Jazz 24 on 88.5 Jazz24 - KPLU-HD2',
-        'ext': 'AAC',
+        'ext': 'aac',
         'thumbnail': 're:^https?://.*\.png$',
         'location': 'Tacoma, WA',
     }
@@ -78,14 +78,21 @@ class TuneInIE(InfoExtractor):
         for stream in streams:
             if stream.get('Type') == 'Live':
                 is_live = True
+            reliability = stream.get('Reliability')
+            format_note = (
+                'Reliability: %d%%' % reliability
+                if reliability is not None else None)
             formats.append({
+                'preference': (
+                    0 if reliability is None or reliability > 90
+                    else 1),
                 'abr': stream.get('Bandwidth'),
-                'ext': stream.get('MediaType'),
+                'ext': stream.get('MediaType').lower(),
                 'acodec': stream.get('MediaType'),
                 'vcodec': 'none',
                 'url': stream.get('Url'),
-                # Sometimes streams with the highest quality do not exist
-                'preference': stream.get('Reliability'),
+                'source_preference': reliability,
+                'format_note': format_note,
             })
         self._sort_formats(formats)