addocr()
{
local input="$1"
- local multi="$2"
+ local jobs="$2"
local output="$input-out"
+ jobs=${jobs:=1}
[ -n "$input" ] \
|| errlog "missing input" \
|| return $?
echo "ℹ️ INFO: adding ocr on file $input"
- if [ "$multi" == "true" ]; then
- ocrmypdf --quiet --jobs 1 --language deu $input $output \
- || errlog "could not add ocr on $input" \
+ ocrmypdf --quiet --jobs $(nproc) --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
export -f optimize
find . -name "scanned-$$-*.pdf" \
| sort \
- | parallel --keep-order addocr {} true
+ | parallel --keep-order addocr {} $(nproc)
local startcount=1
local endcount=1