From f1ebae64586d23a6a8578489f394c0222ca1403d Mon Sep 17 00:00:00 2001
From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com>
Date: Mon, 25 Apr 2022 08:33:32 -0400
Subject: [PATCH 01/22] rtsp adjustments
---
scripts/birdnet_recording.sh | 39 ++++++++++++++++++------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/scripts/birdnet_recording.sh b/scripts/birdnet_recording.sh
index 0798511..68405c5 100755
--- a/scripts/birdnet_recording.sh
+++ b/scripts/birdnet_recording.sh
@@ -2,29 +2,28 @@
set -x
source /etc/birdnet/birdnet.conf
-if [ "${TIMESTAMP_FORMAT}" == "12" ];then
- STAMP="%I:%M:%S%P"
-else
- STAMP="%H:%M:%S"
-fi
+STAMP="%H:%M:%S"
[ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15
-if ! pulseaudio --check;then pulseaudio --start;fi
-
-if pgrep arecord &> /dev/null ;then
- echo "Recording"
-else
- until grep 5050 <(netstat -tulpn 2>&1);do
- sleep 1
+if [ ! -z $RTSP_STREAM ];then
+ while true;do
+ ffmpeg -i $RTSP_STREAM -t 15 -vn -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/$(date "+%F")-birdnet-$STAMP.wav
done
- if [ -z ${REC_CARD} ];then
-
- arecord -f S16_LE -c${CHANNELS} -r48000 -t wav --max-file-time ${RECORDING_LENGTH}\
- --use-strftime ${RECS_DIR}/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
+else
+ if ! pulseaudio --check;then pulseaudio --start;fi
+ if pgrep arecord &> /dev/null ;then
+ echo "Recording"
else
- arecord -f S16_LE -c${CHANNELS} -r48000 -t wav --max-file-time ${RECORDING_LENGTH}\
- -D "${REC_CARD}" --use-strftime \
- ${RECS_DIR}/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
- fi
+ until grep 5050 <(netstat -tulpn 2>&1);do
+ sleep 1
+ done
+ if [ -z ${REC_CARD} ];then
+ arecord -f S16_LE -c${CHANNELS} -r48000 -t wav --max-file-time ${RECORDING_LENGTH}\
+ --use-strftime ${RECS_DIR}/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
+ else
+ arecord -f S16_LE -c${CHANNELS} -r48000 -t wav --max-file-time ${RECORDING_LENGTH}\
+ -D "${REC_CARD}" --use-strftime \
+ ${RECS_DIR}/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
+ fi
fi
From bc9edb8eb1980754189cc20287aadc4d00b0664d Mon Sep 17 00:00:00 2001
From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com>
Date: Mon, 25 Apr 2022 08:54:46 -0400
Subject: [PATCH 02/22] adding RTSP_STREAM variable
---
birdnet.conf-defaults | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults
index 5863aab..f21fcad 100644
--- a/birdnet.conf-defaults
+++ b/birdnet.conf-defaults
@@ -48,6 +48,13 @@ ICE_PWD=birdnetpi
BIRDNETPI_URL=
+#---------------------------- RTSP Stream URL -------------------------------#
+
+## If RTSP_STREAM is set, the system will use the RTSP stream as its audio
+## source instead of recording its own audio. If this variable is kept empty,
+## BirdNET-Pi will default to recording its own audio.
+
+RTSP_STREAM=
#------------------- Mobile Notifications via Pushed.co ---------------------#
#____________The two variables below enable mobile notifications_______________#
From 0cc8c3491a6c6c903685e4bb9349b0c94f813b2e Mon Sep 17 00:00:00 2001
From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com>
Date: Mon, 25 Apr 2022 08:55:34 -0400
Subject: [PATCH 03/22] Update install_config.sh
---
scripts/install_config.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/install_config.sh b/scripts/install_config.sh
index cbd29f1..8906ec5 100755
--- a/scripts/install_config.sh
+++ b/scripts/install_config.sh
@@ -61,6 +61,13 @@ ICE_PWD=birdnetpi
BIRDNETPI_URL=
+#---------------------------- RTSP Stream URL -------------------------------#
+
+## If RTSP_STREAM is set, the system will use the RTSP stream as its audio
+## source instead of recording its own audio. If this variable is kept empty,
+## BirdNET-Pi will default to recording its own audio.
+
+RTSP_STREAM=
#------------------- Mobile Notifications via Pushed.co ---------------------#
#____________The two variables below enable mobile notifications_______________#
From 737042b24b3e2d9f76975ce58708711776584bfe Mon Sep 17 00:00:00 2001
From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com>
Date: Mon, 25 Apr 2022 08:57:34 -0400
Subject: [PATCH 04/22] Update update_birdnet.sh
adding the new variable to the update script to make sure it is added to older systems
---
scripts/update_birdnet.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/update_birdnet.sh b/scripts/update_birdnet.sh
index a48e7d6..dd6e84a 100755
--- a/scripts/update_birdnet.sh
+++ b/scripts/update_birdnet.sh
@@ -18,3 +18,6 @@ fi
if ! grep PRIVACY_MODE /etc/birdnet/birdnet.conf;then
sudo -u${USER} echo "PRIVACY_MODE=off" >> /etc/birdnet/birdnet.conf
fi
+if ! grep RTSP_STREAM /etc/birdnet/birdnet.conf;then
+ sudo -u${USER} echo "RTSP_STREAM=" >> /etc/birdnet/birdnet.conf
+fi
From ce782c4b8350ba9c2925331e19820b48dc14e808 Mon Sep 17 00:00:00 2001
From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com>
Date: Mon, 25 Apr 2022 09:11:25 -0400
Subject: [PATCH 05/22] Update advanced.php
---
scripts/advanced.php | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/scripts/advanced.php b/scripts/advanced.php
index a4da847..4a60f71 100644
--- a/scripts/advanced.php
+++ b/scripts/advanced.php
@@ -64,6 +64,19 @@ if(isset($_GET['submit'])) {
}
}
+ if(isset($_GET["rtsp_stream"])) {
+ $rtsp_stream = $_GET["rtsp_stream"];
+ if(strcmp($rtsp_stream,$config['RTSP_STREAM']) !== 0) {
+ $contents = preg_replace("/RTSP_STREAM=.*/", "RTSP_STREAM=$rtsp_stream", $contents);
+ $contents2 = preg_replace("/RTSP_STREAM=.*/", "RTSP_STREAM=$rtsp_stream", $contents2);
+ $fh = fopen('/etc/birdnet/birdnet.conf', "w");
+ $fh2 = fopen("./scripts/thisrun.txt", "w");
+ fwrite($fh, $contents);
+ fwrite($fh2, $contents2);
+ exec('sudo systemctl restart birdnet_recording.service');
+ }
+ }
+
if(isset($_GET["overlap"])) {
$overlap = $_GET["overlap"];
if(strcmp($overlap,$config['OVERLAP']) !== 0) {
@@ -201,6 +214,9 @@ if (file_exists('./scripts/thisrun.txt')) {
Set Channels to the number of channels supported by your sound card. 32 max.
+ +If you place an RTSP stream URL here, BirdNET-Pi will use that as its audio source.
Set Recording Length in seconds between 6 and 60. Multiples of 3 are recommended, as BirdNET analyzes in 3-second chunks.
From 6f8e676f4e4b87846c0d0b17ed7085c8ac42f96b Mon Sep 17 00:00:00 2001 From: mcguirepr89Set Channels to the number of channels supported by your sound card. 32 max.
-If you place an RTSP stream URL here, BirdNET-Pi will use that as its audio source.
Set Channels to the number of channels supported by your sound card. 32 max.
If you place an RTSP stream URL here, BirdNET-Pi will use that as its audio source.
+If you place an RTSP stream URL here, BirdNET-Pi will use that as its audio source. If you have multiple streams, each URL should be on its own line.
Set Recording Length in seconds between 6 and 60. Multiples of 3 are recommended, as BirdNET analyzes in 3-second chunks.
From 5fa1048acea5b0794b03876bccdc23f1b5cbf88d Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Mon, 2 May 2022 09:39:14 -0400 Subject: [PATCH 13/22] Improvements to search, moving styles to .css --- homepage/style.css | 18 ++++++++++++++++++ scripts/todays_detections.php | 16 ++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/homepage/style.css b/homepage/style.css index 618fb92..6469e1c 100644 --- a/homepage/style.css +++ b/homepage/style.css @@ -513,3 +513,21 @@ button:hover { padding:5px; border: 2px solid black; } +button.legacyview { + color:gray; + margin:5px; + float:right; + z-index:100; + position:relative; + font-size:small; + background:#dbffeb; + padding:5px; + border: 2px solid black; +} +button.loadmore { + margin-top:10px; + font-size:x-large; + background:#dbffeb; + padding:10px; + border: 2px solid black; +} diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index 4b97c71..07e2dcd 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -112,7 +112,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { // don't show the button if there's no more detections to be displayed, we're at the end of the list if($iterations >= 40 && isset($_GET['display_limit']) && is_numeric($_GET['display_limit'])) { ?>Set Channels to the number of channels supported by your sound card. 32 max.
-If you place an RTSP stream URL here, BirdNET-Pi will use that as its audio source. If you have multiple streams, each URL should be on its own line.
Set Channels to the number of channels supported by your sound card. 32 max.
If you place an RTSP stream URL here, BirdNET-Pi will use that as its audio source. If you have multiple streams, each URL should be on its own line.
+If you place an RTSP stream URL here, BirdNET-Pi will use that as its audio source.
Set Recording Length in seconds between 6 and 60. Multiples of 3 are recommended, as BirdNET analyzes in 3-second chunks.
From 9f186c74b1043aaa68fadf78b52d4cc83741fc2a Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 5 May 2022 11:17:21 -0400 Subject: [PATCH 21/22] Update birdnet_recording.sh --- scripts/birdnet_recording.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/birdnet_recording.sh b/scripts/birdnet_recording.sh index 53e342a..8a3063b 100755 --- a/scripts/birdnet_recording.sh +++ b/scripts/birdnet_recording.sh @@ -7,7 +7,7 @@ source /etc/birdnet/birdnet.conf if [ ! -z $RTSP_STREAM ];then while true;do for i in ${RTSP_STREAM//,/ };do - ffmpeg -i ${i} -t 15 -vn -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/$(date "+%F")-birdnet-$(date "+%H:%M:%S").wav + ffmpeg -i ${i} -t ${RECORDING_LENGTH} -vn -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/$(date "+%F")-birdnet-$(date "+%H:%M:%S").wav done done else From 2d819616045c0992de2cc8b9435317631bb6405d Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 5 May 2022 14:49:40 -0400 Subject: [PATCH 22/22] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6680ba2..e513baa 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Currently listening in these countries . . . that I know of . . . - Italy - Finland - Australia +- Canada ## Features * 24/7 recording and BirdNET-Lite analysis