mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-15 21:31:50 +02:00
Update changeidenfication.sh
This commit is contained in:
@@ -15,17 +15,6 @@ LABELS_FILE="$HOME/BirdNET-Pi/model/labels.txt"
|
|||||||
DB_FILE="$HOME/BirdNET-Pi/scripts/birds.db"
|
DB_FILE="$HOME/BirdNET-Pi/scripts/birds.db"
|
||||||
DETECTIONS_TABLE="detections"
|
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 #
|
# VALIDITY CHECKS #
|
||||||
###################
|
###################
|
||||||
@@ -59,6 +48,17 @@ if [[ -z "$OLDNAME_sciname" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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#*_}"
|
echo "This script will change the identification $OLDNAME from $OLDNAME_comname to ${NEWNAME#*_}"
|
||||||
|
|
||||||
########################
|
########################
|
||||||
|
|||||||
Reference in New Issue
Block a user