From 62097284fe7ce70c517af198ccd5de1395ad871e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 13 Jul 2019 21:49:26 +0200 Subject: [PATCH] add 'download' option (#220) --- docs/configuration.rst | 16 ++++++++++++++++ gallery_dl/job.py | 3 +++ gallery_dl/option.py | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/docs/configuration.rst b/docs/configuration.rst index 1b8229f3..f4cef074 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -334,6 +334,22 @@ Description Controls whether to verify SSL/TLS certificates for HTTPS requests. =========== ===== +extractor.*.download +-------------------- +=========== ===== +Type ``bool`` +Default ``true`` +Description Controls whether to download media files. + + Setting this to ``false`` won't download any files, but all other + functions (postprocessors_, `download archive`_, etc.) + will be executed as normal. +=========== ===== + +.. _postprocessors: `extractor.*.postprocessors`_ +.. _download archive: `extractor.*.archive`_ + + extractor.*.image-range ----------------------- =========== ===== diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 1ec1e17e..7d790f54 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -307,7 +307,10 @@ class DownloadJob(Job): self.pathfmt = util.PathFormat(self.extractor) if keywords: self.pathfmt.set_directory(keywords) + self.sleep = self.extractor.config("sleep") + if not self.extractor.config("download", True): + self.download = lambda x: True skip = self.extractor.config("skip", True) if skip: diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 26dfd8ee..8e0c4d2a 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -205,6 +205,11 @@ def build_parser(): help=("Do not set file modification times according to " "Last-Modified HTTP response headers") ) + downloader.add_argument( + "--no-download", + dest="download", nargs=0, action=ConfigConstAction, const=False, + help=("Do not download any files") + ) downloader.add_argument( "--no-check-certificate", dest="verify", nargs=0, action=ConfigConstAction, const=False,