Bugfix for comicapi
This commit is contained in:
parent
6261981656
commit
e9fb5d9f25
13
cps/comic.py
13
cps/comic.py
|
@ -41,11 +41,13 @@ def extractCover(tmp_file_name, original_file_extension):
|
||||||
if use_comic_meta:
|
if use_comic_meta:
|
||||||
archive = ComicArchive(tmp_file_name)
|
archive = ComicArchive(tmp_file_name)
|
||||||
cover_data = None
|
cover_data = None
|
||||||
ext = os.path.splitext(archive.getPageName(0))
|
for index, name in enumerate(archive.getPageNameList()):
|
||||||
|
ext = os.path.splitext(name)
|
||||||
if len(ext) > 1:
|
if len(ext) > 1:
|
||||||
extension = ext[1].lower()
|
extension = ext[1].lower()
|
||||||
if extension == '.jpg' or extension == '.jpeg':
|
if extension == '.jpg' or extension == '.jpeg':
|
||||||
cover_data = archive.getPage(0)
|
cover_data = archive.getPage(index)
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
if original_file_extension.upper() == '.CBZ':
|
if original_file_extension.upper() == '.CBZ':
|
||||||
cf = zipfile.ZipFile(tmp_file_name)
|
cf = zipfile.ZipFile(tmp_file_name)
|
||||||
|
@ -53,7 +55,7 @@ def extractCover(tmp_file_name, original_file_extension):
|
||||||
ext = os.path.splitext(name)
|
ext = os.path.splitext(name)
|
||||||
if len(ext) > 1:
|
if len(ext) > 1:
|
||||||
extension = ext[1].lower()
|
extension = ext[1].lower()
|
||||||
if extension == '.jpg':
|
if extension == '.jpg' or extension == '.jpeg':
|
||||||
cover_data = cf.read(name)
|
cover_data = cf.read(name)
|
||||||
break
|
break
|
||||||
elif original_file_extension.upper() == '.CBT':
|
elif original_file_extension.upper() == '.CBT':
|
||||||
|
@ -62,7 +64,7 @@ def extractCover(tmp_file_name, original_file_extension):
|
||||||
ext = os.path.splitext(name)
|
ext = os.path.splitext(name)
|
||||||
if len(ext) > 1:
|
if len(ext) > 1:
|
||||||
extension = ext[1].lower()
|
extension = ext[1].lower()
|
||||||
if extension == '.jpg':
|
if extension == '.jpg' or extension == '.jpeg':
|
||||||
cover_data = cf.extractfile(name).read()
|
cover_data = cf.extractfile(name).read()
|
||||||
break
|
break
|
||||||
prefix = os.path.dirname(tmp_file_name)
|
prefix = os.path.dirname(tmp_file_name)
|
||||||
|
@ -87,10 +89,11 @@ def get_comic_info(tmp_file_path, original_file_name, original_file_extension):
|
||||||
else:
|
else:
|
||||||
style = None
|
style = None
|
||||||
|
|
||||||
if style is not None:
|
# if style is not None:
|
||||||
loadedMetadata = archive.readMetadata(style)
|
loadedMetadata = archive.readMetadata(style)
|
||||||
|
|
||||||
lang = loadedMetadata.language
|
lang = loadedMetadata.language
|
||||||
|
if lang:
|
||||||
if len(lang) == 2:
|
if len(lang) == 2:
|
||||||
loadedMetadata.language = isoLanguages.get(part1=lang).name
|
loadedMetadata.language = isoLanguages.get(part1=lang).name
|
||||||
elif len(lang) == 3:
|
elif len(lang) == 3:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user