From 35b85f1bdacd7805fe5d792f0ffb049de025f3fd Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Mon, 24 Nov 2025 19:30:31 +0100 Subject: [PATCH] add ocr case multi thread or multi file --- src/scanbasic.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/scanbasic.sh b/src/scanbasic.sh index ff20f80..4cf9e44 100644 --- a/src/scanbasic.sh +++ b/src/scanbasic.sh @@ -59,6 +59,7 @@ optimize() addocr() { local input="$1" + local multi="$2" local output="$input-out" [ -n "$input" ] \ @@ -66,9 +67,15 @@ addocr() || return $? echo "ℹ️ INFO: adding ocr on file $input" - ocrmypdf --quiet --jobs 1 --language deu $input $output \ - || errlog "could not add ocr on $input" \ - || return $? + if [ "$multi" == "true" ]; then + ocrmypdf --quiet --jobs 1 --language deu $input $output \ + || errlog "could not add ocr on $input" \ + || return $? + else + ocrmypdf --quiet --jobs $(nproc) --language deu $input $output \ + || errlog "could not add ocr on $input" \ + || return $? + fi [ ! -f $output ] && return 0 @@ -146,7 +153,7 @@ createpdf() detectsplit() { - local pdf=$1 + local pdf="$1" local trenn= [ -n "$pdf" ] \ @@ -178,7 +185,7 @@ createmultipdfs() export -f optimize find . -name "scanned-$$-*.pdf" \ | sort \ - | parallel --keep-order addocr {} + | parallel --keep-order addocr {} true local startcount=1 local endcount=1 -- 2.47.3