From 06c4cae05b60a24b2f3f89c1aeda41a24c4be9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 28 Jun 2017 18:51:47 +0200 Subject: [PATCH] extend the output of '--list-extractors' It now includes category and subcategory values for each extractor class. --- docs/configuration.rst | 24 +++++++++--------------- gallery_dl/__init__.py | 9 ++++++--- gallery_dl/option.py | 2 +- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index c9944241..775b1d65 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -117,13 +117,12 @@ Description Amount of time (in seconds) to wait for a successful connection Extractor Options ================= -| Each extractor is identified by its ``category`` and ``subcategory``. -| The ``category`` is the lowercase site name without any spaces or special - characters, which is usually just the module name - (``pixiv``, ``batoto``, ...). - The ``subcategory`` is a lowercase word describing the general functionality - of that extractor (``user``, ``favorite``, ``manga``, ...). - +Each extractor is identified by its ``category`` and ``subcategory``. +The ``category`` is the lowercase site name without any spaces or special +characters, which is usually just the module name +(``pixiv``, ``batoto``, ...). +The ``subcategory`` is a lowercase word describing the general functionality +of that extractor (``user``, ``favorite``, ``manga``, ...). Each one of the following options can be specified on multiple levels of the configuration tree: @@ -140,16 +139,11 @@ you specify a general filename pattern for all the different pixiv extractors. Using the ``extractor.pixiv.user.filename`` value lets you override this general pattern specifically for ``PixivUserExtractor`` instances. -The ``category`` and ``subcategory`` of an extractor used for a specific URL -can be determined by using the ``--list-keywords`` command-line option +The ``category`` and ``subcategory`` of all extractors are included in the +output of ``gallery-dl --list-extractors``. For a specific URL these values +can also be determined by using the ``--list-keywords`` command-line option (see the example below). -If that does not work, the extractor names, which can be obtained from -``gallery-dl --list-extractors``, provide an alternative: -Each extractor name is structured as ``CategorySubcategoryExtractor``. -An extractor called ``PixivUserExtractor`` has therefore the category ``pixiv`` -and the subcategory ``user``. - extractor.*.filename -------------------- =========== ===== diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index dfd3330f..7c49344b 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -80,11 +80,14 @@ def main(): print(module_name) elif args.list_extractors: for extr in extractor.extractors(): + if not extr.__doc__: + continue print(extr.__name__) - if extr.__doc__: - print(extr.__doc__) + print(extr.__doc__) + print("Category:", extr.category, + "- Subcategory:", extr.subcategory) if hasattr(extr, "test") and extr.test: - print("Example:", extr.test[0][0]) + print("Example :", extr.test[0][0]) print() else: if not args.urls and not args.inputfile: diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 2ffab289..b0677647 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -152,7 +152,7 @@ def build_parser(): parser.add_argument( "--list-extractors", dest="list_extractors", action="store_true", help=("Print a list of extractor classes " - "with description and example URL"), + "with description, (sub)category and example URL"), ) parser.add_argument( "--list-keywords", dest="list_keywords", action="store_true",