From e300da14245376d32a45a92628b82d2563834e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 4 May 2021 18:07:08 +0200 Subject: [PATCH] add 'output.skip' option --- docs/configuration.rst | 10 ++++++++++ docs/gallery-dl.conf | 1 + gallery_dl/output.py | 12 ++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 8f9b89e0..b4f85f6d 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2081,6 +2081,16 @@ Description on one console line. +output.skip +----------- +Type + ``bool`` +Default + ``true`` +Description + Show skipped file downloads. + + output.progress --------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index de23d7e7..2d338ff5 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -320,6 +320,7 @@ "mode": "auto", "progress": true, "shorten": true, + "skip": true, "log": "[{name}][{levelname}] {message}", "logfile": null, "unsupportedfile": null diff --git a/gallery_dl/output.py b/gallery_dl/output.py index 2d3dc17d..7e1f8c1e 100644 --- a/gallery_dl/output.py +++ b/gallery_dl/output.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2015-2020 Mike Fährmann +# Copyright 2015-2021 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 @@ -232,15 +232,19 @@ def select(): } omode = config.get(("output",), "mode", "auto").lower() if omode in pdict: - return pdict[omode]() + output = pdict[omode]() elif omode == "auto": if hasattr(sys.stdout, "isatty") and sys.stdout.isatty(): - return ColorOutput() if ANSI else TerminalOutput() + output = ColorOutput() if ANSI else TerminalOutput() else: - return PipeOutput() + output = PipeOutput() else: raise Exception("invalid output mode: " + omode) + if not config.get(("output",), "skip", True): + output.skip = util.identity + return output + class NullOutput():