MCPcopy
hub / github.com/mikf/gallery-dl / __init__

Method __init__

gallery_dl/postprocessor/zip.py:26–47  ·  view source on GitHub ↗
(self, job, options)

Source from the content-addressed store, hash-verified

24 }
25
26 def __init__(self, job, options):
27 PostProcessor.__init__(self, job)
28 self.delete = not options.get("keep-files", False)
29 self.files = options.get("files")
30 ext = "." + options.get("extension", "zip")
31 algorithm = options.get("compression", "store")
32 if algorithm not in self.COMPRESSION_ALGORITHMS:
33 self.log.warning(
34 "unknown compression algorithm '%s'; falling back to 'store'",
35 algorithm)
36 algorithm = "store"
37
38 self.zfile = None
39 self.path = job.pathfmt.realdirectory[:-1]
40 self.args = (self.path + ext, "a",
41 self.COMPRESSION_ALGORITHMS[algorithm], True)
42
43 job.register_hooks({
44 "file": (self.write_safe if options.get("mode") == "safe" else
45 self.write_fast),
46 }, options)
47 job.hooks["finalize"].append(self.finalize)
48
49 def open(self):
50 try:

Callers

nothing calls this directly

Calls 3

getMethod · 0.80
warningMethod · 0.45
register_hooksMethod · 0.45

Tested by

no test coverage detected