]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[addanime] Add format quality (Closes #5371)
authorSergey M․ <dstftw@gmail.com>
Tue, 7 Apr 2015 15:00:22 +0000 (21:00 +0600)
committerSergey M․ <dstftw@gmail.com>
Tue, 7 Apr 2015 15:00:22 +0000 (21:00 +0600)
youtube_dl/extractor/addanime.py

index 203936e54a3797ae37535022ad02757a925f24d7..d2a60a056b071758af58e6877eb24fe483dded1f 100644 (file)
@@ -11,6 +11,7 @@ from ..compat import (
 )
 from ..utils import (
     ExtractorError,
+    qualities,
 )
 
 
@@ -63,8 +64,10 @@ class AddAnimeIE(InfoExtractor):
                 note='Confirming after redirect')
             webpage = self._download_webpage(url, video_id)
 
+        FORMATS = ('normal', 'hq')
+        quality = qualities(FORMATS)
         formats = []
-        for format_id in ('normal', 'hq'):
+        for format_id in FORMATS:
             rex = r"var %s_video_file = '(.*?)';" % re.escape(format_id)
             video_url = self._search_regex(rex, webpage, 'video file URLx',
                                            fatal=False)
@@ -73,6 +76,7 @@ class AddAnimeIE(InfoExtractor):
             formats.append({
                 'format_id': format_id,
                 'url': video_url,
+                'quality': quality(format_id),
             })
         self._sort_formats(formats)
         video_title = self._og_search_title(webpage)