add 'parent-skip' option (#1399)

This commit is contained in:
Mike Fährmann
2021-05-12 23:37:01 +02:00
parent c693db5b1a
commit 7ab8374385
2 changed files with 18 additions and 2 deletions

View File

@@ -143,6 +143,16 @@ Description
Overwrite any metadata provided by a child extractor with its parent's.
extractor.*.parent-skip
-----------------------
Type
``bool``
Default
``false``
Description
Share number of skipped downloads between parent and child extractors.
extractor.*.path-restrict
-------------------------
Type

View File

@@ -201,6 +201,7 @@ class DownloadJob(Job):
self.hooks = ()
self.downloaders = {}
self.out = output.select()
self._skipcnt = 0
if parent:
self.visited = parent.visited
@@ -306,7 +307,13 @@ class DownloadJob(Job):
extr = None
if extr:
self.status |= self.__class__(extr, self, kwdict).run()
job = self.__class__(extr, self, kwdict)
if extr.config("parent-skip"):
job._skipcnt = self._skipcnt
self.status |= job.run()
self._skipcnt = job._skipcnt
else:
self.status |= job.run()
else:
self._write_unsupported(url)
@@ -406,7 +413,6 @@ class DownloadJob(Job):
self._skipexc = exception.TerminateExtraction
elif skip == "exit":
self._skipexc = sys.exit
self._skipcnt = 0
self._skipmax = text.parse_int(smax)
else:
# monkey-patch methods to always return False