[options] add '--sleep-skip' option (#6582)

https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3677460485
This commit is contained in:
Mike Fährmann
2025-12-20 18:02:10 +01:00
parent 575bf7a9f9
commit 19a27a47b3
6 changed files with 26 additions and 2 deletions

View File

@@ -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