![]() move ( full_path, full_path_archive ) logging. move ( full_path_OCR, full_path_OCR_archive ) shutil. chmod ( full_path, 0 o666 ) full_path_OCR_archive = sys. info ( result ) full_path_OCR = dir_name '/' filename_OCR os. # use this uid:gid in -u flag # rw rights for docker:docker at source dir are also necessary # the script is processed as root user via chron cmd = logging. ![]() find uid:gid of your diskstation docker:docker with id docker. strftime ( "%Y-%m- %d -%H%M_OCR_" ) filename_OCR = timestamp_OCR file_noext '.pdf' docker_mount = dir_name ':/home/docker' # create string for pdf processing # diskstation needs a user:group docker:docker. splitext ( filename ) timestamp_OCR = time. splitext ( filename ) if file_ext = '.pdf' : full_path = dir_name '/' filename file_noext = os. chdir ( dir_name ) for filename in file_list : file_ext = os. argv else : start_dir = '.' for dir_name, subdirs, file_list in os. INFO, format = ' %(asctime)s %(message)s ', filename = log_file, filemode = 'w' ) if len ( sys. strftime ( "%Y-%m- %d -%H%M_" ) log_file = script_dir '/' timestamp 'ocrmypdf.log' logging. move dir where *.pdf and *_OCR.pdf are moved to import logging import os import subprocess import sys import time import shutil script_dir = os. source dir with *.pdf - default is location of script # 2. ![]() #!/bin/env python3 # Contributed by /Enantiomerie # script needs 2 arguments # 1. We need the following things beforewe can start the backup: A Synology user account Restic installed on the local machine The username and password stored in the Gnome keyring using the secret-tool An initialized restic repository The repository password stored in the Gnome key ring The prerequisits are rather easy to setup. returncode = 0 : print ( "OCR complete" ) logging. returncode = 6 : print ( "Skipped document because it already contained text" ) elif proc. splitext ( filename ) if file_ext = '.pdf' : full_path = dir_name '/' filename print ( full_path ) cmd = logging. ![]() run the Docker image of OCRmyPDF if the Synology Docker package is installed. Connecting with a mac, but that should be the same for windows. INFO, format = ' %(asctime)s %(message)s ', filename = log_file, filemode = 'w' ) for dir_name, subdirs, file_list in os. This will walk through a directory tree and run OCR on all files in place. argv else : log_file = script_dir '/ocr-tree.log' logging. argv else : start_dir = '.' if len ( sys. realpath ( _file_ )) print ( script_dir '/ocr-tree.py: Start' ) if len ( sys. #!/usr/bin/env python3 # Walk through directory tree, replacing all files with OCR'd version # Contributed by import logging import os import subprocess import sys script_dir = os. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |