From 5b4da4b4bfaf3cdc9181993355e8021dc52c318d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 27 Apr 2021 15:08:51 +0200 Subject: [PATCH] reorder config access in Job constructor (#1111) --- gallery_dl/job.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 99f61d80..ffca434e 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -27,8 +27,11 @@ class Job(): extr = extractor.find(extr) if not extr: raise exception.NoExtractorError() + self.extractor = extr self.pathfmt = None + self.kwdict = {} + self.status = 0 self._logger_extra = { "job" : self, @@ -39,25 +42,15 @@ class Job(): extr.log = self._wrap_logger(extr.log) extr.log.debug("Using %s for '%s'", extr.__class__.__name__, extr.url) - self.status = 0 - self.pred_url = self._prepare_predicates("image", True) - self.pred_queue = self._prepare_predicates("chapter", False) - self.kwdict = {} - - # user-supplied metadata - kwdict = self.extractor.config("keywords") - if kwdict: - self.kwdict.update(kwdict) - # data from parent job if parent: pextr = parent.extractor # transfer (sub)category if pextr.config("category-transfer", pextr.categorytransfer): + extr._cfgpath = pextr._cfgpath extr.category = pextr.category extr.subcategory = pextr.subcategory - extr._cfgpath = pextr._cfgpath # transfer parent directory extr._parentdir = pextr._parentdir @@ -65,6 +58,15 @@ class Job(): # reuse connection adapters extr.session.adapters = pextr.session.adapters + # user-supplied metadata + kwdict = self.extractor.config("keywords") + if kwdict: + self.kwdict.update(kwdict) + + # predicates + self.pred_url = self._prepare_predicates("image", True) + self.pred_queue = self._prepare_predicates("chapter", False) + def run(self): """Execute or run the job""" sleep = self.extractor.config("sleep-extractor")