From 94f265f1467df56735c2abe427f65bf95fb384f7 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Mon, 20 Feb 2023 18:36:42 -0500 Subject: [PATCH 1/5] inform user if lat/lon failed to be set upon install --- scripts/install_config.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/install_config.sh b/scripts/install_config.sh index d69e7d9..ae4c493 100755 --- a/scripts/install_config.sh +++ b/scripts/install_config.sh @@ -7,6 +7,20 @@ trap 'exit 1' SIGINT SIGHUP echo "Beginning $0" birdnet_conf=$my_dir/birdnet.conf +# Retrieve latitude and longitude from web +LATITUDE=$(curl -s4 ifconfig.co/json | jq .latitude) +LONGITUDE=$(curl -s4 ifconfig.co/json | jq .longitude) + +# Define regular expression pattern +pattern='^[+-]?[0-9]{2}\.[0-9]{4}$' + +# Check if latitude and longitude match the pattern +if ! [[ $LATITUDE =~ $pattern ]] || ! [[ $LONGITUDE =~ $pattern ]]; then + echo -e "\033[33mCouldn't set latitude and longitude automatically, you will need to do this manually from the web interface by navigating to Tools -> Settings -> Location.\033[0m" + LATITUDE=0.0000 + LONGITUDE=0.0000 +fi + install_config() { cat << EOF > $birdnet_conf ################################################################################ @@ -24,8 +38,8 @@ SITE_NAME="$HOSTNAME" ## Please only go to 4 decimal places. Example:43.3984 -LATITUDE=$(curl -s4 ifconfig.co/json | jq .latitude) -LONGITUDE=$(curl -s4 ifconfig.co/json | jq .longitude) +LATITUDE=$LATITUDE +LONGITUDE=$LONGITUDE #--------------------------------- Model --------------------------------------# #_____________The variable below configures which BirdNET model is_____________# From 5d58953e6823f89b74a6d9f7479a03ea2ec43c46 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 23 Feb 2023 18:42:21 -0500 Subject: [PATCH 2/5] change lat/lon api --- scripts/install_config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_config.sh b/scripts/install_config.sh index ae4c493..162b16d 100755 --- a/scripts/install_config.sh +++ b/scripts/install_config.sh @@ -8,8 +8,8 @@ echo "Beginning $0" birdnet_conf=$my_dir/birdnet.conf # Retrieve latitude and longitude from web -LATITUDE=$(curl -s4 ifconfig.co/json | jq .latitude) -LONGITUDE=$(curl -s4 ifconfig.co/json | jq .longitude) +LATITUDE=$(curl -s4 http://ip-api.com/json?fields=lat,lon | jq .lat) +LONGITUDE=$(curl -s4 http://ip-api.com/json?fields=lat,lon | jq .lon) # Define regular expression pattern pattern='^[+-]?[0-9]{2}\.[0-9]{4}$' From b0e2a1caa46360167aece1fcf3764f96283c697a Mon Sep 17 00:00:00 2001 From: bogey3 <29926385+bogey3@users.noreply.github.com> Date: Mon, 27 Feb 2023 13:27:30 -0500 Subject: [PATCH 3/5] Resolved division by 0 error that occurs in a weekly report for the first week of use where no previous data exists. --- scripts/weekly_report.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/weekly_report.php b/scripts/weekly_report.php index ccc2e5c..b28ef2e 100644 --- a/scripts/weekly_report.php +++ b/scripts/weekly_report.php @@ -100,15 +100,19 @@ if(isset($_GET['ascii'])) { $priorweekcount = $totalcount['COUNT(*)']; // really percent changed - $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 ); + if($priorweekcount > 0){ + $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 ); - if($percentagediff > 0) { - $percentagediff = "+".$percentagediff."%"; - } else { - $percentagediff = "-".abs($percentagediff)."%"; - } + if($percentagediff > 0) { + $percentagediff = "+".$percentagediff."%"; + } else { + $percentagediff = "-".abs($percentagediff)."%"; + } - echo $com_name." - ".$scount." (".$percentagediff.")
"; + echo $com_name." - ".$scount." (".$percentagediff.")
"; + } else { + echo $com_name." - ".$scount ."
"; + } } } From 50ae3bff805972eccd75766b4dca7aa046825427 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Tue, 28 Feb 2023 17:29:22 -0500 Subject: [PATCH 4/5] streamlit==1.11.1 --- requirements.txt | 4 ++-- scripts/update_birdnet_snippets.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9838280..54384b6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,9 +8,9 @@ pytz tzlocal pandas seaborn -streamlit +streamlit=1.11.1 plotly -apprise +apprise==1.2.1 paho-mqtt pytest==7.1.2 pytest-mock==3.7.0 diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index ab35e2c..e9c85dd 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -158,6 +158,7 @@ CREATE INDEX IF NOT EXISTS "detections_Date_Time" ON "detections" ("Date" DESC, EOF $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 >/dev/null +$HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.11.1 >/dev/null if ! grep -q 'RuntimeMaxSec=' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"&>/dev/null; then sudo -E sed -i '/\[Service\]/a RuntimeMaxSec=3600' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service" From a717b3875021cd83ba541a9da030c1fa29189253 Mon Sep 17 00:00:00 2001 From: Dr Barry Dyer Date: Wed, 1 Mar 2023 01:17:58 +0000 Subject: [PATCH 5/5] Update requirements.txt Fix streamlit version declaration with double = --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 54384b6..0096dc5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ pytz tzlocal pandas seaborn -streamlit=1.11.1 +streamlit==1.11.1 plotly apprise==1.2.1 paho-mqtt