From 5bfc8bee5a2bfb1e365c2b4a7ac0adaf6a9cdae2 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Tue, 14 Dec 2021 21:08:24 +0530 Subject: [PATCH] Fix PostProcessor hooks not registered for some PPs Closes #1993 --- yt_dlp/YoutubeDL.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 6064c4c950..698ad98a17 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -634,13 +634,6 @@ class YoutubeDL(object): self.print_debug_header() self.add_default_info_extractors() - for pp_def_raw in self.params.get('postprocessors', []): - pp_def = dict(pp_def_raw) - when = pp_def.pop('when', 'post_process') - pp_class = get_postprocessor(pp_def.pop('key')) - pp = pp_class(self, **compat_kwargs(pp_def)) - self.add_post_processor(pp, when=when) - hooks = { 'post_hooks': self.add_post_hook, 'progress_hooks': self.add_progress_hook, @@ -650,6 +643,13 @@ class YoutubeDL(object): for ph in self.params.get(opt, []): fn(ph) + for pp_def_raw in self.params.get('postprocessors', []): + pp_def = dict(pp_def_raw) + when = pp_def.pop('when', 'post_process') + self.add_post_processor( + get_postprocessor(pp_def.pop('key'))(self, **compat_kwargs(pp_def)), + when=when) + register_socks_protocols() def preload_download_archive(fn): @@ -736,6 +736,9 @@ class YoutubeDL(object): def add_postprocessor_hook(self, ph): """Add the postprocessing progress hook""" self._postprocessor_hooks.append(ph) + for pps in self._pps.values(): + for pp in pps: + pp.add_progress_hook(ph) def _bidi_workaround(self, message): if not hasattr(self, '_output_channel'):