aboutsummaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/__init__.py
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2016-08-09 03:47:56 +0700
committerSergey M․ <[email protected]>2016-08-09 03:47:56 +0700
commit1ad6b891b21b45830736698a7b59c30d9605a562 (patch)
tree0d2259bced345203c20a47c59256abba243689b1 /youtube_dl/__init__.py
parent7aa589a5e10c983f701b48b8431cc5f54b85cf3b (diff)
downloadyoutube-dl-1ad6b891b21b45830736698a7b59c30d9605a562.tar.gz
youtube-dl-1ad6b891b21b45830736698a7b59c30d9605a562.zip
Add more checks for --min/max-sleep-interval arguments and use more idiomatic naming
Diffstat (limited to 'youtube_dl/__init__.py')
-rw-r--r--youtube_dl/__init__.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index 86af18d33..a9730292c 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -147,10 +147,14 @@ def _real_main(argv=None):
opts.max_filesize = numeric_limit
if opts.sleep_interval is not None:
if opts.sleep_interval < 0:
- parser.error('sleep interval should not be negative')
- elif opts.max_sleep_interval is not None:
- if opts.max_sleep_interval < opts.sleep_interval:
- parser.error('max sleep interval should not be less than sleep interval')
+ parser.error('sleep interval must be positive or 0')
+ if opts.max_sleep_interval is not None:
+ if opts.max_sleep_interval < 0:
+ parser.error('max sleep interval must be positive or 0')
+ if opts.max_sleep_interval < opts.sleep_interval:
+ parser.error('max sleep interval must be greater than or equal to min sleep interval')
+ else:
+ opts.max_sleep_interval = opts.sleep_interval
def parse_retries(retries):
if retries in ('inf', 'infinite'):