aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-08-09 03:47:56 +0700
committerSergey M․ <dstftw@gmail.com>2016-08-09 03:47:56 +0700
commit1ad6b891b21b45830736698a7b59c30d9605a562 (patch)
tree0d2259bced345203c20a47c59256abba243689b1 /youtube_dl/downloader
parent7aa589a5e10c983f701b48b8431cc5f54b85cf3b (diff)
downloadyoutube-dl-1ad6b891b21b45830736698a7b59c30d9605a562.tar.xz
Add more checks for --min/max-sleep-interval arguments and use more idiomatic naming
Diffstat (limited to 'youtube_dl/downloader')
-rw-r--r--youtube_dl/downloader/common.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/youtube_dl/downloader/common.py b/youtube_dl/downloader/common.py
index 8e377c72c..8482cbd84 100644
--- a/youtube_dl/downloader/common.py
+++ b/youtube_dl/downloader/common.py
@@ -343,10 +343,11 @@ class FileDownloader(object):
})
return True
- sleep_lower_bound = self.params.get('sleep_interval')
- if sleep_lower_bound:
- sleep_upper_bound = self.params.get('max_sleep_interval', sleep_lower_bound)
- sleep_interval = random.uniform(sleep_lower_bound, sleep_upper_bound)
+ min_sleep_interval = self.params.get('sleep_interval')
+ if min_sleep_interval:
+ max_sleep_interval = self.params.get('max_sleep_interval', min_sleep_interval)
+ print(min_sleep_interval, max_sleep_interval)
+ sleep_interval = random.uniform(min_sleep_interval, max_sleep_interval)
self.to_screen('[download] Sleeping %s seconds...' % sleep_interval)
time.sleep(sleep_interval)