diff options
| author | 2020-01-21 01:08:44 -0500 | |
|---|---|---|
| committer | 2020-01-21 01:08:44 -0500 | |
| commit | 025429729005792ae1ac2041ec45c117fe69402b (patch) | |
| tree | 24c0ee8c5c50d6833e37853936c08c624f6e0d11 /gallery_dl/postprocessor/zip.py | |
| parent | 6428f3de38d530420353623d3553911e54f26d50 (diff) | |
| parent | 4366125d2580982abb57bc65a26fc1fb8ef2a5df (diff) | |
Update upstream source from tag 'upstream/1.12.3'
Update to upstream version '1.12.3'
with Debian dir 480cf02c985b30e09534326667875dc02ee11608
Diffstat (limited to 'gallery_dl/postprocessor/zip.py')
| -rw-r--r-- | gallery_dl/postprocessor/zip.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/gallery_dl/postprocessor/zip.py b/gallery_dl/postprocessor/zip.py index 42f7608..a43c43a 100644 --- a/gallery_dl/postprocessor/zip.py +++ b/gallery_dl/postprocessor/zip.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2018-2019 Mike Fährmann +# Copyright 2018-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -9,17 +9,17 @@ """Store files in ZIP archives""" from .common import PostProcessor +from .. import util import zipfile -import os class ZipPP(PostProcessor): COMPRESSION_ALGORITHMS = { "store": zipfile.ZIP_STORED, - "zip": zipfile.ZIP_DEFLATED, + "zip" : zipfile.ZIP_DEFLATED, "bzip2": zipfile.ZIP_BZIP2, - "lzma": zipfile.ZIP_LZMA, + "lzma" : zipfile.ZIP_LZMA, } def __init__(self, pathfmt, options): @@ -64,18 +64,11 @@ class ZipPP(PostProcessor): self.zfile.close() if self.delete: - try: - # remove target directory - os.rmdir(self.path) - except OSError: - pass + util.remove_directory(self.path) if self.zfile and not self.zfile.NameToInfo: - try: - # delete empty zip archive - os.unlink(self.zfile.filename) - except OSError: - pass + # remove empty zip archive + util.remove_file(self.zfile.filename) __postprocessor__ = ZipPP |
