]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Implement the max quality option in YoutubeDL
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Mon, 8 Jul 2013 10:10:47 +0000 (12:10 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 11 Oct 2013 14:34:48 +0000 (16:34 +0200)
youtube_dl/YoutubeDL.py

index feb1058618c5fb51d7c153489363e86c742f32f9..d88378ddac8fac380d9f091e7d82dd2666bf85fc 100644 (file)
@@ -469,6 +469,10 @@ class YoutubeDL(object):
             self.list_formats(info_dict)
             return
 
+        format_limit = self.params.get('format_limit', None)
+        if format_limit:
+            formats = [f for f in formats if f['format_id'] <= format_limit]
+
         req_format = self.params.get('format', 'best')
         formats_to_download = []
         if req_format == 'best' or req_format is None: