aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-01-25 04:34:38 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-01-25 04:34:38 +0100
commitbaeaeffce550b23848983cd281f173a7906cd7f9 (patch)
tree2a24f06c7be7ca677786850968066919d660b47d /youtube_dl
parentc14e88f0f561c5ac0a1cb9e6764fe4702bd9f7ca (diff)
[options] Add support for infinite retries (Fixes #507)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/__init__.py13
-rw-r--r--youtube_dl/options.py2
2 files changed, 9 insertions, 6 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index 0bd7b68c3..09da8802d 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -143,10 +143,13 @@ def _real_main(argv=None):
parser.error('invalid max_filesize specified')
opts.max_filesize = numeric_limit
if opts.retries is not None:
- try:
- opts.retries = int(opts.retries)
- except (TypeError, ValueError):
- parser.error('invalid retry count specified')
+ if opts.retries in ('inf', 'infinite'):
+ opts_retries = float('inf')
+ else:
+ try:
+ opts_retries = int(opts.retries)
+ except (TypeError, ValueError):
+ parser.error('invalid retry count specified')
if opts.buffersize is not None:
numeric_buffersize = FileDownloader.parse_bytes(opts.buffersize)
if numeric_buffersize is None:
@@ -268,7 +271,7 @@ def _real_main(argv=None):
'ignoreerrors': opts.ignoreerrors,
'ratelimit': opts.ratelimit,
'nooverwrites': opts.nooverwrites,
- 'retries': opts.retries,
+ 'retries': opts_retries,
'buffersize': opts.buffersize,
'noresizebuffer': opts.noresizebuffer,
'continuedl': opts.continue_dl,
diff --git a/youtube_dl/options.py b/youtube_dl/options.py
index 872835295..1ddbdbc78 100644
--- a/youtube_dl/options.py
+++ b/youtube_dl/options.py
@@ -377,7 +377,7 @@ def parseOpts(overrideArguments=None):
downloader.add_option(
'-R', '--retries',
dest='retries', metavar='RETRIES', default=10,
- help='number of retries (default is %default)')
+ help='number of retries (default is %default), or "infinite".')
downloader.add_option(
'--buffer-size',
dest='buffersize', metavar='SIZE', default='1024',