From 763bbfae8bbe59b65c41852fc2f5c5812d2e3fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 17 Apr 2025 20:03:18 +0200 Subject: [PATCH] [pp:ugoira] support '"keep-files": true' + custom extension (#7304) for '"mode": "archive"' --- gallery_dl/postprocessor/ugoira.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gallery_dl/postprocessor/ugoira.py b/gallery_dl/postprocessor/ugoira.py index c8e17613..5340335f 100644 --- a/gallery_dl/postprocessor/ugoira.py +++ b/gallery_dl/postprocessor/ugoira.py @@ -135,7 +135,7 @@ class UgoiraPP(PostProcessor): if not self._convert_zip: return self._zip_source = True - ext = pathfmt.extension + self._zip_ext = ext = pathfmt.extension with self._tempdir() as tempdir: if tempdir: @@ -255,9 +255,15 @@ class UgoiraPP(PostProcessor): ]).encode() if self._zip_source: - self.delete = False + zpath = pathfmt.temppath + if self.delete: + self.delete = False + elif self._zip_ext != self.extension: + self._copy_file(zpath, pathfmt.realpath) + zpath = pathfmt.realpath + if self.metadata: - with zipfile.ZipFile(pathfmt.temppath, "a") as zfile: + with zipfile.ZipFile(zpath, "a") as zfile: zinfo = zipfile.ZipInfo(metaname) if self.mtime: zinfo.date_time = zfile.infolist()[0].date_time