From 56dcd00391ba6bb344d99d9474835319fbbd48b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 1 Feb 2026 20:48:37 +0100 Subject: [PATCH] [job] add 'init' option --- docs/configuration.rst | 22 ++++++++++++++++++++++ docs/gallery-dl.conf | 1 + gallery_dl/job.py | 4 ++++ 3 files changed, 27 insertions(+) diff --git a/docs/configuration.rst b/docs/configuration.rst index 68b63d79..409f57e2 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -666,6 +666,28 @@ Note is *required* +extractor.*.init +---------------- +Type + * ``bool`` + * ``string`` +Default + ``false`` +Description + | Controls when to initialize extractor internals. + | ( + `postprocessors `_, + `archives `_, + `path-*` options, etc + ) + + ``true`` + Initialize everything immediately upon extractor start + ``false`` | ``"lazy"`` + Initialize data structures when processing the first ``post`` + or not at all when an extractor never yields a ``post``. + + extractor.*.input ----------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index c71d4430..c3e8d7a0 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -85,6 +85,7 @@ "sleep-429" : 60.0, "actions": [], + "init" : "lazy", "input" : null, "netrc" : false, "extension-map": { diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 0a04653b..5f5dba25 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -274,6 +274,10 @@ class Job(): self.pred_post = self._prepare_predicates("post", False) self.pred_queue = self._prepare_predicates("chapter", False) + init = self.extractor.config("init", False) + if init and init != "lazy": + self.initialize() + def _prepare_predicates(self, target, skip): predicates = [] extr = self.extractor