more debug

This commit is contained in:
xenofem 2024-03-23 02:19:11 -04:00
parent 15a9a77402
commit 35bd4c5717

View file

@ -421,6 +421,8 @@ class Collator:
if len(srcs) == 0: if len(srcs) == 0:
return True return True
debug(f'Auto-collating {srcs}')
select_language = self.try_collate_select_language(srcs) select_language = self.try_collate_select_language(srcs)
if select_language is not False: if select_language is not False:
return select_language return select_language
@ -544,6 +546,8 @@ class Collator:
if len(non_images) != 0 or len(images) == 0: if len(non_images) != 0 or len(images) == 0:
return False return False
debug(f'Comparing PDF {inner_pdf} and images {images}')
pdf_sizes = pdf_image_sizes(inner_pdf) pdf_sizes = pdf_image_sizes(inner_pdf)
standalone_sizes = [standalone_image_size(f) for f in images] standalone_sizes = [standalone_image_size(f) for f in images]
@ -552,6 +556,8 @@ class Collator:
if not (median_pdf_size and median_standalone_size): if not (median_pdf_size and median_standalone_size):
return False return False
debug(f'PDF: {len(pdf_sizes)} images, {median_pdf_size}; standalone: {len(standalone_sizes)} images, median {median_standalone_size}')
if abs(len(pdf_sizes) - len(standalone_sizes)) > 2: if abs(len(pdf_sizes) - len(standalone_sizes)) > 2:
with fitz.open(inner_pdf) as pdf: with fitz.open(inner_pdf) as pdf:
pdf_page_count = len(pdf) pdf_page_count = len(pdf)