]> jfr.im git - yt-dlp.git/blobdiff - ytdlp_plugins/postprocessor/sample.py
[update] Workaround #5632
[yt-dlp.git] / ytdlp_plugins / postprocessor / sample.py
index 6891280d50a2dc5a1adc26ef2c07efc4dc0afb8b..4563e1c1167596f286d1b8c31bda175b7b407d38 100644 (file)
@@ -1,5 +1,3 @@
-# coding: utf-8
-
 # ⚠ Don't use relative imports
 from yt_dlp.postprocessor.common import PostProcessor
 
@@ -14,9 +12,14 @@ def __init__(self, downloader=None, **kwargs):
 
     # ℹ️ See docstring of yt_dlp.postprocessor.common.PostProcessor.run
     def run(self, info):
-        filepath = info.get('filepath')
-        if filepath:  # PP was called after download (default)
+        if info.get('_type', 'video') != 'video':  # PP was called for playlist
+            self.to_screen(f'Post-processing playlist {info.get("id")!r} with {self._kwargs}')
+        elif info.get('filepath'):  # PP was called after download (default)
+            filepath = info.get('filepath')
             self.to_screen(f'Post-processed {filepath!r} with {self._kwargs}')
+        elif info.get('requested_downloads'):  # PP was called after_video
+            filepaths = [f.get('filepath') for f in info.get('requested_downloads')]
+            self.to_screen(f'Post-processed {filepaths!r} with {self._kwargs}')
         else:  # PP was called before actual download
             filepath = info.get('_filename')
             self.to_screen(f'Pre-processed {filepath!r} with {self._kwargs}')