1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-23 01:08:10 +00:00

[options] Add support for infinite retries (Fixes #507)

This commit is contained in:
Philipp Hagemeister 2015-01-25 04:34:38 +01:00
parent c14e88f0f5
commit baeaeffce5
2 changed files with 9 additions and 6 deletions

View file

@ -143,8 +143,11 @@ def _real_main(argv=None):
parser.error('invalid max_filesize specified') parser.error('invalid max_filesize specified')
opts.max_filesize = numeric_limit opts.max_filesize = numeric_limit
if opts.retries is not None: if opts.retries is not None:
if opts.retries in ('inf', 'infinite'):
opts_retries = float('inf')
else:
try: try:
opts.retries = int(opts.retries) opts_retries = int(opts.retries)
except (TypeError, ValueError): except (TypeError, ValueError):
parser.error('invalid retry count specified') parser.error('invalid retry count specified')
if opts.buffersize is not None: if opts.buffersize is not None:
@ -268,7 +271,7 @@ def _real_main(argv=None):
'ignoreerrors': opts.ignoreerrors, 'ignoreerrors': opts.ignoreerrors,
'ratelimit': opts.ratelimit, 'ratelimit': opts.ratelimit,
'nooverwrites': opts.nooverwrites, 'nooverwrites': opts.nooverwrites,
'retries': opts.retries, 'retries': opts_retries,
'buffersize': opts.buffersize, 'buffersize': opts.buffersize,
'noresizebuffer': opts.noresizebuffer, 'noresizebuffer': opts.noresizebuffer,
'continuedl': opts.continue_dl, 'continuedl': opts.continue_dl,

View file

@ -377,7 +377,7 @@ def parseOpts(overrideArguments=None):
downloader.add_option( downloader.add_option(
'-R', '--retries', '-R', '--retries',
dest='retries', metavar='RETRIES', default=10, 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( downloader.add_option(
'--buffer-size', '--buffer-size',
dest='buffersize', metavar='SIZE', default='1024', dest='buffersize', metavar='SIZE', default='1024',