command -v exiftool > /dev/null \
|| errlog "command exiftool not found" \
|| return $?
+ command -v parallel > /dev/null \
+ || errlog "command parallel not found" \
+ || return $?
+ command -v find > /dev/null \
+ || errlog "command find not found" \
+ || return $?
}
optimize()
|| errlog "missing basename" \
|| return $?
- local pdf=
- local tiff=
- for tiff in scanned-$$-*.tiff; do
- pdf=${tiff/.tiff/.pdf}
- tiff2pdf $tiff -o $pdf \
- || errlog "could not convert $tiff to $pdf" \
- || return $?
- rm $tiff \
- || errlog "could not delete $tiff" \
- || return $?
- done
-
- local pdffile=
- for pdffile in scanned-$$-*.pdf; do
- addocr "$pdffile" \
- || return $?
- done
+ find scanned-$$-*.tiff | parallel tiff2pdf {} -o {.}.pdf
+ rm scanned-$$-*.tiff
+ export -f addocr
+ export -f optimize
+ find scanned-$$-*.pdf | parallel addocr {}
local startcount=1
local endcount=1
assert_line --index 0 "true"
}
-@test "should failure createmultipdfs tiff2pdf fails" {
- tiff2pdf() {
- return 1
- }
-
- run createmultipdfs
-
- assert_failure
-}
-
@test "should success createmutlipdfs" {
tiff2pdf() {
: