From 9c2d0626d5f235cbe5a69329cc049b1316dc2e0c Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 23 Jan 2023 22:13:35 -0800 Subject: [PATCH] add logging of completed files --- scanner_workflow.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scanner_workflow.py b/scanner_workflow.py index 96346be..b281dba 100755 --- a/scanner_workflow.py +++ b/scanner_workflow.py @@ -85,17 +85,18 @@ class ScannerWorkflow: def process_pdf(self, pdf_file: Union[Path, str]): """Process a single PDF.""" pdf_file = Path(pdf_file) + orig_pdf = pdf_file # move to the processing directory pdf_file = pdf_file.rename( self.process_dir / self.calculate_name(pdf_file.name) ) - res = subprocess.run( - ["ocrmypdf", *self.ocrmypdf_opts, pdf_file, self.output_dir / pdf_file.name] - ) + output_file = self.output_dir / pdf_file.name + res = subprocess.run(["ocrmypdf", *self.ocrmypdf_opts, pdf_file, output_file]) if res.returncode != 0: error(f"Unable to properly OCR pdf: {res.stdout} {res.stderr}") return pdf_file.unlink() + info("Processed {orig_pdf} into {output_file}") def event_loop(self): """Main event loop; called from the command line.""" -- 2.39.2