0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-25 02:45:12 +00:00

[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)
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
elif None in info['entries']:
raise PostProcessingError('Aborting concatenation because some downloads failed')
elif any(len(entry) > 1 for entry in traverse_obj(info, ('entries', ..., 'requested_downloads')) or []):
elif any(len(entry) > 1 for entry in traverse_obj(entries, (..., 'requested_downloads')) or []):
raise PostProcessingError('Concatenation is not supported when downloading multiple separate formats')
in_files = traverse_obj(info, ('entries', ..., 'requested_downloads', 0, 'filepath'))
if not in_files:
self.to_screen('There are no files to concatenate')
return [], info
in_files = traverse_obj(entries, (..., 'requested_downloads', 0, 'filepath'))
if len(in_files) < len(entries):
raise PostProcessingError('Aborting concatenation because some downloads failed')
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'
out_file = self._downloader.prepare_filename(ie_copy, 'pl_video')