Merge branch 'mcguirepr89:main' into main

This commit is contained in:
lloydbayley
2023-03-01 22:38:35 +11:00
committed by GitHub
4 changed files with 30 additions and 11 deletions
+2 -2
View File
@@ -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
+16 -2
View File
@@ -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 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}$'
# 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_____________#
+1
View File
@@ -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"
+11 -7
View File
@@ -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 = "<span style='color:green;font-size:small'>+".$percentagediff."%</span>";
} else {
$percentagediff = "<span style='color:red;font-size:small'>-".abs($percentagediff)."%</span>";
}
if($percentagediff > 0) {
$percentagediff = "<span style='color:green;font-size:small'>+".$percentagediff."%</span>";
} else {
$percentagediff = "<span style='color:red;font-size:small'>-".abs($percentagediff)."%</span>";
}
echo $com_name." - ".$scount." (".$percentagediff.")<br>";
echo $com_name." - ".$scount." (".$percentagediff.")<br>";
} else {
echo $com_name." - ".$scount ."<br>";
}
}
}