From 98dad294a1c2cd5b34857eb54959e293dbfd6836 Mon Sep 17 00:00:00 2001 From: "sh+git@codevoid.de" Date: Sat, 26 Oct 2019 14:45:50 +0000 Subject: [PATCH] Delete unused code --- mkpicindex-static.sh | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/mkpicindex-static.sh b/mkpicindex-static.sh index a108deb..9addbae 100755 --- a/mkpicindex-static.sh +++ b/mkpicindex-static.sh @@ -32,7 +32,7 @@ mkdir -p "$THUMB_PATH" debug() { [ "$DEBUG" == "1" ] && printf '%s\n' "Debug: $1" >&2; } console() { printf '%s\n' "$1" >&2; } -# CALCULATORS +# CALCULATE BY ASPECT RATIO get_width_by_height() { # returns aspect ratio calculated width local F="$1" # image file @@ -42,27 +42,14 @@ get_width_by_height() { printf '%.0f' "$R" debug "get_width_by_height: FILE=$F TARGET_HEIGHT=$TH FILE_WxH=$WH RET_WIDTH=$R" } -get_height_by_width() { - # returns aspect ratio calculated height - local F=$1 # image file - local TW=$2 # target width - local WH="$(identify -format ' %w %h ' "$1" | awk '{ printf("%.3f %.3f",$1,$2) }')" - local R="$(printf "$WH" | awk -vTW=$TW '{ printf("%.0f", TW*($2/$1)) }')" - printf '%.0f' "$R" - debug "get_height_by_width: FILE=$F TARGET_WIDTH=$TW FILE_WxH=$WH RET_HEIGHT=$R" -} - +# TOO MANY CONVERT PROCSSES => WAIT bg_check() { while [ $(pgrep convert | wc -l | awk '{ print $1 }') -gt 4 ]; - do debug "Too many Threads, sleeping."; sleep 2; done + do console "More than 4 convert threads. Waiting..."; sleep 2; done } # CREATE THUMBNAIL create_thumb() { - # $F - original - # $W - width - # $H - height - # $R - thumbnailpath local F="$1" # original local W="$2" # width local H="$3" # height @@ -89,7 +76,6 @@ create_thumb() { # ADD IMAGE LOOP add_image() { local F="$1" # image file - # How wide would the image be when we rescale it to $ROW_HEIGHT? local NW=$(get_width_by_height "$F" "$ROW_HEIGHT") debug "add_image: FILE=$F NW=${NW}x$ROW_HEIGHT"