diff options
| author | 2024-06-06 02:40:15 -0400 | |
|---|---|---|
| committer | 2024-06-06 02:40:15 -0400 | |
| commit | 1c28712d865e30ed752988ba0b6944882250b665 (patch) | |
| tree | e5d5083a418f5c19616cb940c090c2dfb646d3cb /gallery_dl/__init__.py | |
| parent | 6e662211019a89caec44de8a57c675872b0b5498 (diff) | |
New upstream version 1.27.0.upstream/1.27.0
Diffstat (limited to 'gallery_dl/__init__.py')
| -rw-r--r-- | gallery_dl/__init__.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index 19ea77b..bc44b35 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -38,6 +38,11 @@ def main(): except ImportError: import toml config.load(args.configs_toml, strict=True, loads=toml.loads) + if not args.colors: + output.ANSI = False + config.set((), "colors", False) + if util.WINDOWS: + config.set(("output",), "ansi", False) if args.filename: filename = args.filename if filename == "/O": @@ -86,7 +91,7 @@ def main(): signal.signal(signal_num, signal.SIG_IGN) # enable ANSI escape sequences on Windows - if util.WINDOWS and config.get(("output",), "ansi"): + if util.WINDOWS and config.get(("output",), "ansi", output.COLORS): from ctypes import windll, wintypes, byref kernel32 = windll.kernel32 mode = wintypes.DWORD() @@ -113,7 +118,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: @@ -122,7 +127,7 @@ def main(): extra = "" if util.EXECUTABLE: - extra = " - Executable" + extra = " - Executable ({})".format(version.__variant__) else: git_head = util.git_head() if git_head: @@ -178,7 +183,13 @@ def main(): else: extractor._module_iter = iter(modules[0]) - if args.list_modules: + if args.update: + from . import update + extr = update.UpdateExtractor.from_url("update:" + args.update) + ujob = update.UpdateJob(extr) + return ujob.run() + + elif args.list_modules: extractor.modules.append("") sys.stdout.write("\n".join(extractor.modules)) @@ -202,6 +213,7 @@ def main(): if cnt is None: log.error("Database file not available") + return 1 else: log.info( "Deleted %d %s from '%s'", @@ -294,6 +306,7 @@ def main(): input_manager.next() return retval + return 0 except KeyboardInterrupt: raise SystemExit("\nKeyboardInterrupt") |
