diff options
author | Paweł Jastrzębski <pawelj@iosphe.re> | 2018-07-10 08:09:04 +0200 |
---|---|---|
committer | Paweł Jastrzębski <pawelj@iosphe.re> | 2018-07-10 08:09:04 +0200 |
commit | 7904662f25997ba1466c9f21c564f1f3f066fb9f (patch) | |
tree | 7b8ffec37720bde09c90ca932a4d8b2bc5879e75 /kindlecomicconverter/shared.py | |
parent | Bump MAX_IMAGE_PIXELS (close #273) (diff) | |
download | kcc-7904662f25997ba1466c9f21c564f1f3f066fb9f.tar.gz kcc-7904662f25997ba1466c9f21c564f1f3f066fb9f.tar.bz2 kcc-7904662f25997ba1466c9f21c564f1f3f066fb9f.zip |
Let 7-Zip handle all archive operations
Diffstat (limited to 'kindlecomicconverter/shared.py')
-rw-r--r-- | kindlecomicconverter/shared.py | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/kindlecomicconverter/shared.py b/kindlecomicconverter/shared.py index bdfd3e7..32f656c 100644 --- a/kindlecomicconverter/shared.py +++ b/kindlecomicconverter/shared.py @@ -24,7 +24,6 @@ from html.parser import HTMLParser from distutils.version import StrictVersion from shutil import rmtree, copy from tempfile import mkdtemp -from zipfile import ZipFile, ZIP_DEFLATED from re import split from traceback import format_tb @@ -87,26 +86,6 @@ def md5Checksum(fpath): return m.hexdigest() -def check7ZFile(fpath): - with open(fpath, 'rb') as fh: - header = fh.read(6) - return header == b"7z\xbc\xaf'\x1c" - - -def removeFromZIP(zipfname, *filenames): - tempdir = mkdtemp('', 'KCC-') - try: - tempname = os.path.join(tempdir, 'KCC.zip') - with ZipFile(zipfname, 'r') as zipread: - with ZipFile(tempname, 'w', compression=ZIP_DEFLATED) as zipwrite: - for item in zipread.infolist(): - if item.filename not in filenames: - zipwrite.writestr(item, zipread.read(item.filename)) - copy(tempname, zipfname) - finally: - rmtree(tempdir, True) - - def sanitizeTrace(traceback): return ''.join(format_tb(traceback))\ .replace('C:/projects/kcc/', '') \ |