Compare commits
No commits in common. "21ad04f478d6c9ef4f7aaf579a7482650f992ffc" and "25e98489c0300dd14daef120e9e1cd28148e8dba" have entirely different histories.
21ad04f478
...
25e98489c0
|
@ -32,7 +32,7 @@ DLSITE_ID_REGEX = re.compile('^[BR]J[0-9]+$')
|
||||||
FANZA_ID_REGEX = re.compile('^d_[0-9]+$')
|
FANZA_ID_REGEX = re.compile('^d_[0-9]+$')
|
||||||
FAKKU_ID_REGEX = re.compile('.*_FAKKU$')
|
FAKKU_ID_REGEX = re.compile('.*_FAKKU$')
|
||||||
|
|
||||||
HI_RES_REGEX = re.compile('高解像度|原寸|大サイズ', re.I)
|
HI_RES_REGEX = re.compile('高解像度|原寸', re.I)
|
||||||
NO_TONE_REGEX = re.compile('トーン(効果)?[な無]し|グレースケール', re.I)
|
NO_TONE_REGEX = re.compile('トーン(効果)?[な無]し|グレースケール', re.I)
|
||||||
TONE_REGEX = re.compile('トーン(版|(効果)?[有あ]り)', re.I)
|
TONE_REGEX = re.compile('トーン(版|(効果)?[有あ]り)', re.I)
|
||||||
COLOR_REGEX = re.compile('カラー', re.I)
|
COLOR_REGEX = re.compile('カラー', re.I)
|
||||||
|
@ -42,7 +42,6 @@ IMAGE_QUALITY_REGEXES = [
|
||||||
{ 'better': NO_TONE_REGEX, 'worse': TONE_REGEX },
|
{ 'better': NO_TONE_REGEX, 'worse': TONE_REGEX },
|
||||||
{ 'better': COLOR_REGEX, 'worse': MONOCHROME_REGEX },
|
{ 'better': COLOR_REGEX, 'worse': MONOCHROME_REGEX },
|
||||||
]
|
]
|
||||||
IMAGE_RESOLUTION_REGEX = re.compile('^(?P<x>[0-9]+)x(?P<y>[0-9]+)$')
|
|
||||||
|
|
||||||
LANGUAGE_REGEXES = {
|
LANGUAGE_REGEXES = {
|
||||||
'en_US': re.compile('english|英語', re.I),
|
'en_US': re.compile('english|英語', re.I),
|
||||||
|
@ -442,25 +441,20 @@ class Collator:
|
||||||
if select_language is not False:
|
if select_language is not False:
|
||||||
return select_language
|
return select_language
|
||||||
|
|
||||||
dirs = [src for src in srcs if src.is_dir()]
|
if len(srcs) == 2 and all(src.is_dir() for src in srcs):
|
||||||
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)):
|
|
||||||
resolution_matches = [IMAGE_RESOLUTION_REGEX.match(nname(src)) for src in dirs]
|
|
||||||
if all(resolution_matches):
|
|
||||||
pairs = [(int(m.group('x')), int(m.group('y'))) for m in resolution_matches]
|
|
||||||
for i in range(2):
|
|
||||||
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)
|
|
||||||
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:
|
||||||
return quality[a].search(nname(src))
|
return quality[a].search(nname(src))
|
||||||
else:
|
else:
|
||||||
return not quality[b].search(nname(src))
|
return not quality[b].search(nname(src))
|
||||||
better_dirs = [src for src in dirs if a_not_b('better', 'worse', src)]
|
better_srcs = [src for src in srcs if a_not_b('better', 'worse', src)]
|
||||||
worse_dirs = [src for src in dirs if a_not_b('worse', 'better', src)]
|
worse_srcs = [src for src in srcs if a_not_b('worse', 'better', src)]
|
||||||
if len(better_dirs) == 1 and len(worse_dirs) == 1 and better_dirs[0] != worse_dirs[0]:
|
if len(better_srcs) == 1 and len(worse_srcs) == 1 and better_srcs[0] != worse_srcs[0]:
|
||||||
return self.collate_from_paths(better_dirs + non_dirs)
|
better = better_srcs[0]
|
||||||
|
worse = worse_srcs[0]
|
||||||
|
if len(descendant_files_ignore(better, self.exclude)) == len(descendant_files_ignore(worse, self.exclude)):
|
||||||
|
return self.collate_from_paths([better])
|
||||||
|
|
||||||
images_vs_pdf = self.try_collate_images_vs_pdf(srcs)
|
images_vs_pdf = self.try_collate_images_vs_pdf(srcs)
|
||||||
if images_vs_pdf is not False:
|
if images_vs_pdf is not False:
|
||||||
|
|
Loading…
Reference in a new issue