Skip to content

Commit

Permalink
[postprocessor] add 'prepare-after' event (#4083)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Aug 10, 2023
1 parent 0ef1fca commit f9fb276
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4518,6 +4518,9 @@ Description
On extractor shutdown when at least one error occurred
``prepare``
Before a file download
``prepare-after``
Before a file download,
but after building and checking file paths
``file``
When completing a file download,
but before it gets moved to its target location
Expand Down
4 changes: 4 additions & 0 deletions gallery_dl/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ def handle_url(self, url, kwdict):
self.handle_skip()
return

if "prepare-after" in hooks:
for callback in hooks["prepare-after"]:
callback(pathfmt)

if self.sleep:
self.extractor.sleep(self.sleep(), "download")

Expand Down

0 comments on commit f9fb276

Please sign in to comment.