Skip to content

Commit

Permalink
add 'parent-skip' option (#1399)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed May 13, 2021
1 parent c693db5 commit 7ab8374
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions gallery_dl/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def __init__(self, url, parent=None, kwdict=None):
self.hooks = ()
self.downloaders = {}
self.out = output.select()
self._skipcnt = 0

if parent:
self.visited = parent.visited
Expand Down Expand Up @@ -306,7 +307,13 @@ def handle_queue(self, url, kwdict):
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)

Expand Down Expand Up @@ -406,7 +413,6 @@ def initialize(self, kwdict=None):
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
Expand Down

0 comments on commit 7ab8374

Please sign in to comment.