From: Bastian Dehn Date: Mon, 24 Nov 2025 18:30:31 +0000 (+0100) Subject: add ocr case multi thread or multi file X-Git-Tag: v1.1.3^2~11 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=35b85f1bdacd7805fe5d792f0ffb049de025f3fd;p=scantopdf.git add ocr case multi thread or multi file --- 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