more debug, more regex

This commit is contained in:
xenofem 2024-04-01 23:11:28 -04:00
parent 3b1e212055
commit 50c394f33f

View file

@ -52,7 +52,7 @@ LANGUAGE_REGEXES = {
'ko_KR': re.compile('한국어', re.I), 'ko_KR': re.compile('한국어', re.I),
} }
TEXTLESS_REGEX = re.compile('(台詞|セリフ|せりふ|テキスト|文字)((な|無)し|抜き)|notext|textless', re.I) TEXTLESS_REGEX = re.compile('(台詞|セリフ|せりふ|テキスト|文字|文章)((な|無)し|抜き)|notext|textless', re.I)
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)
@ -453,12 +453,15 @@ class Collator:
dirs = [src for src in srcs if src.is_dir()] dirs = [src for src in srcs if src.is_dir()]
non_dirs = [src for src in srcs if not src.is_dir()] non_dirs = [src for src in srcs if not src.is_dir()]
if len(dirs) == 2 and len(descendant_files_ignore(dirs[0], self.exclude)) == len(descendant_files_ignore(dirs[1], self.exclude)): if len(dirs) == 2 and len(descendant_files_ignore(dirs[0], self.exclude)) == len(descendant_files_ignore(dirs[1], self.exclude)):
debug(f'Checking for image quality references between dirs {dirs[0]} and {dirs[1]}')
resolution_matches = [IMAGE_RESOLUTION_REGEX.match(nname(src)) for src in dirs] resolution_matches = [IMAGE_RESOLUTION_REGEX.match(nname(src)) for src in dirs]
if all(resolution_matches): if all(resolution_matches):
debug(f'Directory names are resolutions')
pairs = [(int(m.group('x')), int(m.group('y'))) for m in resolution_matches] pairs = [(int(m.group('x')), int(m.group('y'))) for m in resolution_matches]
for i in range(2): for i in range(2):
if pairs[i][0] > pairs[1-i][0] and pairs[i][1] > pairs[1-i][1]: if pairs[i][0] > pairs[1-i][0] and pairs[i][1] > pairs[1-i][1]:
return self.collate_from_paths([dirs[i]] + non_dirs) return self.collate_from_paths([dirs[i]] + non_dirs)
debug(f'Checking image quality regexes')
for quality in IMAGE_QUALITY_REGEXES: for quality in IMAGE_QUALITY_REGEXES:
def a_not_b(a, b, src): def a_not_b(a, b, src):
if a in quality: if a in quality: