Compare commits
2 commits
952e512afd
...
35bd4c5717
Author | SHA1 | Date | |
---|---|---|---|
xenofem | 35bd4c5717 | ||
xenofem | 15a9a77402 |
|
@ -54,7 +54,7 @@ TEXTLESS_REGEX = re.compile('(台詞|セリフ|せりふ|テキスト|文字)((
|
||||||
FXLESS_REGEX = re.compile('効果音(な|無)し', re.I)
|
FXLESS_REGEX = re.compile('効果音(な|無)し', re.I)
|
||||||
FRONT_COVER_REGEX = re.compile('(?<!裏)表紙(?!裏)|(?<!back[-_ ])(?<!back)cover|(?<!ura[-_ ])(?<!ura)hyou?sh?i(?![-_ ]?ura)', 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)
|
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)
|
EPILOGUE_REGEX = re.compile('after|後日談|おまけ', re.I)
|
||||||
SPLITS = [
|
SPLITS = [
|
||||||
{ 'later': TEXTLESS_REGEX },
|
{ 'later': TEXTLESS_REGEX },
|
||||||
|
@ -421,6 +421,8 @@ class Collator:
|
||||||
if len(srcs) == 0:
|
if len(srcs) == 0:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
debug(f'Auto-collating {srcs}')
|
||||||
|
|
||||||
select_language = self.try_collate_select_language(srcs)
|
select_language = self.try_collate_select_language(srcs)
|
||||||
if select_language is not False:
|
if select_language is not False:
|
||||||
return select_language
|
return select_language
|
||||||
|
@ -544,6 +546,8 @@ class Collator:
|
||||||
if len(non_images) != 0 or len(images) == 0:
|
if len(non_images) != 0 or len(images) == 0:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
debug(f'Comparing PDF {inner_pdf} and images {images}')
|
||||||
|
|
||||||
pdf_sizes = pdf_image_sizes(inner_pdf)
|
pdf_sizes = pdf_image_sizes(inner_pdf)
|
||||||
standalone_sizes = [standalone_image_size(f) for f in images]
|
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):
|
if not (median_pdf_size and median_standalone_size):
|
||||||
return False
|
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:
|
if abs(len(pdf_sizes) - len(standalone_sizes)) > 2:
|
||||||
with fitz.open(inner_pdf) as pdf:
|
with fitz.open(inner_pdf) as pdf:
|
||||||
pdf_page_count = len(pdf)
|
pdf_page_count = len(pdf)
|
||||||
|
|
Loading…
Reference in a new issue