diff options
Diffstat (limited to 'gallery_dl/postprocessor')
| -rw-r--r-- | gallery_dl/postprocessor/__init__.py | 3 | ||||
| -rw-r--r-- | gallery_dl/postprocessor/classify.py | 6 | ||||
| -rw-r--r-- | gallery_dl/postprocessor/common.py | 8 | ||||
| -rw-r--r-- | gallery_dl/postprocessor/compare.py | 4 | ||||
| -rw-r--r-- | gallery_dl/postprocessor/exec.py | 9 | ||||
| -rw-r--r-- | gallery_dl/postprocessor/metadata.py | 6 | ||||
| -rw-r--r-- | gallery_dl/postprocessor/mtime.py | 6 | ||||
| -rw-r--r-- | gallery_dl/postprocessor/ugoira.py | 8 | ||||
| -rw-r--r-- | gallery_dl/postprocessor/zip.py | 6 |
9 files changed, 25 insertions, 31 deletions
diff --git a/gallery_dl/postprocessor/__init__.py b/gallery_dl/postprocessor/__init__.py index 7a3bf23..faa4d6c 100644 --- a/gallery_dl/postprocessor/__init__.py +++ b/gallery_dl/postprocessor/__init__.py @@ -9,7 +9,6 @@ """Post-processing modules""" import importlib -import logging modules = [ "classify", @@ -21,8 +20,6 @@ modules = [ "zip", ] -log = logging.getLogger("postprocessor") - def find(name): """Return a postprocessor class with the given name""" diff --git a/gallery_dl/postprocessor/classify.py b/gallery_dl/postprocessor/classify.py index 4a9bde9..0106903 100644 --- a/gallery_dl/postprocessor/classify.py +++ b/gallery_dl/postprocessor/classify.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2018 Mike Fährmann +# Copyright 2018-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -22,8 +22,8 @@ class ClassifyPP(PostProcessor): "Archives" : ("zip", "rar", "7z", "tar", "gz", "bz2"), } - def __init__(self, pathfmt, options): - PostProcessor.__init__(self) + def __init__(self, job, options): + PostProcessor.__init__(self, job) mapping = options.get("mapping", self.DEFAULT_MAPPING) self.mapping = { diff --git a/gallery_dl/postprocessor/common.py b/gallery_dl/postprocessor/common.py index 70b0dfb..64f978e 100644 --- a/gallery_dl/postprocessor/common.py +++ b/gallery_dl/postprocessor/common.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2018-2019 Mike Fährmann +# Copyright 2018-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -8,15 +8,13 @@ """Common classes and constants used by postprocessor modules.""" -import logging - class PostProcessor(): """Base class for postprocessors""" - def __init__(self): + def __init__(self, job): name = self.__class__.__name__[:-2].lower() - self.log = logging.getLogger("postprocessor." + name) + self.log = job.get_logger("postprocessor." + name) @staticmethod def prepare(pathfmt): diff --git a/gallery_dl/postprocessor/compare.py b/gallery_dl/postprocessor/compare.py index ddbcef0..0d11844 100644 --- a/gallery_dl/postprocessor/compare.py +++ b/gallery_dl/postprocessor/compare.py @@ -14,8 +14,8 @@ import os class ComparePP(PostProcessor): - def __init__(self, pathfmt, options): - PostProcessor.__init__(self) + def __init__(self, job, options): + PostProcessor.__init__(self, job) if options.get("action") == "enumerate": self.run = self._run_enumerate if options.get("shallow"): diff --git a/gallery_dl/postprocessor/exec.py b/gallery_dl/postprocessor/exec.py index 0a56281..cbe51ae 100644 --- a/gallery_dl/postprocessor/exec.py +++ b/gallery_dl/postprocessor/exec.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2018-2019 Mike Fährmann +# Copyright 2018-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -11,10 +11,9 @@ from .common import PostProcessor from .. import util import subprocess -import os -if os.name == "nt": +if util.WINDOWS: def quote(s): return '"' + s.replace('"', '\\"') + '"' else: @@ -23,8 +22,8 @@ else: class ExecPP(PostProcessor): - def __init__(self, pathfmt, options): - PostProcessor.__init__(self) + def __init__(self, job, options): + PostProcessor.__init__(self, job) args = options["command"] final = options.get("final", False) diff --git a/gallery_dl/postprocessor/metadata.py b/gallery_dl/postprocessor/metadata.py index aa50dfd..a955ba3 100644 --- a/gallery_dl/postprocessor/metadata.py +++ b/gallery_dl/postprocessor/metadata.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -15,8 +15,8 @@ import os class MetadataPP(PostProcessor): - def __init__(self, pathfmt, options): - PostProcessor.__init__(self) + def __init__(self, job, options): + PostProcessor.__init__(self, job) mode = options.get("mode", "json") if mode == "custom": diff --git a/gallery_dl/postprocessor/mtime.py b/gallery_dl/postprocessor/mtime.py index 7065428..b8a4988 100644 --- a/gallery_dl/postprocessor/mtime.py +++ b/gallery_dl/postprocessor/mtime.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -14,8 +14,8 @@ from ..text import parse_int class MtimePP(PostProcessor): - def __init__(self, pathfmt, options): - PostProcessor.__init__(self) + def __init__(self, job, options): + PostProcessor.__init__(self, job) self.key = options.get("key", "date") def run(self, pathfmt): diff --git a/gallery_dl/postprocessor/ugoira.py b/gallery_dl/postprocessor/ugoira.py index 706e706..1afba86 100644 --- a/gallery_dl/postprocessor/ugoira.py +++ b/gallery_dl/postprocessor/ugoira.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# Copyright 2018 Mike Fährmann +# Copyright 2018-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -"""Convert pixiv ugoira to webm""" +"""Convert Pixiv Ugoira to WebM""" from .common import PostProcessor from .. import util @@ -19,8 +19,8 @@ import os class UgoiraPP(PostProcessor): - def __init__(self, pathfmt, options): - PostProcessor.__init__(self) + def __init__(self, job, options): + PostProcessor.__init__(self, job) self.extension = options.get("extension") or "webm" self.args = options.get("ffmpeg-args") or () self.twopass = options.get("ffmpeg-twopass", False) diff --git a/gallery_dl/postprocessor/zip.py b/gallery_dl/postprocessor/zip.py index a43c43a..6970e95 100644 --- a/gallery_dl/postprocessor/zip.py +++ b/gallery_dl/postprocessor/zip.py @@ -22,8 +22,8 @@ class ZipPP(PostProcessor): "lzma" : zipfile.ZIP_LZMA, } - def __init__(self, pathfmt, options): - PostProcessor.__init__(self) + def __init__(self, job, options): + PostProcessor.__init__(self, job) self.delete = not options.get("keep-files", False) ext = "." + options.get("extension", "zip") algorithm = options.get("compression", "store") @@ -33,7 +33,7 @@ class ZipPP(PostProcessor): algorithm) algorithm = "store" - self.path = pathfmt.realdirectory + self.path = job.pathfmt.realdirectory args = (self.path[:-1] + ext, "a", self.COMPRESSION_ALGORITHMS[algorithm], True) |
