adding new custom_recording.service in the installer (but not

enabled) cuz why not
new viewdb.php > todays_detections.php
This commit is contained in:
mcguirepr89
2022-04-02 12:57:22 -04:00
parent 3d4534e9d4
commit 5896a44889
4 changed files with 97 additions and 3 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ if(isset($_POST['view'])){
if($_POST['view'] == "Services"){include('scripts/service_controls.php');}
if($_POST['view'] == "Spectrogram"){include('spectrogram.php');}
if($_POST['view'] == "Overview"){include('overview.php');}
if($_POST['view'] == "Today's Detections"){include('viewdb.php');}
if($_POST['view'] == "Today's Detections"){include('todays_detections.php');}
if($_POST['view'] == "Species Stats"){echo "<br><br>";include('stats.php');}
if($_POST['view'] == "Daily Charts"){include('history.php');}
if($_POST['view'] == "Tools"){
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
set -x
source /etc/birdnet/birdnet.conf
STAMP="%H:%M:%S"
[ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15
if ! pulseaudio --check;then pulseaudio --start;fi
CUSTOM_WINDOW_START=(0 3 15 22)
CUSTOM_WINDOW_END=(0 7 19 23)
RECORDING_DURATION=60
PAUSE_DURATION=240
now=$(date +%H)
while [ $now -ge ${CUSTOM_WINDOW_START[0]} ] && [ $now -le ${CUSTOM_WINDOW_END[0]} ];do
echo $now
# If you prefer no directory structure under "Raw", comment out the
# lines below and uncommend the commands at the bottom.
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
--use-strftime ${EXTRACTED}/Raw/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
# Uncomment the lines below if you'd prefer having no directory scructure
# under the "Raw" directory. Be sure to comment out the command above.
#arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
# --use-strftime ${EXTRACTED}/Raw/%F-birdnet-${STAMP}.wav
sleep $PAUSE_DURATION
now=$(date +%H)
done
while [ $now -ge ${CUSTOM_WINDOW_START[1]} ] && [ $now -le ${CUSTOM_WINDOW_END[1]} ];do
echo $now
# If you prefer no directory structure under "Raw", comment out the
# lines below and uncommend the commands at the bottom.
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
--use-strftime ${EXTRACTED}/Raw/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
# Uncomment the lines below if you'd prefer having no directory scructure
# under the "Raw" directory. Be sure to comment out the command above.
#arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
# --use-strftime ${EXTRACTED}/Raw/%F-birdnet-${STAMP}.wav
sleep $PAUSE_DURATION
now=$(date +%H)
done
while [ $now -ge ${CUSTOM_WINDOW_START[2]} ] && [ $now -le ${CUSTOM_WINDOW_END[2]} ];do
echo $now
# If you prefer no directory structure under "Raw", comment out the
# lines below and uncommend the commands at the bottom.
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
--use-strftime ${EXTRACTED}/Raw/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
# Uncomment the lines below if you'd prefer having no directory scructure
# under the "Raw" directory. Be sure to comment out the command above.
#arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
# --use-strftime ${EXTRACTED}/Raw/%F-birdnet-${STAMP}.wav
sleep $PAUSE_DURATION
now=$(date +%H)
done
while [ $now -ge ${CUSTOM_WINDOW_START[3]} ] && [ $now -le ${CUSTOM_WINDOW_END[3]} ];do
echo $now
# If you prefer no directory structure under "Raw", comment out the
# lines below and uncommend the commands at the bottom.
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
--use-strftime ${EXTRACTED}/Raw/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
# Uncomment the lines below if you'd prefer having no directory scructure
# under the "Raw" directory. Be sure to comment out the command above.
#arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
# --use-strftime ${EXTRACTED}/Raw/%F-birdnet-${STAMP}.wav
sleep $PAUSE_DURATION
now=$(date +%H)
done
+19
View File
@@ -176,6 +176,24 @@ EOF
systemctl enable birdnet_recording.service
}
install_custom_recording_service() {
echo "Installing custom_recording.service"
cat << EOF > /home/pi/BirdNET-Pi/templates/custom_recording.service
[Unit]
Description=BirdNET Custom Recording
[Service]
Environment=XDG_RUNTIME_DIR=/run/user/1000
Restart=always
Type=simple
RestartSec=3
User=${USER}
ExecStart=/usr/local/bin/custom_recording.sh
[Install]
WantedBy=multi-user.target
EOF
ln -sf /home/pi/BirdNET-Pi/templates/birdnet_recording.service /usr/lib/systemd/system
}
install_Caddyfile() {
[ -d /etc/caddy ] || mkdir /etc/caddy
if [ -f /etc/caddy/Caddyfile ];then
@@ -412,6 +430,7 @@ install_services() {
install_birdnet_server
install_birdnet_stats_service
install_recording_service
install_custom_recording_service # But does not enable
install_extraction_service
install_pushed_notifications
install_spectrogram_service
@@ -9,7 +9,7 @@ if($db == False){
header("refresh: 0;");
}
$statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') GROUP BY Time ORDER BY Time DESC, MAX(Confidence) ASC');
$statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') ORDER BY Time DESC');
if($statement0 == False){
echo "Database is busy";
header("refresh: 0;");
@@ -103,7 +103,7 @@ $sciname = preg_replace('/ /', '_', $todaytable['Sci_Name']);
<b><a class="a2" href="https://allaboutbirds.org/guide/<?php echo $comname;?>" target="top"><?php echo $todaytable['Com_Name'];?></a></b><br>
<a class="a2" href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="top"><i><?php echo $todaytable['Sci_Name'];?></i></a><br>
<b>Confidence:</b> <?php echo $todaytable['Confidence'];?><br>
<video controls poster="<?php echo $filename.".png";?>" preload="none" title="<?php echo $filename;?>"><source src="<?php echo $filename;?>"></video></td>
<a href="<?php echo $filename;?>"><img src="<?php echo $filename.".png";?>"></a></td>
<?php }?>
</tr>
</table>