From: Edward Delaporte Date: Tue, 24 Feb 2026 02:52:10 +0000 (-0600) Subject: Skip already processed files X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/commitdiff_plain/d08a9f3b8d9754ddb33a3306558239a9dfa0abd9?ds=sidebyside Skip already processed files --- diff --git a/files/ocr/ocr.py b/files/ocr/ocr.py index 795a83b..61a69ba 100644 --- a/files/ocr/ocr.py +++ b/files/ocr/ocr.py @@ -27,9 +27,12 @@ def ocr_directory(input_dir): input_path = os.path.join(root, file_name) output_path = os.path.join(root, file_name.replace('.', '_ocr.')) - # Perform OCR on the image - text = ocr_image(ocr, input_path) - + text = None + if os.path.exists(output_path): + print(f'{output_path} exists.') + else: + # Perform OCR on the image + text = ocr_image(ocr, input_path) if text: # Write the OCR result to a JSON file json_output_path = output_path.rsplit('.', 1)[0] + '.json'