aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/postprocessor/zip.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2020-12-13 23:07:48 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2020-12-13 23:07:48 -0500
commit91a9e964cb02f9c0d6e5c3b254378778f295b6b3 (patch)
tree9befdc2987a39d015c9829f836002de3eda8253f /gallery_dl/postprocessor/zip.py
parent9a430174e9ee690675d3772b27994b60041de51a (diff)
parent8f7c87a2697113134c311aaeafd9c919555a2741 (diff)
Update upstream source from tag 'upstream/1.16.0'
Update to upstream version '1.16.0' with Debian dir a323dcdcc7c5a90d7d0ad623d392e091f56dbe52
Diffstat (limited to 'gallery_dl/postprocessor/zip.py')
-rw-r--r--gallery_dl/postprocessor/zip.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/gallery_dl/postprocessor/zip.py b/gallery_dl/postprocessor/zip.py
index a6e5bc3..e820280 100644
--- a/gallery_dl/postprocessor/zip.py
+++ b/gallery_dl/postprocessor/zip.py
@@ -38,12 +38,11 @@ class ZipPP(PostProcessor):
self.args = (self.path[:-1] + ext, "a",
self.COMPRESSION_ALGORITHMS[algorithm], True)
- if options.get("mode") == "safe":
- self.run = self._write_safe
- else:
- self.run = self._write
+ job.hooks["file"].append(
+ self.write_safe if options.get("mode") == "safe" else self.write)
+ job.hooks["finalize"].append(self.finalize)
- def _write(self, pathfmt, zfile=None):
+ def write(self, pathfmt, zfile=None):
# 'NameToInfo' is not officially documented, but it's available
# for all supported Python versions and using it directly is a lot
# faster than calling getinfo()
@@ -55,11 +54,11 @@ class ZipPP(PostProcessor):
zfile.write(pathfmt.temppath, pathfmt.filename)
pathfmt.delete = self.delete
- def _write_safe(self, pathfmt):
+ def write_safe(self, pathfmt):
with zipfile.ZipFile(*self.args) as zfile:
self._write(pathfmt, zfile)
- def run_final(self, pathfmt, status):
+ def finalize(self, pathfmt, status):
if self.zfile:
self.zfile.close()