aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/__init__.py
diff options
context:
space:
mode:
authorrupertbaxter2 <rupertbaxter2@yahoo.com>2014-08-03 07:34:04 -0700
committerrupertbaxter2 <rupertbaxter2@yahoo.com>2014-08-03 07:34:04 -0700
commit03359e9864bfb925f577fa5b16c3ef22884127aa (patch)
treeccb36cf76778fdb98f8286a1ca1d6969b6de16f4 /youtube_dl/__init__.py
parent493987fefe5d12697df98b6e0eef106e77ac64aa (diff)
Added --sleep-interval option
Diffstat (limited to 'youtube_dl/__init__.py')
-rw-r--r--youtube_dl/__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index 429630ce5..2bd5ec33b 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -351,6 +351,8 @@ def parseOpts(overrideArguments=None):
downloader.add_option('-r', '--rate-limit',
dest='ratelimit', metavar='LIMIT', help='maximum download rate in bytes per second (e.g. 50K or 4.2M)')
+ downloader.add_option('--sleep-interval',
+ dest='sleepinterval', metavar='SLEEPINTERVAL', help='number of seconds to sleep between downloads (default is %default)', default="0")
downloader.add_option('-R', '--retries',
dest='retries', metavar='RETRIES', help='number of retries (default is %default)', default=10)
downloader.add_option('--buffer-size',
@@ -671,6 +673,11 @@ def _real_main(argv=None):
if numeric_limit is None:
parser.error(u'invalid rate limit specified')
opts.ratelimit = numeric_limit
+ if opts.sleepinterval is not None:
+ try:
+ opts.sleepinterval = abs(int(opts.sleepinterval))
+ except ValueError:
+ parser.error(u'invalid sleep interval specified')
if opts.min_filesize is not None:
numeric_limit = FileDownloader.parse_bytes(opts.min_filesize)
if numeric_limit is None:
@@ -767,6 +774,7 @@ def _real_main(argv=None):
'restrictfilenames': opts.restrictfilenames,
'ignoreerrors': opts.ignoreerrors,
'ratelimit': opts.ratelimit,
+ 'sleepinterval': opts.sleepinterval,
'nooverwrites': opts.nooverwrites,
'retries': opts.retries,
'buffersize': opts.buffersize,