mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Remove SPECIES_CONVERTER_ENABLED
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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?",
|
||||
|
||||
@@ -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\ <button type=\\"submit\\" name=\\"view\\" value=\\"Converted\\" form=\\"views\\">Converted Species List</button>' "$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
|
||||
#############################
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?",
|
||||
|
||||
@@ -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\ <button type=\\"submit\\" name=\\"view\\" value=\\"Converted\\" form=\\"views\\">Converted Species List</button>' "$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
|
||||
#############################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user