add 'output.fallback' option
to enable/disable fallback URLs for -g/--get-urls
This commit is contained in:
@@ -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
|
output.mode
|
||||||
-----------
|
-----------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
# 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
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
from __future__ import unicode_literals, print_function
|
from __future__ import unicode_literals, print_function
|
||||||
|
|
||||||
__author__ = "Mike Fährmann"
|
__author__ = "Mike Fährmann"
|
||||||
__copyright__ = "Copyright 2014-2020 Mike Fährmann"
|
__copyright__ = "Copyright 2014-2021 Mike Fährmann"
|
||||||
__license__ = "GPLv2"
|
__license__ = "GPLv2"
|
||||||
__maintainer__ = "Mike Fährmann"
|
__maintainer__ = "Mike Fährmann"
|
||||||
__email__ = "mike_faehrmann@web.de"
|
__email__ = "mike_faehrmann@web.de"
|
||||||
@@ -204,6 +204,9 @@ def main():
|
|||||||
if args.list_urls:
|
if args.list_urls:
|
||||||
jobtype = job.UrlJob
|
jobtype = job.UrlJob
|
||||||
jobtype.maxdepth = args.list_urls
|
jobtype.maxdepth = args.list_urls
|
||||||
|
if config.get(("output",), "fallback", True):
|
||||||
|
jobtype.handle_url = \
|
||||||
|
staticmethod(jobtype.handle_url_fallback)
|
||||||
else:
|
else:
|
||||||
jobtype = args.jobtype or job.DownloadJob
|
jobtype = args.jobtype or job.DownloadJob
|
||||||
|
|
||||||
|
|||||||
@@ -575,7 +575,11 @@ class UrlJob(Job):
|
|||||||
self.handle_queue = self.handle_url
|
self.handle_queue = self.handle_url
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def handle_url(url, kwdict):
|
def handle_url(url, _):
|
||||||
|
print(url)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def handle_url_fallback(url, kwdict):
|
||||||
print(url)
|
print(url)
|
||||||
if "_fallback" in kwdict:
|
if "_fallback" in kwdict:
|
||||||
for url in kwdict["_fallback"]:
|
for url in kwdict["_fallback"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user