more debug info

This commit is contained in:
xenofem 2024-06-08 06:40:17 -04:00
parent c26300d752
commit 8e32c7cbca

View file

@ -531,6 +531,7 @@ class Collator:
return split_attempt return split_attempt
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):
debug('Attempting to detect ordering for image files')
ordering = complete_prefix_number_ordering(srcs) ordering = complete_prefix_number_ordering(srcs)
if not ordering and self.args.sort: if not ordering and self.args.sort:
ordering = srcs.copy() ordering = srcs.copy()
@ -542,6 +543,11 @@ class Collator:
else: else:
return None return None
debug('Unable to collate available file types:')
debug(f'Images: {[src for src in srcs if src.is_file() and is_image(src)]}')
debug(f'PDFs: {[src for src in srcs if src.is_file() and is_pdf(src)]}')
debug(f'Directories: {[src for src in srcs if src.is_dir()]}')
debug(f'Unknown files: {[src for src in srcs if src.is_file() and not is_image(src) and not is_pdf(src)]}')
return None return None
def link_pdf(self, src): def link_pdf(self, src):
@ -590,6 +596,8 @@ class Collator:
if sum(1 for l in [early_srcs, middle_srcs, late_srcs] if l) <= 1: if sum(1 for l in [early_srcs, middle_srcs, late_srcs] if l) <= 1:
return False return False
debug(f'Splitting sources based on regex: {[early_srcs, middle_srcs, late_srcs]}')
early_page_collation = self.collate_from_paths(early_srcs) early_page_collation = self.collate_from_paths(early_srcs)
if early_page_collation is None: if early_page_collation is None:
return None return None
@ -671,6 +679,7 @@ class Collator:
if not all(any(lang.search(nname(src)) for lang in LANGUAGE_REGEXES.values()) for src in srcs): if not all(any(lang.search(nname(src)) for lang in LANGUAGE_REGEXES.values()) for src in srcs):
return False return False
debug('Detected multiple language options, selecting preferred language')
srcs_matching_language = [src for src in srcs if LANGUAGE_REGEXES[self.args.locale].search(nname(src))] srcs_matching_language = [src for src in srcs if LANGUAGE_REGEXES[self.args.locale].search(nname(src))]
if len(srcs_matching_language) == len(srcs) or len(srcs_matching_language) == 0: if len(srcs_matching_language) == len(srcs) or len(srcs_matching_language) == 0:
return False return False