From cb1d0c4dc25aea36b719f780122f875819177be5 Mon Sep 17 00:00:00 2001 From: SavinaRoja Date: Sun, 6 Oct 2013 00:06:57 -0400 Subject: [PATCH] Converted --rate-limit and --min-filesize to docopt --- youtube_dl/__init__.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index cc63f0750..2f8b9c1d6 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -408,8 +408,8 @@ def parseOpts(overrideArguments=None): default=[], callback=_comma_separated_values_options_callback, help='languages of the subtitles to download (optional) separated by commas, use IETF language tags like \'en,pt\'') - downloader.add_option('-r', '--rate-limit', - dest='ratelimit', metavar='LIMIT', help='maximum download rate (e.g. 50k or 44.6m)') + #downloader.add_option('-r', '--rate-limit', + # dest='ratelimit', metavar='LIMIT', help='maximum download rate (e.g. 50k or 44.6m)') downloader.add_option('-R', '--retries', dest='retries', metavar='RETRIES', help='number of retries (default is %default)', default=10) downloader.add_option('--buffer-size', @@ -672,16 +672,16 @@ def _real_main(argv=None): #if optsopts['--title'] and opts.useid: # parser.error(u'using title conflicts with using video ID') - if opts.ratelimit is not None: - numeric_limit = FileDownloader.parse_bytes(opts.ratelimit) + if opts['--rate-limit']: + numeric_limit = FileDownloader.parse_bytes(opts['--rate-limit']) if numeric_limit is None: parser.error(u'invalid rate limit specified') - opts.ratelimit = numeric_limit - if opts.min_filesize is not None: - numeric_limit = FileDownloader.parse_bytes(opts.min_filesize) + opts['--rate-limit'] = numeric_limit + if opts['--min-filesize']: + numeric_limit = FileDownloader.parse_bytes(opts['--min-filesize']) if numeric_limit is None: parser.error(u'invalid min_filesize specified') - opts.min_filesize = numeric_limit + opts['--min-filesize'] = numeric_limit if opts.max_filesize is not None: numeric_limit = FileDownloader.parse_bytes(opts.max_filesize) if numeric_limit is None: @@ -760,7 +760,7 @@ def _real_main(argv=None): 'autonumber_size': opts.autonumber_size, 'restrictfilenames': opts.restrictfilenames, 'ignoreerrors': opts.ignoreerrors, - 'ratelimit': opts.ratelimit, + 'ratelimit': opts['--rate-limit'], 'nooverwrites': opts.nooverwrites, 'retries': opts.retries, 'buffersize': opts.buffersize, @@ -791,7 +791,7 @@ def _real_main(argv=None): 'dump_intermediate_pages': opts['--dump-intermediate-pages'], 'test': opts.test, 'keepvideo': opts.keepvideo, - 'min_filesize': opts.min_filesize, + 'min_filesize': opts['--min-filesize'], 'max_filesize': opts.max_filesize, 'daterange': date, })