projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ignored intellij related files
[youtube-dl]
/
youtube_dl
/
__init__.py
diff --git
a/youtube_dl/__init__.py
b/youtube_dl/__init__.py
index 79b3898409bb4cd2f703a15b26f7225408c279d6..5df965191c373614c3f62128ece2b65d53fb8f72 100644
(file)
--- a/
youtube_dl/__init__.py
+++ b/
youtube_dl/__init__.py
@@
-67,9
+67,9
@@
def _real_main(argv=None):
# Custom HTTP headers
if opts.headers is not None:
for h in opts.headers:
# Custom HTTP headers
if opts.headers is not None:
for h in opts.headers:
- if
h.find(':', 1) < 0
:
+ if
':' not in h
:
parser.error('wrong header formatting, it should be key:value, not "%s"' % h)
parser.error('wrong header formatting, it should be key:value, not "%s"' % h)
- key, value = h.split(':',
2
)
+ key, value = h.split(':',
1
)
if opts.verbose:
write_string('[debug] Adding header from command line option %s:%s\n' % (key, value))
std_headers[key] = value
if opts.verbose:
write_string('[debug] Adding header from command line option %s:%s\n' % (key, value))
std_headers[key] = value
@@
-86,7
+86,9
@@
def _real_main(argv=None):
if opts.batchfile == '-':
batchfd = sys.stdin
else:
if opts.batchfile == '-':
batchfd = sys.stdin
else:
- batchfd = io.open(opts.batchfile, 'r', encoding='utf-8', errors='ignore')
+ batchfd = io.open(
+ compat_expanduser(opts.batchfile),
+ 'r', encoding='utf-8', errors='ignore')
batch_urls = read_batch_urls(batchfd)
if opts.verbose:
write_string('[debug] Batch file urls: ' + repr(batch_urls) + '\n')
batch_urls = read_batch_urls(batchfd)
if opts.verbose:
write_string('[debug] Batch file urls: ' + repr(batch_urls) + '\n')
@@
-144,14
+146,20
@@
def _real_main(argv=None):
if numeric_limit is None:
parser.error('invalid max_filesize specified')
opts.max_filesize = numeric_limit
if numeric_limit is None:
parser.error('invalid max_filesize specified')
opts.max_filesize = numeric_limit
- if opts.retries is not None:
- if opts.retries in ('inf', 'infinite'):
- opts_retries = float('inf')
+
+ def parse_retries(retries):
+ if retries in ('inf', 'infinite'):
+ parsed_retries = float('inf')
else:
try:
else:
try:
-
opts_retries = int(opts.
retries)
+
parsed_retries = int(
retries)
except (TypeError, ValueError):
parser.error('invalid retry count specified')
except (TypeError, ValueError):
parser.error('invalid retry count specified')
+ return parsed_retries
+ if opts.retries is not None:
+ opts.retries = parse_retries(opts.retries)
+ if opts.fragment_retries is not None:
+ opts.fragment_retries = parse_retries(opts.fragment_retries)
if opts.buffersize is not None:
numeric_buffersize = FileDownloader.parse_bytes(opts.buffersize)
if numeric_buffersize is None:
if opts.buffersize is not None:
numeric_buffersize = FileDownloader.parse_bytes(opts.buffersize)
if numeric_buffersize is None:
@@
-299,7
+307,8
@@
def _real_main(argv=None):
'force_generic_extractor': opts.force_generic_extractor,
'ratelimit': opts.ratelimit,
'nooverwrites': opts.nooverwrites,
'force_generic_extractor': opts.force_generic_extractor,
'ratelimit': opts.ratelimit,
'nooverwrites': opts.nooverwrites,
- 'retries': opts_retries,
+ 'retries': opts.retries,
+ 'fragment_retries': opts.fragment_retries,
'buffersize': opts.buffersize,
'noresizebuffer': opts.noresizebuffer,
'continuedl': opts.continue_dl,
'buffersize': opts.buffersize,
'noresizebuffer': opts.noresizebuffer,
'continuedl': opts.continue_dl,
@@
-397,7
+406,7
@@
def _real_main(argv=None):
try:
if opts.load_info_filename is not None:
try:
if opts.load_info_filename is not None:
- retcode = ydl.download_with_info_file(
opts.load_info_filename
)
+ retcode = ydl.download_with_info_file(
compat_expanduser(opts.load_info_filename)
)
else:
retcode = ydl.download(all_urls)
except MaxDownloadsReached:
else:
retcode = ydl.download(all_urls)
except MaxDownloadsReached: