mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
add 'output.fallback' option
to enable/disable fallback URLs for -g/--get-urls
This commit is contained in:
parent
5a98bcec3a
commit
a86ffb04bb
@ -1993,6 +1993,16 @@ Output Options
|
||||
==============
|
||||
|
||||
|
||||
output.fallback
|
||||
---------------
|
||||
Type
|
||||
``bool``
|
||||
Default
|
||||
``true``
|
||||
Description
|
||||
Include fallback URLs in the output of ``-g/--get-urls``.
|
||||
|
||||
|
||||
output.mode
|
||||
-----------
|
||||
Type
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2014-2020 Mike Fährmann
|
||||
# Copyright 2014-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
|
||||
@ -9,7 +9,7 @@
|
||||
from __future__ import unicode_literals, print_function
|
||||
|
||||
__author__ = "Mike Fährmann"
|
||||
__copyright__ = "Copyright 2014-2020 Mike Fährmann"
|
||||
__copyright__ = "Copyright 2014-2021 Mike Fährmann"
|
||||
__license__ = "GPLv2"
|
||||
__maintainer__ = "Mike Fährmann"
|
||||
__email__ = "mike_faehrmann@web.de"
|
||||
@ -204,6 +204,9 @@ def main():
|
||||
if args.list_urls:
|
||||
jobtype = job.UrlJob
|
||||
jobtype.maxdepth = args.list_urls
|
||||
if config.get(("output",), "fallback", True):
|
||||
jobtype.handle_url = \
|
||||
staticmethod(jobtype.handle_url_fallback)
|
||||
else:
|
||||
jobtype = args.jobtype or job.DownloadJob
|
||||
|
||||
|
@ -575,7 +575,11 @@ class UrlJob(Job):
|
||||
self.handle_queue = self.handle_url
|
||||
|
||||
@staticmethod
|
||||
def handle_url(url, kwdict):
|
||||
def handle_url(url, _):
|
||||
print(url)
|
||||
|
||||
@staticmethod
|
||||
def handle_url_fallback(url, kwdict):
|
||||
print(url)
|
||||
if "_fallback" in kwdict:
|
||||
for url in kwdict["_fallback"]:
|
||||
|
Loading…
Reference in New Issue
Block a user