added spectrogram view for currently analyzing file
Needs to be refreshed, but works
This commit is contained in:
@@ -5,6 +5,7 @@ source /etc/birdnet/birdnet.conf
|
|||||||
# Document this run's birdnet.conf settings
|
# Document this run's birdnet.conf settings
|
||||||
# Make a temporary file to compare the current birdnet.conf with
|
# Make a temporary file to compare the current birdnet.conf with
|
||||||
# the birdnet.conf as it was the last time this script was called
|
# the birdnet.conf as it was the last time this script was called
|
||||||
|
my_dir=$(realpath $(dirname $0))
|
||||||
make_thisrun() {
|
make_thisrun() {
|
||||||
sleep .4
|
sleep .4
|
||||||
awk '!/#/ && !/^$/ {print}' /etc/birdnet/birdnet.conf \
|
awk '!/#/ && !/^$/ {print}' /etc/birdnet/birdnet.conf \
|
||||||
@@ -76,6 +77,7 @@ run_analysis() {
|
|||||||
|
|
||||||
cd ${HOME}/BirdNET-Lite || exit 1
|
cd ${HOME}/BirdNET-Lite || exit 1
|
||||||
for i in "${files[@]}";do
|
for i in "${files[@]}";do
|
||||||
|
echo "${1}/${i}" > ./analyzing_now.txt
|
||||||
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=12
|
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=12
|
||||||
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
||||||
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
||||||
|
|||||||
@@ -337,6 +337,17 @@ install_tmux() {
|
|||||||
cp $(dirname ${my_dir})/templates/tmux.conf /etc/tmux.conf
|
cp $(dirname ${my_dir})/templates/tmux.conf /etc/tmux.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_sox() {
|
||||||
|
if which sox &> /dev/null;then
|
||||||
|
echo "Sox is installed"
|
||||||
|
else
|
||||||
|
echo "Installing sox"
|
||||||
|
apt -qq update
|
||||||
|
apt install -y sox
|
||||||
|
echo "Sox installed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
install_php() {
|
install_php() {
|
||||||
if ! which pip &> /dev/null || ! which php-fpm7.3;then
|
if ! which pip &> /dev/null || ! which php-fpm7.3;then
|
||||||
echo "Installing PHP and PHP-FPM"
|
echo "Installing PHP and PHP-FPM"
|
||||||
@@ -481,6 +492,7 @@ install_selected_services() {
|
|||||||
install_avahi_aliases
|
install_avahi_aliases
|
||||||
install_gotty_logs
|
install_gotty_logs
|
||||||
install_tmux
|
install_tmux
|
||||||
|
install_sox
|
||||||
install_php
|
install_php
|
||||||
install_edit_birdnet_conf
|
install_edit_birdnet_conf
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
shell_exec("/home/pi/BirdSongs/Extracted/spectrogram.sh");
|
||||||
|
header('Location: http://birdnetsystem.local/spectrogram.png');
|
||||||
|
?>
|
||||||
Executable
+6
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Make sox spectrogram
|
||||||
|
source /etc/birdnet/birdnet.conf
|
||||||
|
analyzing_now="$(cat /home/pi/BirdNET-Lite/analyzing_now.txt)"
|
||||||
|
spectrogram_png=${EXTRACTED}/spectrogram.png
|
||||||
|
sudo -u pi sox "${analyzing_now}" -n spectrogram -o "${spectrogram_png}"
|
||||||
@@ -417,6 +417,15 @@ footer {
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="file">
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<form action="/spectrogram.php">
|
||||||
|
<input type="submit" value="Spectrogram View">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user