[options] add '--sleep-skip' option (#6582)
https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3677460485
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user