[FFmpegConcat] Abort on --skip-download and download errors

Closes #2470
This commit is contained in:
pukkandan 2022-02-03 20:26:27 +05:30
parent 4918522735
commit 460a1c08b9
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698

View File

@ -1149,20 +1149,19 @@ def concat_files(self, in_files, out_file):
@PostProcessor._restrict_to(images=False) @PostProcessor._restrict_to(images=False)
def run(self, info): def run(self, info):
if not info.get('entries') or self._only_multi_video and info['_type'] != 'multi_video': entries = info.get('entries') or []
if (self.get_param('skip_download') or not any(entries)
or self._only_multi_video and info['_type'] != 'multi_video'):
return [], info return [], info
elif None in info['entries']: elif any(len(entry) > 1 for entry in traverse_obj(entries, (..., 'requested_downloads')) or []):
raise PostProcessingError('Aborting concatenation because some downloads failed')
elif any(len(entry) > 1 for entry in traverse_obj(info, ('entries', ..., 'requested_downloads')) or []):
raise PostProcessingError('Concatenation is not supported when downloading multiple separate formats') raise PostProcessingError('Concatenation is not supported when downloading multiple separate formats')
in_files = traverse_obj(info, ('entries', ..., 'requested_downloads', 0, 'filepath')) in_files = traverse_obj(entries, (..., 'requested_downloads', 0, 'filepath'))
if not in_files: if len(in_files) < len(entries):
self.to_screen('There are no files to concatenate') raise PostProcessingError('Aborting concatenation because some downloads failed')
return [], info
ie_copy = self._downloader._playlist_infodict(info) ie_copy = self._downloader._playlist_infodict(info)
exts = [traverse_obj(entry, ('requested_downloads', 0, 'ext'), 'ext') for entry in info['entries']] exts = traverse_obj(entries, (..., 'requested_downloads', 0, 'ext'), (..., 'ext'))
ie_copy['ext'] = exts[0] if len(set(exts)) == 1 else 'mkv' ie_copy['ext'] = exts[0] if len(set(exts)) == 1 else 'mkv'
out_file = self._downloader.prepare_filename(ie_copy, 'pl_video') out_file = self._downloader.prepare_filename(ie_copy, 'pl_video')