From d951f13e37f7b0835427b1ccd818da8594a85d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 28 Jan 2018 18:42:10 +0100 Subject: [PATCH] add config option for unsupported-URL file for consistency's sake --- docs/configuration.rst | 9 +++++++++ docs/gallery-dl.conf | 1 + gallery_dl/__init__.py | 9 +++++---- gallery_dl/option.py | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 571cd879..7befd998 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -99,6 +99,15 @@ Description File to write logging output to. =========== ===== +output.unsupportedfile +---------------------- +=========== ===== +Type ``string`` +Default ``null`` +Description File to write external URLs unsupported by *gallery-dl* to. +=========== ===== + + Downloader Options ================== diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 99af3ff7..f0a7baff 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -129,5 +129,6 @@ "shorten": true, "progress": true, "logfile": null, + "unsupportedfile": null } } diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index a4317e11..e93e3579 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -104,7 +104,7 @@ def main(): path = util.expand_path(logfile) handler = logging.FileHandler(path, "w") except OSError as exc: - log.warning("logfile: %s", exc) + log.warning("log file: %s", exc) else: handler.setFormatter(formatter) logging.getLogger().addHandler(handler) @@ -165,11 +165,12 @@ def main(): urls += sanatize_input(file) file.close() except OSError as exc: - log.warning("input-file: %s", exc) + log.warning("input file: %s", exc) - if args.unsupportedfile: + unsupportedfile = config.interpolate(("output", "unsupportedfile")) + if unsupportedfile: try: - path = util.expand_path(args.unsupportedfile) + path = util.expand_path(unsupportedfile) job.Job.ufile = open(path, "w") except OSError as exc: log.warning("unsupported-URL file: %s", exc) diff --git a/gallery_dl/option.py b/gallery_dl/option.py index e509e0ac..3379ca75 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -129,7 +129,7 @@ def build_parser(): ) output.add_argument( "--write-unsupported", - metavar="FILE", dest="unsupportedfile", + metavar="FILE", dest="unsupportedfile", action=ConfigAction, help=("Write URLs, which get emitted by other extractors but cannot " "be handled, to FILE"), )