[arte] Fix versionCode interpretation (#2588)
authorPhilipp Hagemeister <phihag@phihag.de>
Thu, 8 May 2014 00:00:01 +0000 (02:00 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Thu, 8 May 2014 00:00:47 +0000 (02:00 +0200)
youtube_dl/extractor/arte.py

index 2abdd50290cd6deb649d9785931e67131ba37a67..b528a9ec50ca6c2dac1a52fe66de2cd66194dd23 100644 (file)
@@ -121,14 +121,17 @@ class ArteTVPlus7IE(InfoExtractor):
                 return ['HQ', 'MQ', 'EQ', 'SQ'].index(f['quality'])
         else:
             def sort_key(f):
+                versionCode = f.get('versionCode')
+                if versionCode is None:
+                    versionCode = ''
                 return (
                     # Sort first by quality
-                    int(f.get('height',-1)),
-                    int(f.get('bitrate',-1)),
+                    int(f.get('height', -1)),
+                    int(f.get('bitrate', -1)),
                     # The original version with subtitles has lower relevance
-                    re.match(r'VO-ST(F|A)', f.get('versionCode', '')) is None,
+                    re.match(r'VO-ST(F|A)', versionCode) is None,
                     # The version with sourds/mal subtitles has also lower relevance
-                    re.match(r'VO?(F|A)-STM\1', f.get('versionCode', '')) is None,
+                    re.match(r'VO?(F|A)-STM\1', versionCode) is None,
                     # Prefer http downloads over m3u8
                     0 if f['url'].endswith('m3u8') else 1,
                 )