From fe6561374c0831739564651b5bafc95a35a9fb27 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 3 Oct 2021 17:43:43 -0400 Subject: [PATCH] adding new php scripts --- scripts/extract_new_birdsounds.sh | 12 +++++------- scripts/index.html | 23 ++++++++++++++++++++--- scripts/reboot_system.php | 4 ++++ scripts/reboot_system.sh | 2 ++ scripts/restart_birdnet.sh | 20 +++++++++++++++++--- scripts/restart_birdnet_analysis.php | 4 ++++ scripts/restart_birdnet_analysis.sh | 3 +++ scripts/restart_birdnet_recording.php | 4 ++++ scripts/restart_birdnet_recording.sh | 3 +++ scripts/restart_caddy.php | 4 ++++ scripts/restart_caddy.sh | 3 +++ scripts/restart_extraction.php | 4 ++++ scripts/restart_extraction.sh | 3 +++ 13 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 scripts/reboot_system.php create mode 100755 scripts/reboot_system.sh create mode 100644 scripts/restart_birdnet_analysis.php create mode 100755 scripts/restart_birdnet_analysis.sh create mode 100644 scripts/restart_birdnet_recording.php create mode 100755 scripts/restart_birdnet_recording.sh create mode 100644 scripts/restart_caddy.php create mode 100755 scripts/restart_caddy.sh create mode 100644 scripts/restart_extraction.php create mode 100755 scripts/restart_extraction.sh diff --git a/scripts/extract_new_birdsounds.sh b/scripts/extract_new_birdsounds.sh index fee138e..a7ff429 100755 --- a/scripts/extract_new_birdsounds.sh +++ b/scripts/extract_new_birdsounds.sh @@ -128,16 +128,14 @@ for h in "${SCAN_DIRS[@]}";do # directory. ### TESTING longer extraction context - set -x [ -z ${EXTRACTION_LENGTH} ] && EXTRACTION_LENGTH=6 - SPACER=$(echo "(${EXTRACTION_LENGTH} - 3 )/2" |bc -l) - START=$(echo "${START} - ${SPACER}"|bc -l) - END=$(echo "${END} + ${SPACER}"|bc -l) + SPACER=$(echo "scale=1;(${EXTRACTION_LENGTH} - 3 )/2" |bc -l) + START=$(echo "scale=1;${START} - ${SPACER}"|bc -l) + END=$(echo "scale=1;${END} + ${SPACER}"|bc -l) - if (( $(echo "${START} < 0" | bc -l) ));then START=0;fi - if (( $(echo "${END} > ${RECORDING_LENGTH}" | bc -l) ));then END=${RECORDING_LENGTH};fi + if (( $(echo "scale=1;${START} < 1" | bc -l) ));then START=0;fi + if (( $(echo "scale=1;${END} > ${RECORDING_LENGTH}" | bc -l) ));then END=${RECORDING_LENGTH};fi - set +x ffmpeg -hide_banner -loglevel error -nostdin -i "${h}/${OLDFILE}" \ -acodec copy -ss "${START}" -to "${END}"\ "${NEWSPECIES_BYDATE}/${a}-${NEWFILE}" diff --git a/scripts/index.html b/scripts/index.html index 269ab83..0e158b2 100644 --- a/scripts/index.html +++ b/scripts/index.html @@ -1,7 +1,24 @@
- +
-
- + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ diff --git a/scripts/reboot_system.php b/scripts/reboot_system.php new file mode 100644 index 0000000..2e385ad --- /dev/null +++ b/scripts/reboot_system.php @@ -0,0 +1,4 @@ + diff --git a/scripts/reboot_system.sh b/scripts/reboot_system.sh new file mode 100755 index 0000000..e45727e --- /dev/null +++ b/scripts/reboot_system.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +sudo reboot diff --git a/scripts/restart_birdnet.sh b/scripts/restart_birdnet.sh index cfc43a2..e42cf34 100755 --- a/scripts/restart_birdnet.sh +++ b/scripts/restart_birdnet.sh @@ -1,9 +1,23 @@ #!/usr/bin/env bash -# Restart services +# Restarts ALL services and removes ALL unprocessed audio source /etc/birdnet/birdnet.conf sudo systemctl stop birdnet_recording.service sudo rm -rf ${RECS_DIR}/$(date +%B-%Y/%d-%A)/* sudo systemctl start birdnet_recording.service -sudo systemctl restart extraction.timer -sudo systemctl restart birdnet_analysis.service + +SERVICES=(avahi-alias@birdlog.local.service +avahi-alias@birdnetsystem.local.service +avahi-alias@birdstats.local.service +avahi-alias@extractionlog.local.service +birdnet_analysis.service +birdnet_log.service +birdstats.service +extraction.timer +extractionlog.service +livestream.service) + +for i in "${SERVICES[@]}";do + sudo systemctl restart ${i} +done + diff --git a/scripts/restart_birdnet_analysis.php b/scripts/restart_birdnet_analysis.php new file mode 100644 index 0000000..2c050a1 --- /dev/null +++ b/scripts/restart_birdnet_analysis.php @@ -0,0 +1,4 @@ + diff --git a/scripts/restart_birdnet_analysis.sh b/scripts/restart_birdnet_analysis.sh new file mode 100755 index 0000000..c40b3e8 --- /dev/null +++ b/scripts/restart_birdnet_analysis.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Restars the main BirdNET analysis service +sudo systemctl restart birdnet_analysis.service diff --git a/scripts/restart_birdnet_recording.php b/scripts/restart_birdnet_recording.php new file mode 100644 index 0000000..9c61cd4 --- /dev/null +++ b/scripts/restart_birdnet_recording.php @@ -0,0 +1,4 @@ + diff --git a/scripts/restart_birdnet_recording.sh b/scripts/restart_birdnet_recording.sh new file mode 100755 index 0000000..bc9f5b8 --- /dev/null +++ b/scripts/restart_birdnet_recording.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Restars the BirdNET Recording service +sudo systemctl restart birdnet_recording.service diff --git a/scripts/restart_caddy.php b/scripts/restart_caddy.php new file mode 100644 index 0000000..3de0dd9 --- /dev/null +++ b/scripts/restart_caddy.php @@ -0,0 +1,4 @@ + diff --git a/scripts/restart_caddy.sh b/scripts/restart_caddy.sh new file mode 100755 index 0000000..43edcca --- /dev/null +++ b/scripts/restart_caddy.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Restars the caddy webserver +sudo systemctl restart caddy diff --git a/scripts/restart_extraction.php b/scripts/restart_extraction.php new file mode 100644 index 0000000..f847580 --- /dev/null +++ b/scripts/restart_extraction.php @@ -0,0 +1,4 @@ + diff --git a/scripts/restart_extraction.sh b/scripts/restart_extraction.sh new file mode 100755 index 0000000..81aadf0 --- /dev/null +++ b/scripts/restart_extraction.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Restars the BirdNET Extraction service +sudo systemctl restart extraction.service