@@ -52,24 +52,9 @@ An installation one-liner is available below for RaspiOS-ARM64 meeting the prequ
|
||||
- *Note for Android users: it seems that the Pushed.co Mobile App does not work for Android devices, which is a huge bummer. If anyone knows of an Android alternative, or if anyone might be able to come up with a home-spun notification system, please let me know.*
|
||||
|
||||
## How to install
|
||||
#### Option 1 (Recommended) -- Install All Services
|
||||
1. In the terminal run: `curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Lite/rpi4/Birders_Guide_Installer.sh | bash`
|
||||
Install All Services
|
||||
1. In the terminal run: `curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Lite/rpialpha/Birders_Guide_Installer.sh | bash`
|
||||
|
||||
##### Options 2 & 3 require you setup 4GB of swapping. That step is included in the directions below.
|
||||
#### Option 2 -- Pre-fill birdnet.conf
|
||||
1. In the terminal run `git clone https://github.com/mcguirepr89/BirdNET-Lite.git ~/BirdNET-Lite`
|
||||
1. You can copy the included *'birdnet.conf-defaults'* template to create and configure the BirdNET-Lite
|
||||
to your needs before running the installer. Issue `cp ~/BirdNET-Lite/birdnet.conf-defaults ~/BirdNET-Lite/birdnet.conf`.
|
||||
Edit the new *'birdnet.conf'* file to suit your needs and save it.
|
||||
If you choose this method, the installation will be (nearly) non-interactive.
|
||||
1. Setup zRAM swapping. Run `~/BirdNET-Lite/scripts/install_zram_service.sh && sudo reboot`
|
||||
1. After the reboot, run `~/BirdNET-Lite/scripts/install_birdnet.sh`
|
||||
#### Option 3 -- Interactive Installation
|
||||
1. In the terminal run `git clone https://github.com/mcguirepr89/BirdNET-Lite.git ~/BirdNET-Lite`
|
||||
1. Setup zRAM swapping. Run `~/BirdNET-Lite/scripts/install_zram_service.sh && sudo reboot`
|
||||
1. After the reboot, run `~/BirdNET-Lite/scripts/install_birdnet.sh`
|
||||
1. Follow the installation prompts to configure the BirdNET-Lite to your needs.
|
||||
- Note: The installation should be run as a regular user. If run on an OS other than RaspiOS, be sure the regular user is in the sudoers file or the sudo group.
|
||||
|
||||
## Access your BirdNET-Lite
|
||||
If you configured BirdNET-Lite with the Caddy webserver, you can access the extractions locally at
|
||||
|
||||
+34
-12
@@ -74,23 +74,38 @@ run_analysis() {
|
||||
WEEK="$(echo "${WEEK_OF_YEAR} + 4" |bc -l)"
|
||||
fi
|
||||
|
||||
#WEEK=$(date +"%U")
|
||||
cd ${HOME}/BirdNET-Lite || exit 1
|
||||
for i in "${files[@]}";do
|
||||
|
||||
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 \
|
||||
| awk -F. '/Duration/ {print $1}' \
|
||||
| cut -d':' -f3-4)"
|
||||
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=12
|
||||
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
||||
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
||||
[ -z $FILE_LENGTH ] && sleep 3 && continue
|
||||
echo "RECORDING_LENGTH set to ${RECORDING_LENGTH}"
|
||||
a=1
|
||||
if [ ${RECORDING_LENGTH} == "01:00" ];then
|
||||
[ "${FILE_LENGTH}" == "${RECORDING_LENGTH}" ] || continue
|
||||
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "${RECORDING_LENGTH}" ];do
|
||||
sleep 1
|
||||
[ $a -ge ${RECORDING_LENGTH} ] && sudo rm -f ${1}/${i} && break
|
||||
a=$((a+1))
|
||||
done
|
||||
else
|
||||
[ "${FILE_LENGTH}" == "00:${RECORDING_LENGTH}" ] || continue
|
||||
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "00:${RECORDING_LENGTH}" ];do
|
||||
sleep 1
|
||||
[ $a -ge ${RECORDING_LENGTH} ] && sudo rm -f ${1}/${i} && break
|
||||
a=$((a+1))
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ];then
|
||||
set -x
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}""
|
||||
python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -100,9 +115,17 @@ run_analysis() {
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}"
|
||||
set +x
|
||||
elif [ -f ${1}/${i} ] && [ -f ${CUSTOM_LIST} ];then
|
||||
set -x
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--custom_list "${CUSTOM_LIST}""
|
||||
python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -113,7 +136,6 @@ run_analysis() {
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--custom_list "${CUSTOM_LIST}"
|
||||
set +x
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -122,7 +144,7 @@ run_analysis() {
|
||||
# Takes one argument:
|
||||
# - {DIRECTORY}
|
||||
run_birdnet() {
|
||||
echo "Starting run_birdnet() for \"${1:19}\""
|
||||
echo "Starting run_birdnet() for ${1:19}"
|
||||
get_files "${1}"
|
||||
move_analyzed "${1}"
|
||||
run_analysis "${1}"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<form action="/scripts/restart_services.php">
|
||||
<input type="submit" value="Restart ALL BirdNET-system Services">
|
||||
</form>
|
||||
|
||||
<form action="/scripts/restart_birdnet_analysis.php">
|
||||
<input type="submit" value="Restart BirdNET Analysis Service">
|
||||
</form>
|
||||
|
||||
<form action="/scripts/restart_birdnet_recording.php">
|
||||
<input type="submit" value="Restart Recording Service">
|
||||
</form>
|
||||
|
||||
<form action="/scripts/restart_extraction.php">
|
||||
<input type="submit" value="Restart Extraction Service">
|
||||
</form>
|
||||
|
||||
<form action="/scripts/restart_caddy.php">
|
||||
<input type="submit" value="Restart Caddy">
|
||||
</form>
|
||||
|
||||
<form action="/scripts/reboot_system.php">
|
||||
<input type="submit" value="Reboot BirdNET-system">
|
||||
</form>
|
||||
|
||||
@@ -12,6 +12,7 @@ CONFIG_FILE="$(dirname ${my_dir})/birdnet.conf"
|
||||
install_scripts() {
|
||||
echo "Installing BirdNET-Lite scripts to /usr/local/bin"
|
||||
ln -sf ${my_dir}/* /usr/local/bin/
|
||||
rm /usr/local/bin/index.html
|
||||
}
|
||||
|
||||
install_birdnet_analysis() {
|
||||
@@ -77,6 +78,7 @@ create_necessary_dirs() {
|
||||
[ -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 ${PROCESSED} ] || sudo -u ${USER} mkdir -p ${PROCESSED}
|
||||
[ -L ${EXTRACTED}/scripts ] || sudo -u ${USER} ln -s $(dirname ${my_dir})/scripts ${EXTRACTED}
|
||||
}
|
||||
|
||||
install_alsa() {
|
||||
@@ -198,6 +200,7 @@ ${EXTRACTIONS_URL} {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
reverse_proxy /stream localhost:8000
|
||||
php_fastcgi unix//run/php/php7.3-fpm.sock
|
||||
}
|
||||
|
||||
http://birdnetsystem.local {
|
||||
@@ -210,6 +213,7 @@ http://birdnetsystem.local {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
reverse_proxy /stream localhost:8000
|
||||
php_fastcgi unix//run/php/php7.3-fpm.sock
|
||||
}
|
||||
|
||||
http://birdlog.local {
|
||||
@@ -315,6 +319,23 @@ EOF
|
||||
systemctl enable --now birdstats.service
|
||||
}
|
||||
|
||||
install_php() {
|
||||
if ! which pip &> /dev/null || ! which php-fpm7.3;then
|
||||
echo "Installing PHP and PHP-FPM"
|
||||
apt -qq update
|
||||
apt install -qqy php php-fpm
|
||||
else
|
||||
echo "PHP and PHP-FPM installed"
|
||||
fi
|
||||
echo "Configuring PHP for Caddy"
|
||||
sed -i 's/www-data/caddy/g' /etc/php/7.3/fpm/pool.d/www.conf
|
||||
systemctl restart php7.3-fpm.service
|
||||
echo "Adding Caddy sudoers rule"
|
||||
cat << EOF > /etc/sudoers.d/010_caddy-nopasswd
|
||||
caddy ALL=(ALL) NOPASSWD: ALL
|
||||
EOF
|
||||
chmod 0440 /etc/sudoers.d/010_caddy-nopasswd
|
||||
}
|
||||
|
||||
install_icecast() {
|
||||
if ! which icecast2;then
|
||||
@@ -422,6 +443,7 @@ install_selected_services() {
|
||||
install_Caddyfile
|
||||
install_avahi_aliases
|
||||
install_gotty_logs
|
||||
install_php
|
||||
fi
|
||||
|
||||
if [ ! -z "${ICE_PWD}" ];then
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
shell_exec("/home/pi/BirdNET-Lite/scripts/reboot_system.sh");
|
||||
header('Location: http://birdnetsystem.local/scripts/index.html?success=true');
|
||||
?>
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
sudo reboot
|
||||
@@ -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
|
||||
rm -rf ${RECS_DIR}/$(date +%B-%Y/%d-%A)/*
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
shell_exec("/home/pi/BirdNET-Lite/scripts/restart_birdnet_analysis.sh");
|
||||
header('Location: http://birdnetsystem.local/scripts/index.html?success=true');
|
||||
?>
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restars the main BirdNET analysis service
|
||||
sudo systemctl restart birdnet_analysis.service
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
shell_exec("/home/pi/BirdNET-Lite/scripts/restart_birdnet_recording.sh");
|
||||
header('Location: http://birdnetsystem.local/scripts/index.html?success=true');
|
||||
?>
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restars the BirdNET Recording service
|
||||
sudo systemctl restart birdnet_recording.service
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
shell_exec("/home/pi/BirdNET-Lite/scripts/restart_caddy.sh");
|
||||
header('Location: http://birdnetsystem.local/scripts/index.html?success=true');
|
||||
?>
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restars the caddy webserver
|
||||
sudo systemctl restart caddy
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
shell_exec("/home/pi/BirdNET-Lite/scripts/restart_extraction.sh");
|
||||
header('Location: http://birdnetsystem.local/scripts/index.html?success=true');
|
||||
?>
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restars the BirdNET Extraction service
|
||||
sudo systemctl restart extraction.service
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
shell_exec("/home/pi/BirdNET-Lite/scripts/restart_birdnet.sh");
|
||||
header('Location: http://birdnetsystem.local/scripts/index.html?success=true');
|
||||
?>
|
||||
+31
-20
@@ -3,26 +3,37 @@
|
||||
# set -x # Uncomment to debug
|
||||
trap 'rm -f ${TMPFILE}' EXIT
|
||||
source /etc/birdnet/birdnet.conf &> /dev/null
|
||||
SCRIPTS=(/usr/local/bin/birdnet_analysis.sh
|
||||
/usr/local/bin/birdnet_recording.sh
|
||||
/usr/local/bin/birdnet_stats.sh
|
||||
/usr/local/bin/cleanup.sh
|
||||
/usr/local/bin/clear_all_data.sh
|
||||
/usr/local/bin/disk_usage.sh
|
||||
/usr/local/bin/dump_logs.sh
|
||||
/usr/local/bin/extract_new_birdsounds.sh
|
||||
/usr/local/bin/install_birdnet.sh
|
||||
/usr/local/bin/install_config.sh
|
||||
/usr/local/bin/install_services.sh
|
||||
/usr/local/bin/install_tmux_services.sh
|
||||
/usr/local/bin/install_zram_service.sh
|
||||
/usr/local/bin/livestream.sh
|
||||
/usr/local/bin/pretty_date.sh
|
||||
/usr/local/bin/reconfigure_birdnet.sh
|
||||
/usr/local/bin/restart_birdnet.sh
|
||||
/usr/local/bin/species_notifier.sh
|
||||
/usr/local/bin/uninstall.sh
|
||||
/usr/local/bin/update_species.sh
|
||||
SCRIPTS=(birdnet_analysis.sh
|
||||
birdnet_recording.sh
|
||||
birdnet_stats.sh
|
||||
cleanup.sh
|
||||
clear_all_data.sh
|
||||
disk_usage.sh
|
||||
dump_logs.sh
|
||||
extract_new_birdsounds.sh
|
||||
install_birdnet.sh
|
||||
install_config.sh
|
||||
install_services.sh
|
||||
install_tmux_services.sh
|
||||
install_zram_service.sh
|
||||
livestream.sh
|
||||
pretty_date.sh
|
||||
reboot_system.php
|
||||
reboot_system.sh
|
||||
reconfigure_birdnet.sh
|
||||
restart_birdnet_analysis.php
|
||||
restart_birdnet_analysis.sh
|
||||
restart_birdnet_recording.php
|
||||
restart_birdnet_recording.sh
|
||||
restart_birdnet.sh
|
||||
restart_caddy.php
|
||||
restart_caddy.sh
|
||||
restart_extraction.php
|
||||
restart_extraction.sh
|
||||
restart_services.php
|
||||
species_notifier.sh
|
||||
uninstall.sh
|
||||
update_species.sh
|
||||
${HOME}/.gotty)
|
||||
|
||||
|
||||
|
||||
+20
-8
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>BirdNET-Lite Extractions</title>
|
||||
<title>BirdNET-Lite System</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
@@ -308,13 +308,13 @@ footer {
|
||||
|
||||
<header>
|
||||
<h1>
|
||||
<a href="">BirdNET-Lite Extractions</a>
|
||||
<a href="">BirdNET-Lite System</a>
|
||||
</h1>
|
||||
</header>
|
||||
<main>
|
||||
<div class="meta">
|
||||
<div id="summary">
|
||||
<span class="meta-item"><b>4</b> directories</span>
|
||||
<span class="meta-item"><b>5</b> directories</span>
|
||||
<span class="meta-item"><b>1</b> file</span>
|
||||
<span class="meta-item"><input type="text" placeholder="filter" id="filter" onkeyup='filter()'></span>
|
||||
</div>
|
||||
@@ -347,7 +347,7 @@ footer {
|
||||
</a>
|
||||
</td>
|
||||
<td data-order="-1">—</td>
|
||||
<td class="hideable"><time datetime="2021-09-28T23:31:31Z">09/28/2021 11:31:31 PM +00:00</time></td>
|
||||
<td class="hideable"><time datetime="2021-10-03T23:13:48Z">10/03/2021 11:13:48 PM +00:00</time></td>
|
||||
<td class="hideable"></td>
|
||||
</tr>
|
||||
<tr class="file">
|
||||
@@ -359,7 +359,7 @@ footer {
|
||||
</a>
|
||||
</td>
|
||||
<td data-order="-1">—</td>
|
||||
<td class="hideable"><time datetime="2021-09-28T23:31:31Z">09/28/2021 11:31:31 PM +00:00</time></td>
|
||||
<td class="hideable"><time datetime="2021-10-03T23:13:48Z">10/03/2021 11:13:48 PM +00:00</time></td>
|
||||
<td class="hideable"></td>
|
||||
</tr>
|
||||
<tr class="file">
|
||||
@@ -371,7 +371,7 @@ footer {
|
||||
</a>
|
||||
</td>
|
||||
<td data-order="-1">—</td>
|
||||
<td class="hideable"><time datetime="2021-09-28T23:31:31Z">09/28/2021 11:31:31 PM +00:00</time></td>
|
||||
<td class="hideable"><time datetime="2021-10-03T23:13:48Z">10/03/2021 11:13:48 PM +00:00</time></td>
|
||||
<td class="hideable"></td>
|
||||
</tr>
|
||||
<tr class="file">
|
||||
@@ -383,7 +383,19 @@ footer {
|
||||
</a>
|
||||
</td>
|
||||
<td data-order="-1">—</td>
|
||||
<td class="hideable"><time datetime="2021-09-28T23:30:36Z">09/28/2021 11:30:36 PM +00:00</time></td>
|
||||
<td class="hideable"><time datetime="2021-10-03T23:23:16Z">10/03/2021 11:23:16 PM +00:00</time></td>
|
||||
<td class="hideable"></td>
|
||||
</tr>
|
||||
<tr class="file">
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="./scripts/">
|
||||
<svg width="1.5em" height="1em" version="1.1" viewBox="0 0 317 259"><use xlink:href="#folder-shortcut"></use></svg>
|
||||
<span class="name">scripts</span>
|
||||
</a>
|
||||
</td>
|
||||
<td data-order="-1">—</td>
|
||||
<td class="hideable"><time datetime="2021-10-03T23:13:48Z">10/03/2021 11:13:48 PM +00:00</time></td>
|
||||
<td class="hideable"></td>
|
||||
</tr>
|
||||
<tr class="file">
|
||||
@@ -395,7 +407,7 @@ footer {
|
||||
</a>
|
||||
</td>
|
||||
<td data-order="0">0 B</td>
|
||||
<td class="hideable"><time datetime="2021-09-28T23:28:21Z">09/28/2021 11:28:21 PM +00:00</time></td>
|
||||
<td class="hideable"><time datetime="2021-10-03T23:29:52Z">10/03/2021 11:29:52 PM +00:00</time></td>
|
||||
<td class="hideable"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user