Skip to content

A live bird collage card for your Home Assistant dashboard.

allow non "." locale decimal

Patrick McGuire82f3d4cda7f5
diff --git a/scripts/extract_new_birdsounds.sh b/scripts/extract_new_birdsounds.sh
index ce9729ef..9b62f070 100755
--- a/scripts/extract_new_birdsounds.sh
+++ b/scripts/extract_new_birdsounds.sh
@@ -64,7 +64,12 @@ for h in "${SCAN_DIRS[@]}";do
| awk -F\; '{print $5}')""
#CONFIDENCE_SCORE="${CONFIDENCE:0:2}%"
+ locale_decimal=$(locale decimal_point)
+ if [[ $locale_decimal == "." ]]; then
CONFIDENCE_SCORE="$(printf %.0f "$(echo "scale=2; ${CONFIDENCE} * 100" | bc)")"
+ else
+ CONFIDENCE_SCORE="$(printf %.0f "$(echo "scale=2; ${CONFIDENCE//./,} * 100" | bc)")"
+ fi
NEWFILE="${COMMON_NAME// /_}-${CONFIDENCE_SCORE}-${OLDFILE//.wav/.${AUDIOFMT}}"
echo "NEWFILE=$NEWFILE"
NEWSPECIES_BYDATE="${EXTRACTED}/By_Date/${DATE}/${COMMON_NAME// /_}"