Compare commits

..

2 commits

Author SHA1 Message Date
xenofem 35bd4c5717 more debug 2024-03-23 02:19:11 -04:00
xenofem 15a9a77402 more bonus regex 2024-03-23 02:19:04 -04:00

View file

@ -54,7 +54,7 @@ TEXTLESS_REGEX = re.compile('(台詞|セリフ|せりふ|テキスト|文字)((
FXLESS_REGEX = re.compile('効果音(な|無)し', re.I)
FRONT_COVER_REGEX = re.compile('(?<!裏)表紙(?!裏)|(?<!back[-_ ])(?<!back)cover|(?<!ura[-_ ])(?<!ura)hyou?sh?i(?![-_ ]?ura)', re.I)
BACK_COVER_REGEX = re.compile('裏表紙|hyou?sh?i[-_ ]?ura|ura[-_ ]?hyou?sh?i', re.I)
BONUS_REGEX = re.compile('設定|キャラ|特典|ポスター', re.I)
BONUS_REGEX = re.compile('設定|キャラ|特典|ポスター|bonus', re.I)
EPILOGUE_REGEX = re.compile('after|後日談|おまけ', re.I)
SPLITS = [
{ 'later': TEXTLESS_REGEX },
@ -421,6 +421,8 @@ class Collator:
if len(srcs) == 0:
return True
debug(f'Auto-collating {srcs}')
select_language = self.try_collate_select_language(srcs)
if select_language is not False:
return select_language
@ -544,6 +546,8 @@ class Collator:
if len(non_images) != 0 or len(images) == 0:
return False
debug(f'Comparing PDF {inner_pdf} and images {images}')
pdf_sizes = pdf_image_sizes(inner_pdf)
standalone_sizes = [standalone_image_size(f) for f in images]
@ -552,6 +556,8 @@ class Collator:
if not (median_pdf_size and median_standalone_size):
return False
debug(f'PDF: {len(pdf_sizes)} images, {median_pdf_size}; standalone: {len(standalone_sizes)} images, median {median_standalone_size}')
if abs(len(pdf_sizes) - len(standalone_sizes)) > 2:
with fitz.open(inner_pdf) as pdf:
pdf_page_count = len(pdf)