From 8072dcf717b11c430b6f3dac044e7b734778bdb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 5 Sep 2024 17:42:29 +0200 Subject: [PATCH] [pp:rename] recheck if file exists only when necessary --- gallery_dl/job.py | 2 +- gallery_dl/postprocessor/rename.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 22da1947..c9957679 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -322,7 +322,7 @@ class DownloadJob(Job): for callback in hooks["prepare-after"]: callback(pathfmt) - if pathfmt.exists(): + if kwdict.pop("_file_recheck", False) and pathfmt.exists(): if archive and self._archive_write_skip: archive.add(kwdict) self.handle_skip() diff --git a/gallery_dl/postprocessor/rename.py b/gallery_dl/postprocessor/rename.py index df90a2d4..f71738d2 100644 --- a/gallery_dl/postprocessor/rename.py +++ b/gallery_dl/postprocessor/rename.py @@ -64,6 +64,7 @@ class RenamePP(PostProcessor): pathfmt.filename = name_new = self._new(pathfmt) pathfmt.path = pathfmt.directory + name_new pathfmt.realpath = pathfmt.realdirectory + name_new + pathfmt.kwdict["_file_recheck"] = True def _rename(self, path_old, name_old, path_new, name_new): if self.skip and os.path.exists(path_new):