]> jfr.im git - yt-dlp.git/commitdiff
[FFmpegConcat] Abort on --skip-download and download errors
authorpukkandan <redacted>
Thu, 3 Feb 2022 14:56:27 +0000 (20:26 +0530)
committerpukkandan <redacted>
Thu, 3 Feb 2022 15:30:38 +0000 (21:00 +0530)
Closes #2470

yt_dlp/postprocessor/ffmpeg.py

index 5b98c7d9764e996816106007732af6e8e6d50d42..42e9d12a755c11b1bca14bbc03542e5d87281b07 100644 (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')