]> git.donarmstrong.com Git - scanner_workflow.git/commitdiff
add logging of completed files
authorDon Armstrong <don@donarmstrong.com>
Tue, 24 Jan 2023 06:13:35 +0000 (22:13 -0800)
committerDon Armstrong <don@donarmstrong.com>
Tue, 24 Jan 2023 06:13:45 +0000 (22:13 -0800)
scanner_workflow.py

index 96346be86c859bdd4f51997d751dc9b3995fa940..b281dba7b7bdb55154eb05c95a83b6886e7fc0cd 100755 (executable)
@@ -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."""