Display page numbers in log messages when grafting

This commit is contained in:
James R. Barlow
2020-09-17 01:20:50 -07:00
parent 306a903854
commit 67553fc5c6
2 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ class OcrGrafter:
text_rotation = autorotate_correction text_rotation = autorotate_correction
text_misaligned = (text_rotation - content_rotation) % 360 text_misaligned = (text_rotation - content_rotation) % 360
log.debug( log.debug(
f"Rotations for page {pageno}: [text, auto, misalign, content] = " f"Rotations for page: [text, auto, misalign, content] = "
f"{text_rotation}, {autorotate_correction}, " f"{text_rotation}, {autorotate_correction}, "
f"{text_misaligned}, {content_rotation}" f"{text_misaligned}, {content_rotation}"
) )
+13 -9
View File
@@ -252,15 +252,19 @@ def exec_concurrent(context: PdfContext):
ocrgraft = OcrGrafter(context) ocrgraft = OcrGrafter(context)
def update_page(result: PageResult, pbar): def update_page(result: PageResult, pbar):
sidecars[result.pageno] = result.text try:
pbar.update() tls.pageno = result.pageno + 1
ocrgraft.graft_page( sidecars[result.pageno] = result.text
pageno=result.pageno, pbar.update()
image=result.pdf_page_from_image, ocrgraft.graft_page(
textpdf=result.ocr, pageno=result.pageno,
autorotate_correction=result.orientation_correction, image=result.pdf_page_from_image,
) textpdf=result.ocr,
pbar.update() autorotate_correction=result.orientation_correction,
)
pbar.update()
finally:
tls.pageno = None
exec_progress_pool( exec_progress_pool(
use_threads=context.options.use_threads, use_threads=context.options.use_threads,