|
|
@ -74,10 +74,10 @@ def _cover_processing(tmp_file_name, img, extension):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _extractCover(tmp_file_name, original_file_extension, rarExceutable):
|
|
|
|
def _extractCover(tmp_file_name, original_file_extension, rarExecutable):
|
|
|
|
cover_data = extension = None
|
|
|
|
cover_data = extension = None
|
|
|
|
if use_comic_meta:
|
|
|
|
if use_comic_meta:
|
|
|
|
archive = ComicArchive(tmp_file_name)
|
|
|
|
archive = ComicArchive(tmp_file_name, rar_exe_path=rarExecutable)
|
|
|
|
for index, name in enumerate(archive.getPageNameList()):
|
|
|
|
for index, name in enumerate(archive.getPageNameList()):
|
|
|
|
ext = os.path.splitext(name)
|
|
|
|
ext = os.path.splitext(name)
|
|
|
|
if len(ext) > 1:
|
|
|
|
if len(ext) > 1:
|
|
|
@ -106,7 +106,7 @@ def _extractCover(tmp_file_name, original_file_extension, rarExceutable):
|
|
|
|
break
|
|
|
|
break
|
|
|
|
elif original_file_extension.upper() == '.CBR' and use_rarfile:
|
|
|
|
elif original_file_extension.upper() == '.CBR' and use_rarfile:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
rarfile.UNRAR_TOOL = rarExceutable
|
|
|
|
rarfile.UNRAR_TOOL = rarExecutable
|
|
|
|
cf = rarfile.RarFile(tmp_file_name)
|
|
|
|
cf = rarfile.RarFile(tmp_file_name)
|
|
|
|
for name in cf.getnames():
|
|
|
|
for name in cf.getnames():
|
|
|
|
ext = os.path.splitext(name)
|
|
|
|
ext = os.path.splitext(name)
|
|
|
@ -120,9 +120,9 @@ def _extractCover(tmp_file_name, original_file_extension, rarExceutable):
|
|
|
|
return _cover_processing(tmp_file_name, cover_data, extension)
|
|
|
|
return _cover_processing(tmp_file_name, cover_data, extension)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_comic_info(tmp_file_path, original_file_name, original_file_extension, rarExceutable):
|
|
|
|
def get_comic_info(tmp_file_path, original_file_name, original_file_extension, rarExecutable):
|
|
|
|
if use_comic_meta:
|
|
|
|
if use_comic_meta:
|
|
|
|
archive = ComicArchive(tmp_file_path, rar_exe_path=rarExceutable)
|
|
|
|
archive = ComicArchive(tmp_file_path, rar_exe_path=rarExecutable)
|
|
|
|
if archive.seemsToBeAComicArchive():
|
|
|
|
if archive.seemsToBeAComicArchive():
|
|
|
|
if archive.hasMetadata(MetaDataStyle.CIX):
|
|
|
|
if archive.hasMetadata(MetaDataStyle.CIX):
|
|
|
|
style = MetaDataStyle.CIX
|
|
|
|
style = MetaDataStyle.CIX
|
|
|
@ -148,7 +148,7 @@ def get_comic_info(tmp_file_path, original_file_name, original_file_extension, r
|
|
|
|
extension=original_file_extension,
|
|
|
|
extension=original_file_extension,
|
|
|
|
title=loadedMetadata.title or original_file_name,
|
|
|
|
title=loadedMetadata.title or original_file_name,
|
|
|
|
author=" & ".join([credit["person"] for credit in loadedMetadata.credits if credit["role"] == "Writer"]) or u'Unknown',
|
|
|
|
author=" & ".join([credit["person"] for credit in loadedMetadata.credits if credit["role"] == "Writer"]) or u'Unknown',
|
|
|
|
cover=_extractCover(tmp_file_path, original_file_extension, rarExceutable),
|
|
|
|
cover=_extractCover(tmp_file_path, original_file_extension, rarExecutable),
|
|
|
|
description=loadedMetadata.comments or "",
|
|
|
|
description=loadedMetadata.comments or "",
|
|
|
|
tags="",
|
|
|
|
tags="",
|
|
|
|
series=loadedMetadata.series or "",
|
|
|
|
series=loadedMetadata.series or "",
|
|
|
@ -160,7 +160,7 @@ def get_comic_info(tmp_file_path, original_file_name, original_file_extension, r
|
|
|
|
extension=original_file_extension,
|
|
|
|
extension=original_file_extension,
|
|
|
|
title=original_file_name,
|
|
|
|
title=original_file_name,
|
|
|
|
author=u'Unknown',
|
|
|
|
author=u'Unknown',
|
|
|
|
cover=_extractCover(tmp_file_path, original_file_extension, rarExceutable),
|
|
|
|
cover=_extractCover(tmp_file_path, original_file_extension, rarExecutable),
|
|
|
|
description="",
|
|
|
|
description="",
|
|
|
|
tags="",
|
|
|
|
tags="",
|
|
|
|
series="",
|
|
|
|
series="",
|
|
|
|