1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-04 16:03:31 +08:00

Make sure process_info completes successfully

Makes sure that the checks and operations in process_info are completed successfully before adding video to download archive
This commit is contained in:
dundua 2015-11-12 15:39:13 -08:00
parent d7ff06a0f3
commit b6dd380f24

View File

@ -1330,11 +1330,15 @@ class YoutubeDL(object):
if download: if download:
if len(formats_to_download) > 1: if len(formats_to_download) > 1:
self.to_screen('[info] %s: downloading video in %s formats' % (info_dict['id'], len(formats_to_download))) self.to_screen('[info] %s: downloading video in %s formats' % (info_dict['id'], len(formats_to_download)))
download_success = 0
for format in formats_to_download: for format in formats_to_download:
new_info = dict(info_dict) new_info = dict(info_dict)
new_info.update(format) new_info.update(format)
self.process_info(new_info) success = self.process_info(new_info)
self.record_download_archive(info_dict) if success:
download_success += 1
if download_success == len(formats_to_download):
self.record_download_archive(info_dict)
# We update the info dict with the best quality format (backwards compatibility) # We update the info dict with the best quality format (backwards compatibility)
info_dict.update(formats_to_download[-1]) info_dict.update(formats_to_download[-1])
return info_dict return info_dict
@ -1651,6 +1655,8 @@ class YoutubeDL(object):
self.report_error('postprocessing: %s' % str(err)) self.report_error('postprocessing: %s' % str(err))
return return
return success
def download(self, url_list): def download(self, url_list):
"""Download a given list of URLs.""" """Download a given list of URLs."""
outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL) outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)