From efa56c179cffc786ec6a0299739e27bbd3452592 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Thu, 30 May 2024 12:14:09 +0200 Subject: [PATCH] Updated --- birdnet-pi/CHANGELOG.md | 1 + birdnet-pi/README.md | 4 +- birdnet-pi/config.json | 3 +- .../rootfs/etc/cont-init.d/71-newfeatures.sh | 47 +++++++------------ 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/birdnet-pi/CHANGELOG.md b/birdnet-pi/CHANGELOG.md index 18eab90f1..41992da3c 100644 --- a/birdnet-pi/CHANGELOG.md +++ b/birdnet-pi/CHANGELOG.md @@ -1,5 +1,6 @@ - Add weekly report button to views - Use optional iframe for Adminer +- Enable species converter by default (only active if used) ## 0.13-46 (23-05-2024) - Security : enable double layer basic auth with caddy in addition to php when connecting without ingress diff --git a/birdnet-pi/README.md b/birdnet-pi/README.md index 727d534f3..12a05ae78 100644 --- a/birdnet-pi/README.md +++ b/birdnet-pi/README.md @@ -114,11 +114,11 @@ Example : https://www.amazon.fr/HUAREW-Valeurs-Ferrite-Suppresseur-Diam%C3%A8tre ### Microphone comparison -Recommended microphones ([full discussion here](https://github.com/mcguirepr89/BirdNET-Pi/discussions/39)): +Recommended microphones ([full discussion here](https://github.com/mcguirepr89/BirdNET-Pi/discussions/39)): - Clippy EM272 (https://www.veldshop.nl/en/smart-clippy-em272z1-mono-omni-microphone.html) + ugreen aux to usb connector - Boya By-LM40 -Conclusion, using mic from Dahua is good enough, but Boya by-lm40 is more optimal for range as birndet model analysis the 150-15000Hz range +Conclusion, using mic from Dahua is good enough, EM272 is optimal, but Boya by-lm40 is a very good compromise as birndet model analysis the 150-15000Hz range ![image](https://github.com/alexbelgium/hassio-addons/assets/44178713/df992b79-7171-4f73-b0c0-55eb4256cd5b) diff --git a/birdnet-pi/config.json b/birdnet-pi/config.json index 9c83b2aab..514a60076 100644 --- a/birdnet-pi/config.json +++ b/birdnet-pi/config.json @@ -94,7 +94,6 @@ "schema": { "BIRDSONGS_FOLDER": "str?", "BIRDS_ONLINE_INFO": "list(allaboutbirds.org|ebird.org)", - "SPECIES_CONVERTER": "bool?", "TZ": "str?", "certfile": "str", "cifsdomain": "str?", @@ -111,6 +110,6 @@ "udev": true, "url": "https://github.com/alexbelgium/hassio-addons/tree/master/birdnet-pi", "usb": true, - "version": "0.13-46", + "version": "0.13-47", "video": true } 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 315ae5ecc..a3006f679 100755 --- a/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh +++ b/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh @@ -10,6 +10,7 @@ echo " " bashio::log.info "Adding new features" # Set the online birds info system +################################## if [[ "$(bashio::config "BIRDS_ONLINE_INFO")" == *"ebird"* ]]; then echo "... using ebird instead of allaboutbirds" # Set ebird database @@ -36,26 +37,26 @@ else sed -i "s|https://allaboutbirds.org/guide/\$comname|https://allaboutbirds.org/guide/\$comnameen|g" "$HOME"/BirdNET-Pi/scripts/stats.php fi -# Add birds change option -if [ ! -f /home/pi/BirdNET-Pi/scripts/birdnet_changeidentification.sh ]; then - echo "... adding option to change detected birds" - # Clean previous files - rm /home/pi/BirdNET-Pi/scripts/play.php - rm /home/pi/BirdNET-Pi/homepage/style.css - # Download new files - curl -s -o /home/pi/BirdNET-Pi/homepage/images/bird.svg https://raw.githubusercontent.com/alexbelgium/BirdNET-Pi/patch-1/homepage/images/bird.svg - curl -s -o /home/pi/BirdNET-Pi/scripts/birdnet_changeidentification.sh https://raw.githubusercontent.com/alexbelgium/BirdNET-Pi/patch-1/scripts/birdnet_changeidentification.sh - curl -s -o /home/pi/BirdNET-Pi/scripts/play.php https://raw.githubusercontent.com/alexbelgium/BirdNET-Pi/patch-1/scripts/play.php - curl -s -o /home/pi/BirdNET-Pi/homepage/style.css https://raw.githubusercontent.com/alexbelgium/BirdNET-Pi/patch-1/homepage/style.css - # Correct permissions - chmod 777 /home/pi/BirdNET-Pi/scripts/birdnet_changeidentification.sh - chmod 777 /home/pi/BirdNET-Pi/scripts/play.php - chmod 777 /home/pi/BirdNET-Pi/homepage/style.css +# Convert Adminer to iframe +############################### +if ! grep "iframe src=\'scripts/adminer.php" "$HOME"/BirdNET-Pi/homepage/views.php; then + sed -i '/scripts\/adminer.php\\/c\ ' "$HOME"/BirdNET-Pi/homepage/views.php + sed -i "/advanced.php/a\ if(\$_GET\['view'\] == \"Adminer\"){echo \"\";}" "$HOME"/BirdNET-Pi/homepage/views.php + sed -i "s|deny|SameOrigin|g" "$HOME"/BirdNET-Pi/scripts/adminer.php + sed -i "1a echo 'Open in new page';" "$HOME"/BirdNET-Pi/scripts/adminer.php +fi + +# Add weekly report button +############################### +if ! grep -q "Weekly Report" "$HOME"/BirdNET-Pi/homepage/views.php; then + sed -i "67a\ " "$HOME"/BirdNET-Pi/homepage/views.php fi # Add species conversion system -if bashio::config.true "SPECIES_CONVERTER"; then - bashio::log.yellow "... adding feature of SPECIES_CONVERTER, a new tab is added to your Tools" +############################### + +if ! grep -q "Converted" "$HOME"/BirdNET-Pi/homepage/views.php; 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/ @@ -116,16 +117,4 @@ if bashio::config.true "SPECIES_CONVERTER"; then fi fi -# Convert Adminer to iframe -if ! grep "iframe src=\'scripts/adminer.php" "$HOME"/BirdNET-Pi/homepage/views.php; then - sed -i '/scripts\/adminer.php\/c\ ' "$HOME"/BirdNET-Pi/homepage/views.php - #sed -i "/if\(\$_GET\['view'\] == \"Webterm\"\){/i test" "$HOME"/BirdNET-Pi/homepage/views.php - sed -i "s|deny|SameOrigin|g" "$HOME"/BirdNET-Pi/scripts/adminer.php -fi - -# Add weekly report button -if ! grep -q "Weekly Report" "$HOME"/BirdNET-Pi/homepage/views.php; then - sed -i "67a\ " "$HOME"/BirdNET-Pi/homepage/views.php -fi - echo " "