Merge pull request #836 from jaredb7/More-Misc-Fixes-and-Enhancements_mcguire
More misc fixes and enhancements
This commit is contained in:
+26
@@ -1,3 +1,29 @@
|
|||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# AWS User-specific
|
||||||
|
.idea/**/aws.xml
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
*.pyc
|
*.pyc
|
||||||
*.flac
|
*.flac
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ body::-webkit-scrollbar {
|
|||||||
display:none
|
display:none
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="style.css?v=4.06.23">
|
<link rel="stylesheet" href="style.css?v=<?php echo date ('n.d.y', filemtime('style.css')); ?>">
|
||||||
<link rel="stylesheet" type="text/css" href="static/dialog-polyfill.css" />
|
<link rel="stylesheet" type="text/css" href="static/dialog-polyfill.css" />
|
||||||
<body>
|
<body>
|
||||||
<div class="banner">
|
<div class="banner">
|
||||||
|
|||||||
@@ -828,6 +828,12 @@ pre#timer.bash {
|
|||||||
background-color: #9fe29b;
|
background-color: #9fe29b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.exclude_species_list_option_highlight {
|
||||||
|
color: black;
|
||||||
|
background-color: rgb(119, 196, 135);
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
#ddnewline::before {
|
#ddnewline::before {
|
||||||
content: none;
|
content: none;
|
||||||
}
|
}
|
||||||
+24
-5
@@ -271,10 +271,10 @@ if(isset($_GET['view'])){
|
|||||||
} else {
|
} else {
|
||||||
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
|
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
|
||||||
$submitteduser = $_SERVER['PHP_AUTH_USER'];
|
$submitteduser = $_SERVER['PHP_AUTH_USER'];
|
||||||
$allowedCommands = array('sudo systemctl stop livestream.service && sudo /etc/init.d/icecast2 stop',
|
$allowedCommands = array('sudo systemctl stop livestream.service && sudo systemctl stop icecast2.service',
|
||||||
'sudo systemctl restart livestream.service && sudo /etc/init.d/icecast2 restart',
|
'sudo systemctl restart livestream.service && sudo systemctl restart icecast2.service',
|
||||||
'sudo systemctl disable --now livestream.service && sudo systemctl disable icecast2 && sudo /etc/init.d/icecast2 stop',
|
'sudo systemctl disable --now livestream.service && sudo systemctl disable icecast2 && sudo systemctl stop icecast2.service',
|
||||||
'sudo systemctl enable icecast2 && sudo /etc/init.d/icecast2 start && sudo systemctl enable --now livestream.service',
|
'sudo systemctl enable icecast2 && sudo systemctl start icecast2.service && sudo systemctl enable --now livestream.service',
|
||||||
'sudo systemctl stop web_terminal.service',
|
'sudo systemctl stop web_terminal.service',
|
||||||
'sudo systemctl restart web_terminal.service',
|
'sudo systemctl restart web_terminal.service',
|
||||||
'sudo systemctl disable --now web_terminal.service',
|
'sudo systemctl disable --now web_terminal.service',
|
||||||
@@ -322,8 +322,27 @@ if(isset($_GET['view'])){
|
|||||||
if(isset($command)){
|
if(isset($command)){
|
||||||
$initcommand = $command;
|
$initcommand = $command;
|
||||||
if (strpos($command, "systemctl") !== false) {
|
if (strpos($command, "systemctl") !== false) {
|
||||||
|
//If there more than one command to execute, processes then separately
|
||||||
|
//currently only livestream service uses multiple commands to interact with the required services
|
||||||
|
if (strpos($command, " && ") !== false) {
|
||||||
|
$separate_commands = explode("&&", trim($command));
|
||||||
|
$new_multiservice_status_command = "";
|
||||||
|
foreach ($separate_commands as $indiv_service_command) {
|
||||||
|
//explode the string by " " space so we can get each individual component of the command
|
||||||
|
//and eventually the service name at the end
|
||||||
|
$separate_command_tmp = explode(" ", trim($indiv_service_command));
|
||||||
|
//get the service names
|
||||||
|
$new_multiservice_status_command .= " " . trim(end($separate_command_tmp));
|
||||||
|
}
|
||||||
|
|
||||||
|
$service_names = $new_multiservice_status_command;
|
||||||
|
} else {
|
||||||
|
//only one service needs restarting so we only need to query the status of one service
|
||||||
$tmp = explode(" ", trim($command));
|
$tmp = explode(" ", trim($command));
|
||||||
$command .= "& sleep 3;sudo systemctl status ".end($tmp);
|
$service_names = end($tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
$command .= " & sleep 3;sudo systemctl status " . $service_names;
|
||||||
}
|
}
|
||||||
if($initcommand == "update_birdnet.sh") {
|
if($initcommand == "update_birdnet.sh") {
|
||||||
unset($_SESSION['behind']);
|
unset($_SESSION['behind']);
|
||||||
|
|||||||
@@ -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
|
if [ $(find ${YESTERDAY} -name '*wav' 2>/dev/null | wc -l) -gt 0 ];then
|
||||||
find $YESTERDAY -name '*wav' -type f -size 0 -delete
|
find $YESTERDAY -name '*wav' -type f -size 0 -delete
|
||||||
run_birdnet "${YESTERDAY}"
|
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
|
find $TODAY -name '*wav' -type f -size 0 -delete
|
||||||
run_birdnet "${TODAY}"
|
run_birdnet "${TODAY}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Performs the recording from the specified RSTP stream or soundcard
|
# Performs the recording from the specified RTSP stream or soundcard
|
||||||
set -x
|
#set -x
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
|
|
||||||
|
# Set the logging level
|
||||||
|
LOGGING_LEVEL='error'
|
||||||
|
|
||||||
[ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15
|
[ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15
|
||||||
|
|
||||||
if [ ! -z $RTSP_STREAM ];then
|
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
|
# 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
|
if [ -n "$FFMPEG_PARAMS" ];then
|
||||||
ffmpeg -nostdin $FFMPEG_PARAMS
|
ffmpeg -hide_banner -loglevel $LOGGING_LEVEL -nostdin $FFMPEG_PARAMS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
<form action="" method="GET" id="add">
|
<form action="" method="GET" id="add">
|
||||||
<h3>All Species Labels</h3>
|
<h3>All Species Labels</h3>
|
||||||
<input autocomplete="off" size="18" type="text" placeholder="Search Species..." id="exclude_species_searchterm" name="exclude_species_searchterm">
|
<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">
|
<select name="species[]" id="species" multiple size="auto">
|
||||||
<option>Choose a species below to add to the Excluded Species List</option>
|
<option>Choose a species below to add to the Excluded Species List</option>
|
||||||
<?php
|
<?php
|
||||||
@@ -38,6 +40,7 @@
|
|||||||
<div class="customlabels column3">
|
<div class="customlabels column3">
|
||||||
<form action="" method="GET" id="del">
|
<form action="" method="GET" id="del">
|
||||||
<h3>Excluded Species List</h3>
|
<h3>Excluded Species List</h3>
|
||||||
|
<br><br>
|
||||||
<select name="species[]" id="value2" multiple size="auto">
|
<select name="species[]" id="value2" multiple size="auto">
|
||||||
<?php
|
<?php
|
||||||
$filename = './scripts/exclude_species_list.txt';
|
$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
|
//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');
|
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) {
|
if (search_text !== last_search_term) {
|
||||||
//Also unselect the last match
|
//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;
|
search_match_idx = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,9 +94,9 @@
|
|||||||
search_match_text = option_text.toLowerCase().includes(search_text)
|
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
|
//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('class') === "exclude_species_list_option_highlight") {
|
||||||
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('class');
|
||||||
species_select_list[search_match_idx].removeAttribute('selected');
|
// species_select_list[search_match_idx].removeAttribute('style');
|
||||||
//Go to the next item
|
//Go to the next item
|
||||||
i++
|
i++
|
||||||
continue;
|
continue;
|
||||||
@@ -110,12 +113,15 @@
|
|||||||
search_match_idx = i;
|
search_match_idx = i;
|
||||||
|
|
||||||
//Scroll into view and select it
|
//Scroll into view and select it
|
||||||
species_select_list[search_match_idx].scrollIntoView();
|
species_select_list[search_match_idx].scrollIntoView({behavior: 'smooth', block: 'start'});
|
||||||
species_select_list[search_match_idx].setAttribute('selected', true);
|
//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 the loop
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
//Track what search term was used so we know when to start over
|
//Track what search term was used so we know when to start over
|
||||||
last_search_term = search_text
|
last_search_term = search_text
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
# Live Audio Stream Service Script
|
# Live Audio Stream Service Script
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
|
|
||||||
|
# Set logging level
|
||||||
|
LOGGING_LEVEL='error'
|
||||||
|
|
||||||
if [ -z ${REC_CARD} ];then
|
if [ -z ${REC_CARD} ];then
|
||||||
echo "Stream not supported"
|
echo "Stream not supported"
|
||||||
elif [[ ! -z ${RTSP_STREAM} ]];then
|
elif [[ ! -z ${RTSP_STREAM} ]];then
|
||||||
@@ -22,11 +25,11 @@ elif [[ ! -z ${RTSP_STREAM} ]];then
|
|||||||
SELECTED_RSTP_STREAM=${RSTP_STREAMS_EXPLODED_ARRAY[0]}
|
SELECTED_RSTP_STREAM=${RSTP_STREAMS_EXPLODED_ARRAY[0]}
|
||||||
fi
|
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' \
|
-b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \
|
||||||
-f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re
|
-f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re
|
||||||
else
|
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' \
|
-b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \
|
||||||
-f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re
|
-f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ function service_status($name) {
|
|||||||
<div class="servicecontrols">
|
<div class="servicecontrols">
|
||||||
<form action="" method="GET">
|
<form action="" method="GET">
|
||||||
<h3>Live Audio Stream <?php echo service_status("livestream.service");?></h3>
|
<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 stop livestream.service && sudo systemctl stop icecast2.service">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 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 /etc/init.d/icecast2 stop">Disable</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 /etc/init.d/icecast2 start && sudo systemctl enable --now livestream.service">Enable</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>
|
||||||
<form action="" method="GET">
|
<form action="" method="GET">
|
||||||
<h3>Web Terminal <?php echo service_status("web_terminal.service");?></h3>
|
<h3>Web Terminal <?php echo service_status("web_terminal.service");?></h3>
|
||||||
|
|||||||
+13
-1
@@ -1,8 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
# set -x
|
||||||
# Make sox spectrogram
|
# Make sox spectrogram
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
|
|
||||||
|
# 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)"
|
analyzing_now="$(cat $HOME/BirdNET-Pi/analyzing_now.txt)"
|
||||||
|
|
||||||
if [ ! -z "${analyzing_now}" ] && [ -f "${analyzing_now}" ]; then
|
if [ ! -z "${analyzing_now}" ] && [ -f "${analyzing_now}" ]; then
|
||||||
spectrogram_png=${EXTRACTED}/spectrogram.png
|
spectrogram_png=${EXTRACTED}/spectrogram.png
|
||||||
sox -V1 "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now//$HOME\/}" -o "${spectrogram_png}"
|
sox -V1 "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now//$HOME\//}" -o "${spectrogram_png}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sleep $SLEEP_DELAY
|
||||||
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user