Updates as requested.

This commit is contained in:
MichaelFitzurka 2022-03-26 12:42:33 -04:00
parent 287c5f39c1
commit ae20a2eec8
3 changed files with 5 additions and 10 deletions

View File

@ -71,11 +71,11 @@ class SevenZipArchiver:
with py7zr.SevenZipFile(self.path, 'r') as zf:
data = zf.read(archive_file)[archive_file].read()
except py7zr.Bad7zFile as e:
print("bad zipfile [{0}]: {1} :: {2}".format(e, self.path,
print("bad 7zip file [{0}]: {1} :: {2}".format(e, self.path,
archive_file), file=sys.stderr)
raise IOError
except Exception as e:
print("bad zipfile [{0}]: {1} :: {2}".format(e, self.path,
print("bad 7zip file [{0}]: {1} :: {2}".format(e, self.path,
archive_file), file=sys.stderr)
raise IOError
@ -1153,10 +1153,7 @@ class ComicArchive:
data = self.getPage(idx)
if data is not None:
try:
if isinstance(data, bytes):
im = Image.open(io.BytesIO(data))
else:
im = Image.open(io.StringIO(data))
im = Image.open(io.StringIO(data))
w, h = im.size
p['ImageSize'] = str(len(data))

View File

@ -54,9 +54,7 @@ def calculate_rename(ca, md, settings):
new_ext = None # default
if settings.rename_extension_based_on_archive:
if ca.isSevenZip():
new_ext = ".cb7"
elif ca.isZip():
if ca.isZip():
new_ext = ".cbz"
elif ca.isRar():
new_ext = ".cbr"

View File

@ -51,7 +51,7 @@ def main():
for filename in filelist:
ca = ComicArchive(filename, settings.rar_exe_path)
if (ca.isSevenZip() or ca.isZip() or ca.isRar()) and ca.hasMetadata(style):
if (ca.isZip() or ca.isRar()) and ca.hasMetadata(style):
md = ca.readMetadata(style)
if len(md.pages) != 0:
for p in md.pages: