mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-22 06:14:05 -07:00
Merge 660dfae585
into 0c24eed73a
This commit is contained in:
commit
4e5b72dffe
1 changed files with 23 additions and 21 deletions
44
youtube-dl
44
youtube-dl
|
@ -850,27 +850,26 @@ class FileDownloader(object):
|
||||||
self.trouble(u'ERROR: Cannot write metadata to JSON file ' + infofn)
|
self.trouble(u'ERROR: Cannot write metadata to JSON file ' + infofn)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.params.get('skip_download', False):
|
if self.params.get('nooverwrites', False) and os.path.exists(_encodeFilename(filename)):
|
||||||
if self.params.get('nooverwrites', False) and os.path.exists(_encodeFilename(filename)):
|
success = True
|
||||||
success = True
|
else:
|
||||||
else:
|
try:
|
||||||
try:
|
success = self._do_download(filename, info_dict)
|
||||||
success = self._do_download(filename, info_dict)
|
except (OSError, IOError), err:
|
||||||
except (OSError, IOError), err:
|
raise UnavailableVideoError
|
||||||
raise UnavailableVideoError
|
except (urllib2.URLError, httplib.HTTPException, socket.error), err:
|
||||||
except (urllib2.URLError, httplib.HTTPException, socket.error), err:
|
self.trouble(u'ERROR: unable to download video data: %s' % str(err))
|
||||||
self.trouble(u'ERROR: unable to download video data: %s' % str(err))
|
return
|
||||||
return
|
except (ContentTooShortError, ), err:
|
||||||
except (ContentTooShortError, ), err:
|
self.trouble(u'ERROR: content too short (expected %s bytes and served %s)' % (err.expected, err.downloaded))
|
||||||
self.trouble(u'ERROR: content too short (expected %s bytes and served %s)' % (err.expected, err.downloaded))
|
return
|
||||||
return
|
|
||||||
|
if success:
|
||||||
if success:
|
try:
|
||||||
try:
|
self.post_process(filename, info_dict)
|
||||||
self.post_process(filename, info_dict)
|
except (PostProcessingError), err:
|
||||||
except (PostProcessingError), err:
|
self.trouble(u'ERROR: postprocessing: %s' % str(err))
|
||||||
self.trouble(u'ERROR: postprocessing: %s' % str(err))
|
return
|
||||||
return
|
|
||||||
|
|
||||||
def download(self, url_list):
|
def download(self, url_list):
|
||||||
"""Download a given list of URLs."""
|
"""Download a given list of URLs."""
|
||||||
|
@ -1039,6 +1038,9 @@ class FileDownloader(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
data_len = data.info().get('Content-length', None)
|
data_len = data.info().get('Content-length', None)
|
||||||
|
self.to_screen(u'[info] File size: ' + self.format_bytes(data_len) + ' bytes')
|
||||||
|
if self.params.get('skip_download', False):
|
||||||
|
return True;
|
||||||
if data_len is not None:
|
if data_len is not None:
|
||||||
data_len = long(data_len) + resume_len
|
data_len = long(data_len) + resume_len
|
||||||
data_len_str = self.format_bytes(data_len)
|
data_len_str = self.format_bytes(data_len)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue