From 83c5e128d6c8224aead40a44d4e9dc35144e53be Mon Sep 17 00:00:00 2001 From: xenofem Date: Thu, 8 Feb 2024 05:11:17 -0500 Subject: [PATCH] recognize back covers as well as front covers --- dlibrary/dlibrary.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 1a7824d..4c9b210 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -29,7 +29,8 @@ FAKKU_ID_REGEX = re.compile('.*_FAKKU$') TEXTLESS_REGEX = re.compile('(台詞|セリフ|せりふ|テキスト|文字)((な|無)し|抜き)|notext|textless', re.IGNORECASE) EPILOGUE_REGEX = re.compile('after|後日談', 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 = [ '褐色', '日焼け', @@ -525,14 +526,14 @@ def collate_from_paths(srcs, dest, start_index, exclude): if textless_split != False: 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) if epilogue_split != False: 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): ordering = complete_prefix_number_ordering(srcs) if ordering: