From 343c9a57ecba8e8435bb6adbe379eb4f9dad0642 Mon Sep 17 00:00:00 2001
From: Alexandre <44178713+alexbelgium@users.noreply.github.com>
Date: Tue, 30 Jul 2024 13:11:45 +0200
Subject: [PATCH] Remove SPECIES_CONVERTER_ENABLED
---
battybirdnet-pi/README.md | 1 -
battybirdnet-pi/config.json | 1 -
.../rootfs/etc/cont-init.d/71-newfeatures.sh | 64 -------------------
birdnet-pi/CHANGELOG.md | 4 +-
birdnet-pi/README.md | 1 -
birdnet-pi/config.json | 1 -
.../rootfs/etc/cont-init.d/71-newfeatures.sh | 64 -------------------
7 files changed, 3 insertions(+), 133 deletions(-)
diff --git a/battybirdnet-pi/README.md b/battybirdnet-pi/README.md
index 0df63f407..1c8f8e9a6 100644
--- a/battybirdnet-pi/README.md
+++ b/battybirdnet-pi/README.md
@@ -57,7 +57,6 @@ Options can be configured through three ways :
BIRDSONGS_FOLDER: folder to store birdsongs file # It should be an ssd if you want to avoid clogging of analysis
MQTT_DISABLED : if true, disables automatic mqtt publishing. Only valid if there is a local broker already available
LIVESTREAM_BOOT_ENABLED: start livestream from boot, or from settings
-SPECIES_CONVERTER_ENABLED: true/false. if enabled, will create a new setting in the birdnet options where you can specify birds to convert. It will convert on the fly the specie when detected
PROCESSED_FOLDER_ENABLED : if enabled, you need to set in the birdnet.conf (or the setting of birdnet) the number of last wav files that will be saved in the temporary folder "/tmp/Processed" within the tmpfs (so no disk wear) in case you want to retrieve them. This amount can be adapted from the addon options
TZ: Etc/UTC specify a timezone to use, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
pi_password: set the user password to access the web terminal
diff --git a/battybirdnet-pi/config.json b/battybirdnet-pi/config.json
index 653a5c643..fe7d02f78 100644
--- a/battybirdnet-pi/config.json
+++ b/battybirdnet-pi/config.json
@@ -100,7 +100,6 @@
"MQTT_PORT_manual": "int?",
"MQTT_USER_manual": "str?",
"PROCESSED_FOLDER_ENABLED": "bool?",
- "SPECIES_CONVERTER_ENABLED": "bool?",
"TZ": "str?",
"certfile": "str",
"cifsdomain": "str?",
diff --git a/battybirdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh b/battybirdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
index 96398d9cf..b4fbae83a 100755
--- a/battybirdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
+++ b/battybirdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
@@ -15,70 +15,6 @@ bashio::log.info "Adding optional features"
# sed -i "s|ar 48000|ar 48000 -af afftdn=nr=30:nt=w:om=o|g" "$HOME"/BirdNET-Pi/scripts/birdnet_recording.sh
#fi
-# Add species conversion system
-###############################
-if bashio::config.true "SPECIES_CONVERTER_ENABLED"; then
- echo "... adding feature of SPECIES_CONVERTER, a new tab is added to your Tools"
- touch /config/convert_species_list.txt
- chown pi:pi /config/convert_species_list.txt
- sudo -u pi ln -fs /config/convert_species_list.txt "$HOME"/BirdNET-Pi/
- sudo -u pi ln -fs /config/convert_species_list.txt "$HOME"/BirdNET-Pi/scripts/
- # Not useful
- sed -i "/exclude_species_list.txt/a sudo -u pi ln -fs /config/convert_species_list.txt $HOME/BirdNET-Pi/scripts/" "$HOME"/BirdNET-Pi/scripts/clear_all_data.sh
- sed -i "/exclude_species_list.txt/a sudo -u pi ln -fs /config/convert_species_list.txt $HOME/BirdNET-Pi/scripts/" "$HOME"/BirdNET-Pi/scripts/install_services.sh
- # Modify views.php if not already done
- if ! grep -q "Converted" "$HOME"/BirdNET-Pi/homepage/views.php; then
- # Add button
- # shellcheck disable=SC2016
- sed -i '/Excluded Species List/a\ ' "$HOME"/BirdNET-Pi/homepage/views.php
- # Flag to indicate whether we've found the target line
- found_target=false
- # Read the original file line by line
- while IFS= read -r line; do
- if [[ $line == *"if(\$_GET['view'] == \"File\"){"* ]]; then
- found_target=true
- fi
- if $found_target; then
- echo "$line" >> "$HOME"/BirdNET-Pi/homepage/views.php.temp
- fi
- done < "$HOME"/BirdNET-Pi/homepage/views.php
- # Remove the extracted lines from the original file
- # shellcheck disable=SC2016
- sed -i '/if(\$_GET\['\''view'\''\] == "File"){/,$d' "$HOME"/BirdNET-Pi/homepage/views.php
- # Add new text
- cat "/helpers/views.add" >> "$HOME"/BirdNET-Pi/homepage/views.php
- cat "$HOME"/BirdNET-Pi/homepage/views.php.temp >> "$HOME"/BirdNET-Pi/homepage/views.php
- # Clean up: Remove the temporary file
- rm "$HOME"/BirdNET-Pi/homepage/views.php.temp
- fi
-
- # Add the converter script
- if [ ! -f "$HOME"/BirdNET-Pi/scripts/convert_list.php ]; then
- mv -f /helpers/convert_list.php "$HOME"/BirdNET-Pi/scripts/convert_list.php
- chown pi:pi "$HOME"/BirdNET-Pi/scripts/convert_list.php
- chmod 664 "$HOME"/BirdNET-Pi/scripts/convert_list.php
- fi
-
- # Change server
- if ! grep -q "converted_entry" "$HOME"/BirdNET-Pi/scripts/server.py; then
- sed -i "/INTERPRETER, M_INTERPRETER, INCLUDE_LIST, EXCLUDE_LIST/c INTERPRETER, M_INTERPRETER, INCLUDE_LIST, EXCLUDE_LIST, CONVERT_LIST = (None, None, None, None, None)" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/global INCLUDE_LIST, EXCLUDE_LIST/c\ global INCLUDE_LIST, EXCLUDE_LIST, CONVERT_LIST, CONVERT_DICT" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/exclude_species_list.txt/a\ CONVERT_DICT = {row.split(';')[0]: row.split(';')[1] for row in CONVERT_LIST}" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/exclude_species_list.txt/a\ CONVERT_LIST = loadCustomSpeciesList(os.path.expanduser(\"~/BirdNET-Pi/convert_species_list.txt\"))" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "s|entry\[0\]|converted_entry|g" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "s|if converted_entry in|if entry\[0\] in|g" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ converted_entry = entry[0]" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ else :" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ log.info('WARNING : ' + entry[0] + ' converted to ' + converted_entry)" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ converted_entry = CONVERT_DICT.get(entry[0], entry[0])" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ if entry[0] in CONVERT_DICT:" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ if entry[1] >= conf.getfloat('CONFIDENCE'):" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/converted_entry in INCLUDE_LIST or len(INCLUDE_LIST)/c\ if ((converted_entry in INCLUDE_LIST or len(INCLUDE_LIST) == 0)" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "s| d = Detection| d = Detection|g" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "s| confident_detections| confident_detections|g" "$HOME"/BirdNET-Pi/scripts/server.py
- fi
-fi || true
-
# Enable the Processed folder
#############################
diff --git a/birdnet-pi/CHANGELOG.md b/birdnet-pi/CHANGELOG.md
index 9122f723a..3ee0816c3 100644
--- a/birdnet-pi/CHANGELOG.md
+++ b/birdnet-pi/CHANGELOG.md
@@ -1,3 +1,5 @@
+- REMOVE : SPECIES_CONVERTER_ENABLED option removed, please instead us "exclude species" and "change detection"
+
## 0.13-71 (14-07-2024)
- [FEAT] : Add manual MQTT options
@@ -5,7 +7,7 @@
- [FEAT] : limit a specific number of audio samples per species
## 0.13-68 (10-07-2024)
-- [FIX] : correct mqtt posting, switch to service
+- [FIX] : correct mqtt posting, switch to service
## 0.13-65 (08-07-2024)
- [FEAT] : publish mqtt to homeassistant if a server is found
diff --git a/birdnet-pi/README.md b/birdnet-pi/README.md
index 7ce979b4c..90b49aaa7 100644
--- a/birdnet-pi/README.md
+++ b/birdnet-pi/README.md
@@ -57,7 +57,6 @@ Options can be configured through three ways :
BIRDSONGS_FOLDER: folder to store birdsongs file # It should be an ssd if you want to avoid clogging of analysis
MQTT_DISABLED : if true, disables automatic mqtt publishing. Only valid if there is a local broker already available
LIVESTREAM_BOOT_ENABLED: start livestream from boot, or from settings
-SPECIES_CONVERTER_ENABLED: true/false. if enabled, will create a new setting in the birdnet options where you can specify birds to convert. It will convert on the fly the specie when detected
PROCESSED_FOLDER_ENABLED : if enabled, you need to set in the birdnet.conf (or the setting of birdnet) the number of last wav files that will be saved in the temporary folder "/tmp/Processed" within the tmpfs (so no disk wear) in case you want to retrieve them. This amount can be adapted from the addon options
TZ: Etc/UTC specify a timezone to use, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
pi_password: set the user password to access the web terminal
diff --git a/birdnet-pi/config.json b/birdnet-pi/config.json
index fe26972ec..6531c950e 100644
--- a/birdnet-pi/config.json
+++ b/birdnet-pi/config.json
@@ -101,7 +101,6 @@
"MQTT_PORT_manual": "int?",
"MQTT_USER_manual": "str?",
"PROCESSED_FOLDER_ENABLED": "bool?",
- "SPECIES_CONVERTER_ENABLED": "bool?",
"TZ": "str?",
"certfile": "str",
"cifsdomain": "str?",
diff --git a/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh b/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
index 96398d9cf..b4fbae83a 100755
--- a/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
+++ b/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
@@ -15,70 +15,6 @@ bashio::log.info "Adding optional features"
# sed -i "s|ar 48000|ar 48000 -af afftdn=nr=30:nt=w:om=o|g" "$HOME"/BirdNET-Pi/scripts/birdnet_recording.sh
#fi
-# Add species conversion system
-###############################
-if bashio::config.true "SPECIES_CONVERTER_ENABLED"; then
- echo "... adding feature of SPECIES_CONVERTER, a new tab is added to your Tools"
- touch /config/convert_species_list.txt
- chown pi:pi /config/convert_species_list.txt
- sudo -u pi ln -fs /config/convert_species_list.txt "$HOME"/BirdNET-Pi/
- sudo -u pi ln -fs /config/convert_species_list.txt "$HOME"/BirdNET-Pi/scripts/
- # Not useful
- sed -i "/exclude_species_list.txt/a sudo -u pi ln -fs /config/convert_species_list.txt $HOME/BirdNET-Pi/scripts/" "$HOME"/BirdNET-Pi/scripts/clear_all_data.sh
- sed -i "/exclude_species_list.txt/a sudo -u pi ln -fs /config/convert_species_list.txt $HOME/BirdNET-Pi/scripts/" "$HOME"/BirdNET-Pi/scripts/install_services.sh
- # Modify views.php if not already done
- if ! grep -q "Converted" "$HOME"/BirdNET-Pi/homepage/views.php; then
- # Add button
- # shellcheck disable=SC2016
- sed -i '/Excluded Species List/a\ ' "$HOME"/BirdNET-Pi/homepage/views.php
- # Flag to indicate whether we've found the target line
- found_target=false
- # Read the original file line by line
- while IFS= read -r line; do
- if [[ $line == *"if(\$_GET['view'] == \"File\"){"* ]]; then
- found_target=true
- fi
- if $found_target; then
- echo "$line" >> "$HOME"/BirdNET-Pi/homepage/views.php.temp
- fi
- done < "$HOME"/BirdNET-Pi/homepage/views.php
- # Remove the extracted lines from the original file
- # shellcheck disable=SC2016
- sed -i '/if(\$_GET\['\''view'\''\] == "File"){/,$d' "$HOME"/BirdNET-Pi/homepage/views.php
- # Add new text
- cat "/helpers/views.add" >> "$HOME"/BirdNET-Pi/homepage/views.php
- cat "$HOME"/BirdNET-Pi/homepage/views.php.temp >> "$HOME"/BirdNET-Pi/homepage/views.php
- # Clean up: Remove the temporary file
- rm "$HOME"/BirdNET-Pi/homepage/views.php.temp
- fi
-
- # Add the converter script
- if [ ! -f "$HOME"/BirdNET-Pi/scripts/convert_list.php ]; then
- mv -f /helpers/convert_list.php "$HOME"/BirdNET-Pi/scripts/convert_list.php
- chown pi:pi "$HOME"/BirdNET-Pi/scripts/convert_list.php
- chmod 664 "$HOME"/BirdNET-Pi/scripts/convert_list.php
- fi
-
- # Change server
- if ! grep -q "converted_entry" "$HOME"/BirdNET-Pi/scripts/server.py; then
- sed -i "/INTERPRETER, M_INTERPRETER, INCLUDE_LIST, EXCLUDE_LIST/c INTERPRETER, M_INTERPRETER, INCLUDE_LIST, EXCLUDE_LIST, CONVERT_LIST = (None, None, None, None, None)" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/global INCLUDE_LIST, EXCLUDE_LIST/c\ global INCLUDE_LIST, EXCLUDE_LIST, CONVERT_LIST, CONVERT_DICT" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/exclude_species_list.txt/a\ CONVERT_DICT = {row.split(';')[0]: row.split(';')[1] for row in CONVERT_LIST}" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/exclude_species_list.txt/a\ CONVERT_LIST = loadCustomSpeciesList(os.path.expanduser(\"~/BirdNET-Pi/convert_species_list.txt\"))" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "s|entry\[0\]|converted_entry|g" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "s|if converted_entry in|if entry\[0\] in|g" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ converted_entry = entry[0]" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ else :" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ log.info('WARNING : ' + entry[0] + ' converted to ' + converted_entry)" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ converted_entry = CONVERT_DICT.get(entry[0], entry[0])" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ if entry[0] in CONVERT_DICT:" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/for entry in entries/a\ if entry[1] >= conf.getfloat('CONFIDENCE'):" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "/converted_entry in INCLUDE_LIST or len(INCLUDE_LIST)/c\ if ((converted_entry in INCLUDE_LIST or len(INCLUDE_LIST) == 0)" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "s| d = Detection| d = Detection|g" "$HOME"/BirdNET-Pi/scripts/server.py
- sed -i "s| confident_detections| confident_detections|g" "$HOME"/BirdNET-Pi/scripts/server.py
- fi
-fi || true
-
# Enable the Processed folder
#############################