[pp] add 'child' & 'child-after' events
This commit is contained in:
@@ -431,6 +431,12 @@ class DownloadJob(Job):
|
||||
return
|
||||
self.visited.add(url)
|
||||
|
||||
if "child" in self.hooks:
|
||||
pathfmt = self.pathfmt
|
||||
pathfmt.kwdict = kwdict
|
||||
for callback in self.hooks["child"]:
|
||||
callback(pathfmt)
|
||||
|
||||
if cls := kwdict.get("_extractor"):
|
||||
extr = cls.from_url(url)
|
||||
else:
|
||||
@@ -502,6 +508,12 @@ class DownloadJob(Job):
|
||||
else:
|
||||
self._write_unsupported(url)
|
||||
|
||||
if "child-after" in self.hooks:
|
||||
pathfmt = self.pathfmt
|
||||
pathfmt.kwdict = kwdict
|
||||
for callback in self.hooks["child-after"]:
|
||||
callback(pathfmt)
|
||||
|
||||
def handle_finalize(self):
|
||||
if self.archive:
|
||||
if not self.status:
|
||||
|
||||
@@ -179,7 +179,8 @@ class PrintAction(argparse.Action):
|
||||
event = event.strip().lower()
|
||||
if event not in {"init", "file", "after", "skip", "error",
|
||||
"prepare", "prepare-after", "post", "post-after",
|
||||
"finalize", "finalize-success", "finalize-error"}:
|
||||
"finalize", "finalize-success", "finalize-error",
|
||||
"child", "child-after"}:
|
||||
format_string = value
|
||||
event = ("prepare",)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user