recognize back covers as well as front covers

This commit is contained in:
xenofem 2024-02-08 05:11:17 -05:00
parent f5f338f386
commit 83c5e128d6

View file

@ -29,7 +29,8 @@ FAKKU_ID_REGEX = re.compile('.*_FAKKU$')
TEXTLESS_REGEX = re.compile('(台詞|セリフ|せりふ|テキスト|文字)((な|無)し|抜き)|notext|textless', re.IGNORECASE) TEXTLESS_REGEX = re.compile('(台詞|セリフ|せりふ|テキスト|文字)((な|無)し|抜き)|notext|textless', re.IGNORECASE)
EPILOGUE_REGEX = re.compile('after|後日談', re.IGNORECASE) EPILOGUE_REGEX = re.compile('after|後日談', re.IGNORECASE)
HI_RES_REGEX = re.compile('高解像度', re.IGNORECASE) HI_RES_REGEX = re.compile('高解像度', re.IGNORECASE)
COVER_REGEX = re.compile('表紙|cover|hyoushi', re.IGNORECASE) FRONT_COVER_REGEX = re.compile('(^|[^裏])表紙|cover|hyoushi', re.IGNORECASE)
BACK_COVER_REGEX = re.compile('裏表紙', re.IGNORECASE)
ALT_VERSIONS = [ ALT_VERSIONS = [
'褐色', '褐色',
'日焼け', '日焼け',
@ -525,14 +526,14 @@ def collate_from_paths(srcs, dest, start_index, exclude):
if textless_split != False: if textless_split != False:
return textless_split return textless_split
cover_split = try_collate_split_regex(srcs, dest, start_index, exclude, earlier=FRONT_COVER_REGEX, later=BACK_COVER_REGEX)
if cover_split != False:
return cover_split
epilogue_split = try_collate_split_regex(srcs, dest, start_index, exclude, later=EPILOGUE_REGEX) epilogue_split = try_collate_split_regex(srcs, dest, start_index, exclude, later=EPILOGUE_REGEX)
if epilogue_split != False: if epilogue_split != False:
return epilogue_split return epilogue_split
cover_split = try_collate_split_regex(srcs, dest, start_index, exclude, earlier=COVER_REGEX)
if cover_split != False:
return cover_split
if all(src.is_file() and is_image(src) for src in srcs): if all(src.is_file() and is_image(src) for src in srcs):
ordering = complete_prefix_number_ordering(srcs) ordering = complete_prefix_number_ordering(srcs)
if ordering: if ordering: