From 2e1dab3036082ef29a34495020844ac182e623b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 19 Oct 2024 20:30:34 +0200 Subject: [PATCH] [pp] add 'error' event --- docs/configuration.rst | 2 ++ gallery_dl/job.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/configuration.rst b/docs/configuration.rst index 23352857..a3187177 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -6126,6 +6126,8 @@ Description After a file got moved to its target location ``skip`` When skipping a file download + ``error`` + After a file download failed ``post`` When starting to download all files of a `post`, e.g. a Tweet on Twitter or a post on Patreon. diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 5f48f990..30801eec 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -347,6 +347,9 @@ class DownloadJob(Job): self.status |= 4 self.log.error("Failed to download %s", pathfmt.filename or url) + if "error" in hooks: + for callback in hooks["error"]: + callback(pathfmt) return if not pathfmt.temppath: