From 5c07c471bf60d6f177048c9f8a7ecd4cbfb50e85 Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Sun, 20 Feb 2022 09:25:42 -0500 Subject: [PATCH] better overview --- scripts/clear_all_data.sh | 10 +++---- scripts/createdb.sh | 1 + scripts/daily_plot.py | 2 +- scripts/overview.php | 56 ++++++++++++++++++++------------------- scripts/viewdb.php | 6 ++--- 5 files changed, 37 insertions(+), 38 deletions(-) diff --git a/scripts/clear_all_data.sh b/scripts/clear_all_data.sh index d4f72c6..7c8498c 100755 --- a/scripts/clear_all_data.sh +++ b/scripts/clear_all_data.sh @@ -16,8 +16,6 @@ sudo rm -f $(dirname ${my_dir})/BirdDB.txt echo "Creating necessary directories" [ -d ${EXTRACTED} ] || sudo -u ${USER} mkdir -p ${EXTRACTED} [ -d ${EXTRACTED}/By_Date ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Date -[ -d ${EXTRACTED}/By_Common_Name ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Common_Name -[ -d ${EXTRACTED}/By_Scientific_Name ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Scientific_Name [ -d ${EXTRACTED}/Charts ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/Charts [ -d ${PROCESSED} ] || sudo -u ${USER} mkdir -p ${PROCESSED} @@ -70,8 +68,8 @@ sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME echo "Setting Wttr.in URL to "${LATITUDE}", "${LONGITUDE}"" sudo -u${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html -chmod -R g+rw $(dirname ${my_dir}) -chmod -R g+rw ${RECS_DIR} +sudo chmod -R g+rw $(dirname ${my_dir}) +sudo chmod -R g+rw ${RECS_DIR} echo "Generating BirdDB.txt" if ! [ -f $(dirname ${my_dir})/BirdDB.txt ];then @@ -81,10 +79,10 @@ elif ! grep Date $(dirname ${my_dir})/BirdDB.txt;then sudo -u ${USER} sed -i '1 i\Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap' $(dirname ${my_dir})/BirdDB.txt fi ln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt && - chown pi:pi ${my_dir}/BirdDB.txt && chmod g+rw ${my_dir}/BirdDB.txt +sudo chown pi:pi ${my_dir}/BirdDB.txt && sudo chmod g+rw ${my_dir}/BirdDB.txt echo "Dropping and re-creating database" -sudo /home/pi/BirdNET-Pi/scripts/createdb_bullseye.sh +sudo /home/pi/BirdNET-Pi/scripts/createdb.sh echo "Restarting services" sudo systemctl start birdnet_recording.service diff --git a/scripts/createdb.sh b/scripts/createdb.sh index 70145f3..bfeece3 100755 --- a/scripts/createdb.sh +++ b/scripts/createdb.sh @@ -8,6 +8,7 @@ # the DB, be sure to run this as root or with sudo source /etc/birdnet/birdnet.conf sqlite3 /home/pi/BirdNET-Pi/scripts/birds.db << EOF +DROP TABLE IF EXISTS detections; CREATE TABLE IF NOT EXISTS detections ( Date DATE, Time TIME, diff --git a/scripts/daily_plot.py b/scripts/daily_plot.py index 7632aed..096279b 100755 --- a/scripts/daily_plot.py +++ b/scripts/daily_plot.py @@ -153,7 +153,7 @@ heat_frame = pd.DataFrame(data=0, index=heat.index, columns = hours_in_day) heat=(heat+heat_frame).fillna(0) #Generatie heatmap plot -plot = sns.heatmap(heat, norm=LogNorm(), annot=True, annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[1], yticklabels = False) +plot = sns.heatmap(heat, norm=LogNorm(), annot=True, fmt="g", annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[1], yticklabels = False) plot.set_xticklabels(plot.get_xticklabels(), rotation = 0, size = 7) # Set heatmap border diff --git a/scripts/overview.php b/scripts/overview.php index d355d39..c8c62c9 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -47,6 +47,13 @@ a { text-decoration: none; color:black; } +table, th { + background-color: rgb(119, 196, 135); + border:none; +} +th { + padding: 0 5px; +} .center { display: block; margin-left: 5px; @@ -64,47 +71,42 @@ a { -

Overview

-
-
- - - - - - - - -
Most Recent Detection">" target="footer"/>More Info
+
-
- -
-
- +
- + - - -
Total Today Last HourSpecies Detected Today
Number of Detections
-
-
- - -
Species Detected Today
-
+
+ + + + + + + + + + + + + + + + +
Scientific NameCommon NameListenConfidence
Most Recent Detection">" target="footer"/>
+
"; diff --git a/scripts/viewdb.php b/scripts/viewdb.php index 7b51e51..6d8dd68 100644 --- a/scripts/viewdb.php +++ b/scripts/viewdb.php @@ -76,7 +76,6 @@ a { Scientific Name Common Name Confidence - Links fetchArray(SQLITE3_ASSOC)) @@ -87,10 +86,9 @@ $sciname = preg_replace('/ /', '_', $todaytable['Sci_Name']); ?> - - + + - All About Birds, Wikipedia