Merge pull request #836 from jaredb7/More-Misc-Fixes-and-Enhancements_mcguire
More misc fixes and enhancements
This commit is contained in:
@@ -189,7 +189,7 @@ TODAY="$RECS_DIR/$(date "+%B-%Y/%d-%A")"
|
||||
if [ $(find ${YESTERDAY} -name '*wav' 2>/dev/null | wc -l) -gt 0 ];then
|
||||
find $YESTERDAY -name '*wav' -type f -size 0 -delete
|
||||
run_birdnet "${YESTERDAY}"
|
||||
elif [ $(find ${TODAY} -name '*wav' | wc -l) -gt 0 ];then
|
||||
elif [ $(find ${TODAY} -name '*wav' 2>/dev/null | wc -l) -gt 0 ];then
|
||||
find $TODAY -name '*wav' -type f -size 0 -delete
|
||||
run_birdnet "${TODAY}"
|
||||
fi
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Performs the recording from the specified RSTP stream or soundcard
|
||||
set -x
|
||||
# Performs the recording from the specified RTSP stream or soundcard
|
||||
#set -x
|
||||
source /etc/birdnet/birdnet.conf
|
||||
|
||||
# Set the logging level
|
||||
LOGGING_LEVEL='error'
|
||||
|
||||
[ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15
|
||||
|
||||
if [ ! -z $RTSP_STREAM ];then
|
||||
@@ -33,7 +36,7 @@ if [ ! -z $RTSP_STREAM ];then
|
||||
|
||||
# Make sure were passing something valid to ffmpeg, ffmpeg will run interactive and control our look by waiting ${RECORDING_LENGTH} between loops
|
||||
if [ -n "$FFMPEG_PARAMS" ];then
|
||||
ffmpeg -nostdin $FFMPEG_PARAMS
|
||||
ffmpeg -hide_banner -loglevel $LOGGING_LEVEL -nostdin $FFMPEG_PARAMS
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
<form action="" method="GET" id="add">
|
||||
<h3>All Species Labels</h3>
|
||||
<input autocomplete="off" size="18" type="text" placeholder="Search Species..." id="exclude_species_searchterm" name="exclude_species_searchterm">
|
||||
<br>
|
||||
<span>Once the desired species has been highlighted, select it and click ADD to have it excluded.</span>
|
||||
<select name="species[]" id="species" multiple size="auto">
|
||||
<option>Choose a species below to add to the Excluded Species List</option>
|
||||
<?php
|
||||
@@ -38,6 +40,7 @@
|
||||
<div class="customlabels column3">
|
||||
<form action="" method="GET" id="del">
|
||||
<h3>Excluded Species List</h3>
|
||||
<br><br>
|
||||
<select name="species[]" id="value2" multiple size="auto">
|
||||
<?php
|
||||
$filename = './scripts/exclude_species_list.txt';
|
||||
@@ -77,10 +80,10 @@
|
||||
//Now look at the select list, loop over the options and try find part of the text in the option's name/text
|
||||
var species_select_list = document.querySelector('select#species');
|
||||
|
||||
//if the search text differs from last time start the search from the begining of te list
|
||||
//if the search text differs from last time start the search from the beginning of te list
|
||||
if (search_text !== last_search_term) {
|
||||
//Also unselect the last match
|
||||
species_select_list[search_match_idx].removeAttribute('selected');
|
||||
species_select_list[search_match_idx].removeAttribute('class');
|
||||
search_match_idx = 1;
|
||||
}
|
||||
|
||||
@@ -91,9 +94,9 @@
|
||||
search_match_text = option_text.toLowerCase().includes(search_text)
|
||||
|
||||
//Check if the item is already selected, that could mean that user may be searching the same phrase
|
||||
//again, we want to search further so let's unselect it and move to the next index
|
||||
if (species_select_list[search_match_idx].getAttribute('selected') === true || species_select_list[search_match_idx].getAttribute('selected') === "true") {
|
||||
species_select_list[search_match_idx].removeAttribute('selected');
|
||||
if (species_select_list[search_match_idx].getAttribute('class') === "exclude_species_list_option_highlight") {
|
||||
species_select_list[search_match_idx].removeAttribute('class');
|
||||
// species_select_list[search_match_idx].removeAttribute('style');
|
||||
//Go to the next item
|
||||
i++
|
||||
continue;
|
||||
@@ -110,12 +113,15 @@
|
||||
search_match_idx = i;
|
||||
|
||||
//Scroll into view and select it
|
||||
species_select_list[search_match_idx].scrollIntoView();
|
||||
species_select_list[search_match_idx].setAttribute('selected', true);
|
||||
species_select_list[search_match_idx].scrollIntoView({behavior: 'smooth', block: 'start'});
|
||||
//Apply a style to the option since setting the selected value to true breaks scrolling on chrome :(
|
||||
//the style is nicer anyway :)
|
||||
species_select_list[search_match_idx].setAttribute('class', "exclude_species_list_option_highlight");
|
||||
// species_select_list[search_match_idx].setAttribute('selected', 'true');
|
||||
|
||||
//break the loop
|
||||
break;
|
||||
}
|
||||
// }
|
||||
}
|
||||
//Track what search term was used so we know when to start over
|
||||
last_search_term = search_text
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
# Live Audio Stream Service Script
|
||||
source /etc/birdnet/birdnet.conf
|
||||
|
||||
# Set logging level
|
||||
LOGGING_LEVEL='error'
|
||||
|
||||
if [ -z ${REC_CARD} ];then
|
||||
echo "Stream not supported"
|
||||
elif [[ ! -z ${RTSP_STREAM} ]];then
|
||||
@@ -22,11 +25,11 @@ elif [[ ! -z ${RTSP_STREAM} ]];then
|
||||
SELECTED_RSTP_STREAM=${RSTP_STREAMS_EXPLODED_ARRAY[0]}
|
||||
fi
|
||||
|
||||
ffmpeg -nostdin -loglevel 32 -ac ${CHANNELS} -i ${SELECTED_RSTP_STREAM} -acodec libmp3lame \
|
||||
ffmpeg -nostdin -loglevel $LOGGING_LEVEL -ac ${CHANNELS} -i ${SELECTED_RSTP_STREAM} -acodec libmp3lame \
|
||||
-b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \
|
||||
-f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re
|
||||
else
|
||||
ffmpeg -nostdin -loglevel 32 -ac ${CHANNELS} -f alsa -i ${REC_CARD} -acodec libmp3lame \
|
||||
ffmpeg -nostdin -loglevel $LOGGING_LEVEL -ac ${CHANNELS} -f alsa -i ${REC_CARD} -acodec libmp3lame \
|
||||
-b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \
|
||||
-f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re
|
||||
fi
|
||||
|
||||
@@ -25,10 +25,10 @@ function service_status($name) {
|
||||
<div class="servicecontrols">
|
||||
<form action="" method="GET">
|
||||
<h3>Live Audio Stream <?php echo service_status("livestream.service");?></h3>
|
||||
<button type="submit" name="submit" value="sudo systemctl stop livestream.service && sudo /etc/init.d/icecast2 stop">Stop</button>
|
||||
<button type="submit" name="submit" value="sudo systemctl restart livestream.service && sudo /etc/init.d/icecast2 restart">Restart </button>
|
||||
<button type="submit" name="submit" value="sudo systemctl disable --now livestream.service && sudo systemctl disable icecast2 && sudo /etc/init.d/icecast2 stop">Disable</button>
|
||||
<button type="submit" name="submit" value="sudo systemctl enable icecast2 && sudo /etc/init.d/icecast2 start && sudo systemctl enable --now livestream.service">Enable</button>
|
||||
<button type="submit" name="submit" value="sudo systemctl stop livestream.service && sudo systemctl stop icecast2.service">Stop</button>
|
||||
<button type="submit" name="submit" value="sudo systemctl restart livestream.service && sudo systemctl restart icecast2.service">Restart </button>
|
||||
<button type="submit" name="submit" value="sudo systemctl disable --now livestream.service && sudo systemctl disable icecast2 && sudo systemctl stop icecast2.service">Disable</button>
|
||||
<button type="submit" name="submit" value="sudo systemctl enable icecast2 && sudo systemctl start icecast2.service && sudo systemctl enable --now livestream.service">Enable</button>
|
||||
</form>
|
||||
<form action="" method="GET">
|
||||
<h3>Web Terminal <?php echo service_status("web_terminal.service");?></h3>
|
||||
|
||||
+17
-5
@@ -1,8 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# set -x
|
||||
# Make sox spectrogram
|
||||
source /etc/birdnet/birdnet.conf
|
||||
analyzing_now="$(cat $HOME/BirdNET-Pi/analyzing_now.txt)"
|
||||
if [ ! -z "${analyzing_now}" ] && [ -f "${analyzing_now}" ]; then
|
||||
spectrogram_png=${EXTRACTED}/spectrogram.png
|
||||
sox -V1 "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now//$HOME\/}" -o "${spectrogram_png}"
|
||||
fi
|
||||
|
||||
# Time to sleep between generating spectrogram's, default set the recording length
|
||||
# To try catch the spectrogram as soon as possible run at a smaller intervals
|
||||
SLEEP_DELAY=$((RECORDING_LENGTH / 4))
|
||||
|
||||
# Continuously loop generating a spectrogram every 10 seconds
|
||||
while true; do
|
||||
analyzing_now="$(cat $HOME/BirdNET-Pi/analyzing_now.txt)"
|
||||
|
||||
if [ ! -z "${analyzing_now}" ] && [ -f "${analyzing_now}" ]; then
|
||||
spectrogram_png=${EXTRACTED}/spectrogram.png
|
||||
sox -V1 "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now//$HOME\//}" -o "${spectrogram_png}"
|
||||
fi
|
||||
|
||||
sleep $SLEEP_DELAY
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user