From 0db6b6e333f4027560b6436fafe069fca8878779 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Mon, 24 Nov 2025 19:59:49 +0100 Subject: [PATCH] change one pdf tiff to pdf convert --- src/scanbasic.sh | 15 ++++----------- tests/scanbasic.bats | 14 +++----------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/scanbasic.sh b/src/scanbasic.sh index e4a9250..f72daef 100644 --- a/src/scanbasic.sh +++ b/src/scanbasic.sh @@ -103,17 +103,10 @@ createonepdf() || errlog "missing output" \ || return $? - local output_pdf= - local tiff= - for tiff in scanned-$$-*.tiff; do - output_pdf=${tiff/.tiff/.pdf} - tiff2pdf $tiff -o $output_pdf \ - || errlog "could not convert tiff to pdf" \ - || return $? - rm $tiff \ - || errlog "could not delete $tiff" \ - || return $? - done + export -f convert_tiff_to_pdf + find scanned-$$-*.tiff \ + | sort \ + | parallel convert_tiff_to_pdf {} pdftk scanned-$$-*.pdf output $output \ || errlog "could not convert into single $output" \ diff --git a/tests/scanbasic.bats b/tests/scanbasic.bats index 31a4c81..41e383e 100755 --- a/tests/scanbasic.bats +++ b/tests/scanbasic.bats @@ -90,17 +90,6 @@ setup() { assert_line --index 0 "❌ ERROR: missing output" } -@test "should failure createonepdf tiff2pdf fails" { - tiff2pdf() { - return 1 - } - - run createonepdf "testfile" - - assert_failure - assert_line --index 0 "❌ ERROR: could not convert tiff to pdf" -} - @test "should failure createonepdf pdftk fails" { tiff2pdf() { : @@ -108,6 +97,9 @@ setup() { rm() { : } + find() { + : + } pdftk() { return 1 } -- 2.47.3