[pp:rename] recheck if file exists only when necessary

This commit is contained in:
Mike Fährmann
2024-09-05 17:42:29 +02:00
parent 359572162b
commit 8072dcf717
2 changed files with 2 additions and 1 deletions

View File

@@ -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()

View File

@@ -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):