From a3f580254a555e5d1bf1793f921954b398cc92f4 Mon Sep 17 00:00:00 2001 From: Aidan Harris Date: Sun, 14 Apr 2024 08:55:50 +0000 Subject: [PATCH 1/2] Add warnings flag This commit adds a warnings flag It can be combined with -q / --quiet to display warnings. The intent is to provide a silent option that still surfaces warning and error messages so that they are visible in logs. --- gallery_dl/__init__.py | 2 +- gallery_dl/option.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index 19ea77b2..fb3c5cb7 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -113,7 +113,7 @@ def main(): # loglevels output.configure_logging(args.loglevel) - if args.loglevel >= logging.ERROR: + if args.loglevel >= logging.WARNING: config.set(("output",), "mode", "null") config.set(("downloader",), "progress", None) elif args.loglevel <= logging.DEBUG: diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 72a602f2..9825cd23 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -255,6 +255,12 @@ def build_parser(): action="store_const", const=logging.DEBUG, help="Print various debugging information", ) + output.add_argument( + "-w", "--warning", + dest="loglevel", + action="store_const", const=logging.WARNING, + help="Print warnings", + ) output.add_argument( "-g", "--get-urls", dest="list_urls", action="count", From a2affdcef3bef31b46f85649af16149348a64f23 Mon Sep 17 00:00:00 2001 From: Aidan Harris Date: Sun, 14 Apr 2024 13:15:07 +0000 Subject: [PATCH 2/2] re-order verbose and warning options --- gallery_dl/option.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 9825cd23..9ede0622 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -250,16 +250,16 @@ def build_parser(): help="Activate quiet mode", ) output.add_argument( - "-v", "--verbose", + "-w", "--warning", dest="loglevel", - action="store_const", const=logging.DEBUG, - help="Print various debugging information", + action="store_const", const=logging.WARNING, + help="Print only warnings and errors", ) output.add_argument( - "-w", "--warning", + "-v", "--verbose", dest="loglevel", - action="store_const", const=logging.WARNING, - help="Print warnings", + action="store_const", const=logging.DEBUG, + help="Print various debugging information", ) output.add_argument( "-g", "--get-urls",