aboutsummaryrefslogtreecommitdiffstats
path: root/hm/soispha/pkgs/scripts
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-12-30 20:05:37 +0100
committerSoispha <soispha@vhack.eu>2023-12-30 20:05:37 +0100
commitb9c9e06856ebfeb7971ce5c5023cc6460e6044ea (patch)
tree88407b0aa0c5ccec71cb0ae94c718d3181ab14e8 /hm/soispha/pkgs/scripts
parentfix(hm/pkgs/con2pdf): Correctly sort and clear inputs (diff)
downloadnixos-config-b9c9e06856ebfeb7971ce5c5023cc6460e6044ea.zip
fix(hm/pkgs/con2pdf): Don't reassing `name` variable as it's global
Diffstat (limited to 'hm/soispha/pkgs/scripts')
-rw-r--r--hm/soispha/pkgs/scripts/apps/con2pdf16
1 files changed, 8 insertions, 8 deletions
diff --git a/hm/soispha/pkgs/scripts/apps/con2pdf b/hm/soispha/pkgs/scripts/apps/con2pdf
index 56ed613f..b4d88712 100644
--- a/hm/soispha/pkgs/scripts/apps/con2pdf
+++ b/hm/soispha/pkgs/scripts/apps/con2pdf
@@ -90,7 +90,7 @@ process_images_adf() {
if [ "$counter" = "$number_of_pages" ]; then
dbg "$counter == $number_of_pages"
counter=0;
- convert_images_flatbed "$image_cache" "${name}_$pdf_counter" "$output_directory"
+ convert_images "$image_cache" "${name}_$pdf_counter" "$output_directory"
: $((pdf_counter += 1))
printf "" > "$image_cache"
fi
@@ -123,14 +123,14 @@ process_images_flatbed() {
: $((counter += 1))
if [ "$counter" = "$number_of_pages" ]; then
counter=0;
- convert_images_flatbed "$image_cache" "$name" "$output_directory"
+ convert_images "$image_cache" "$name" "$output_directory"
printf "" > "$image_cache"
fi
done < "$(tmp_pipe fd . "$tiff_temp_path" "|" sort -V)"
}
-convert_images_flatbed() {
+convert_images() {
image_cache="$1";
- name="$2";
+ pdf_name="$2";
output_dir="$3";
set --
@@ -139,11 +139,11 @@ convert_images_flatbed() {
set -- "$@" "$image"
done < "$image_cache"
- while [ -e "$output_dir/${name}.pdf" ]; do
- name="${name}_$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 25)"
+ while [ -e "$output_dir/${pdf_name}.pdf" ]; do
+ pdf_name="${pdf_name}_$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 25)"
done
- dbg "using name: $name";
- convert "$@" -compress jpeg -quality 100 "$output_dir/${name}.pdf"
+ dbg "using pdf_name: $pdf_name";
+ convert "$@" -compress jpeg -quality 100 "$output_dir/${pdf_name}.pdf"
}
scan() {