From 8e32c7cbca44aad2fc5676ffa1bd4d447b88ae77 Mon Sep 17 00:00:00 2001 From: xenofem Date: Sat, 8 Jun 2024 06:40:17 -0400 Subject: [PATCH] more debug info --- dlibrary/dlibrary.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 386230b..cb6cb0e 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -531,6 +531,7 @@ class Collator: return split_attempt 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) if not ordering and self.args.sort: ordering = srcs.copy() @@ -542,6 +543,11 @@ class Collator: else: 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 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: return False + debug(f'Splitting sources based on regex: {[early_srcs, middle_srcs, late_srcs]}') + early_page_collation = self.collate_from_paths(early_srcs) if early_page_collation is 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): 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))] if len(srcs_matching_language) == len(srcs) or len(srcs_matching_language) == 0: return False