diff --git a/docs/configuration.rst b/docs/configuration.rst index 55defb77..ca41bef3 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -464,6 +464,18 @@ Description Number of seconds to sleep before each download. +extractor.*.sleep-skip +---------------------- +Type + |Duration|_ +Default + ``0`` +Description + Number of seconds to sleep after + `skipping `__ + a file download. + + extractor.*.sleep-extractor --------------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 25eea53b..36bb7113 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -77,6 +77,7 @@ "metadata-version" : null, "sleep" : 0, + "sleep-skip" : 0, "sleep-request" : 0, "sleep-extractor": 0, "sleep-429" : 60.0, diff --git a/docs/options.md b/docs/options.md index f49aa029..05b3ed04 100644 --- a/docs/options.md +++ b/docs/options.md @@ -90,6 +90,8 @@ --sleep SECONDS Number of seconds to wait before each download. This can be either a constant value or a range (e.g. 2.7 or 2.0-3.5) + --sleep-skip SECONDS Number of seconds to wait after skipping a file + download --sleep-request SECONDS Number of seconds to wait between HTTP requests during data extraction --sleep-429 SECONDS Number of seconds to wait when receiving a '429 diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 7a52bd6b..9d387a3e 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -533,12 +533,15 @@ class DownloadJob(Job): callback(pathfmt) self.out.skip(pathfmt.path) - if self._skipexc: + if self._skipexc is not None: if self._skipftr is None or self._skipftr(pathfmt.kwdict): self._skipcnt += 1 if self._skipcnt >= self._skipmax: raise self._skipexc + if self.sleep_skip is not None: + self.extractor.sleep(self.sleep_skip(), "skip") + def download(self, url): """Download 'url'""" if downloader := self.get_downloader(url[:url.find(":")]): @@ -582,6 +585,7 @@ class DownloadJob(Job): pathfmt.set_directory(kwdict) self.sleep = util.build_duration_func(cfg("sleep")) + self.sleep_skip = util.build_duration_func(cfg("sleep-skip")) self.fallback = cfg("fallback", True) if not cfg("download", True): # monkey-patch method to do nothing and always return True diff --git a/gallery_dl/option.py b/gallery_dl/option.py index a47d8cd1..82efcc97 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -528,6 +528,11 @@ def build_parser(): "This can be either a constant value or a range " "(e.g. 2.7 or 2.0-3.5)"), ) + downloader.add_argument( + "--sleep-skip", + dest="sleep-skip", metavar="SECONDS", action=ConfigAction, + help=("Number of seconds to wait after skipping a file download"), + ) downloader.add_argument( "--sleep-request", dest="sleep-request", metavar="SECONDS", action=ConfigAction, diff --git a/gallery_dl/version.py b/gallery_dl/version.py index 0dcb01a8..c7f643f3 100644 --- a/gallery_dl/version.py +++ b/gallery_dl/version.py @@ -6,5 +6,5 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -__version__ = "1.31.1" +__version__ = "1.31.2-dev" __variant__ = None