Skip to content

Commit

Permalink
improve 'parent-directory' (#1364)
Browse files Browse the repository at this point in the history
Allow forwarding metadata from the top-level extractor to all children
if 'parent-directory' is enabled for all extractors along the way.

For example 'reddit' -> 'gfycat' -> 'redgifs'
  • Loading branch information
mikf committed Mar 14, 2021
1 parent c485d0a commit 2364174
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gallery_dl/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,11 @@ def __init__(self, url, parent=None, kwdict=None):
pfmt = parent.pathfmt
if pfmt and parent.extractor.config("parent-directory"):
self.extractor._parentdir = pfmt.directory
if kwdict and parent.extractor.config("parent-metadata"):
self.kwdict.update(kwdict)
if parent.extractor.config("parent-metadata"):
if parent.kwdict:
self.kwdict.update(parent.kwdict)
if kwdict:
self.kwdict.update(kwdict)
else:
self.visited = set()

Expand Down

1 comment on commit 2364174

@mikf
Copy link
Owner Author

@mikf mikf commented on 2364174 Mar 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/parent-directory/parent-metadata/

Please sign in to comment.