From 09502cdcf55eff6b7d2aa44eb7e31c906e637bc1 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 3 May 2024 10:32:44 +0200 Subject: [PATCH] Update changeidenfication.sh --- .../rootfs/helpers/changeidenfication.sh | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/birdnet-pi/rootfs/helpers/changeidenfication.sh b/birdnet-pi/rootfs/helpers/changeidenfication.sh index 3f40b4252..68a6a5109 100755 --- a/birdnet-pi/rootfs/helpers/changeidenfication.sh +++ b/birdnet-pi/rootfs/helpers/changeidenfication.sh @@ -15,17 +15,6 @@ LABELS_FILE="$HOME/BirdNET-Pi/model/labels.txt" DB_FILE="$HOME/BirdNET-Pi/scripts/birds.db" DETECTIONS_TABLE="detections" -# Extract the part before the _ from $NEWNAME -NEWNAME_comname="${NEWNAME#*_}" -NEWNAME_sciname="${NEWNAME%%_*}" - -# Replace spaces with underscores -NEWNAME_comname2="${NEWNAME_comname// /_}" -OLDNAME_comname2="${OLDNAME_comname// /_}" - -# Replace OLDNAME_comname2 with NEWNAME_comname2 in OLDNAME -NEWNAME_filename="${OLDNAME//$OLDNAME_comname2/$NEWNAME_comname2}" - ################### # VALIDITY CHECKS # ################### @@ -59,6 +48,17 @@ if [[ -z "$OLDNAME_sciname" ]]; then exit 1 fi +# Extract the part before the _ from $NEWNAME +NEWNAME_comname="${NEWNAME#*_}" +NEWNAME_sciname="${NEWNAME%%_*}" + +# Replace spaces with underscores +NEWNAME_comname2="${NEWNAME_comname// /_}" +OLDNAME_comname2="${OLDNAME_comname// /_}" + +# Replace OLDNAME_comname2 with NEWNAME_comname2 in OLDNAME +NEWNAME_filename="${OLDNAME//$OLDNAME_comname2/$NEWNAME_comname2}" + echo "This script will change the identification $OLDNAME from $OLDNAME_comname to ${NEWNAME#*_}" ########################