Merge pull request #817 from jaredb7/Misc-Fixes-and-Enhancements__mcguirepr89-
Misc UI fixes and Enhancements
This commit is contained in:
@@ -1,4 +1,24 @@
|
||||
<?php
|
||||
$sys_timezone = "";
|
||||
// If we can get the timezome from the systems timezone file ust that
|
||||
if (file_exists('/etc/timezone')) {
|
||||
$tz_data = file_get_contents('/etc/timezone');
|
||||
if ($tz_data !== false) {
|
||||
$sys_timezone = trim($tz_data);
|
||||
}
|
||||
} else {
|
||||
// Else get timezone from the timedatectl command
|
||||
$tz_data = shell_exec('timedatectl show');
|
||||
$tz_data_array = parse_ini_string($tz_data);
|
||||
if (is_array($tz_data_array) && array_key_exists('Timezone', $tz_data_array)) {
|
||||
$sys_timezone = $tz_data_array['Timezone'];
|
||||
}
|
||||
}
|
||||
//Finally if we have a valod timezone, set it as the one PHP uses
|
||||
if ($sys_timezone !== "") {
|
||||
date_default_timezone_set($sys_timezone);
|
||||
}
|
||||
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
||||
|
||||
+21
-1
@@ -1,4 +1,24 @@
|
||||
<?php
|
||||
<?php
|
||||
$sys_timezone = "";
|
||||
// If we can get the timezome from the systems timezone file ust that
|
||||
if (file_exists('/etc/timezone')) {
|
||||
$tz_data = file_get_contents('/etc/timezone');
|
||||
if ($tz_data !== false) {
|
||||
$sys_timezone = trim($tz_data);
|
||||
}
|
||||
} else {
|
||||
// Else get timezone from the timedatectl command
|
||||
$tz_data = shell_exec('timedatectl show');
|
||||
$tz_data_array = parse_ini_string($tz_data);
|
||||
if (is_array($tz_data_array) && array_key_exists('Timezone', $tz_data_array)) {
|
||||
$sys_timezone = $tz_data_array['Timezone'];
|
||||
}
|
||||
}
|
||||
//Finally if we have a valod timezone, set it as the one PHP uses
|
||||
if ($sys_timezone !== "") {
|
||||
date_default_timezone_set($sys_timezone);
|
||||
}
|
||||
|
||||
session_start();
|
||||
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
||||
$user = trim($user);
|
||||
|
||||
@@ -298,7 +298,7 @@ if (file_exists('./scripts/thisrun.txt')) {
|
||||
//Fix up the new element so it's visible, set the style so it's sligned correctly
|
||||
new_url_input_template.setAttribute("id", "rtsp_stream_url_new_" + number_of_new_rtsp_urls_added);
|
||||
new_url_input_template.setAttribute("name", "rtsp_stream_new_" + number_of_new_rtsp_urls_added);
|
||||
new_url_input_template.setAttribute("style", "margin-left: 107px");
|
||||
new_url_input_template.removeAttribute("style");
|
||||
|
||||
//Insert the new input field before the button to add new urls
|
||||
var newrtspstream_button = document.getElementById('newrtspstream_button_container');
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ if(isset($_GET["latitude"])){
|
||||
echo "<script>setTimeout(
|
||||
function() {
|
||||
const xhttp = new XMLHttpRequest();
|
||||
xhttp.open(\"GET\", \"scripts/config.php?restart_php=true\", true);
|
||||
xhttp.open(\"GET\", \"./config.php?restart_php=true\", true);
|
||||
xhttp.send();
|
||||
}, 1000);</script>";
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<div class="customlabels column1">
|
||||
<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">
|
||||
<select name="species[]" id="species" multiple size="auto">
|
||||
<option>Choose a species below to add to the Excluded Species List</option>
|
||||
<?php
|
||||
@@ -53,5 +54,73 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var search_term = document.querySelector("input#exclude_species_searchterm");
|
||||
search_term.addEventListener("keydown", doSearch);
|
||||
//Index where we found a match
|
||||
var search_match_idx = 1;
|
||||
var last_search_term = "";
|
||||
|
||||
function doSearch(eventObj) {
|
||||
//Don't do anything if the user is till composing
|
||||
if (eventObj.isComposing || eventObj.keyCode === 229) {
|
||||
return;
|
||||
}
|
||||
|
||||
//If the key pressed is the enter key capture it, stop the form submitting and do the search
|
||||
if (eventObj.key === 'Enter' || eventObj.keyCode === 13) {
|
||||
eventObj.preventDefault();
|
||||
|
||||
//User wants to submit the text as a search
|
||||
var search_text = search_term.value.toLowerCase();
|
||||
|
||||
//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 (search_text !== last_search_term) {
|
||||
//Also unselect the last match
|
||||
species_select_list[search_match_idx].removeAttribute('selected');
|
||||
search_match_idx = 1;
|
||||
}
|
||||
|
||||
//Start the loop at 1 so we skip the very initial value asking the user to select a option
|
||||
for (let i = search_match_idx; i < species_select_list.length; i++) {
|
||||
// if (species_select_list[i] !== 'undefined') {
|
||||
option_text = species_select_list[i].value;
|
||||
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');
|
||||
//Go to the next item
|
||||
i++
|
||||
continue;
|
||||
}
|
||||
|
||||
//There was a match,
|
||||
if (search_match_text === true) {
|
||||
//already on this item so skip it and continue with list
|
||||
if (search_match_idx === i) {
|
||||
i++
|
||||
continue;
|
||||
}
|
||||
//Finally we havent found this item before
|
||||
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);
|
||||
//break the loop
|
||||
break;
|
||||
}
|
||||
// }
|
||||
}
|
||||
//Track what search term was used so we know when to start over
|
||||
last_search_term = search_text
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
+59
-55
@@ -4,63 +4,67 @@
|
||||
echo "........................................IPs....................................."
|
||||
echo "LAN IP: $(hostname -I|cut -d' ' -f1)"
|
||||
echo "Public IP: $(curl -s4 ifconfig.co)"
|
||||
echo "..................................\`vcgencmd stats\`.............................."
|
||||
sudo -u$USER vcgencmd get_throttled
|
||||
hex=$(sudo -u$USER vcgencmd get_throttled|cut -d'x' -f2)
|
||||
binary=$(echo "ibase=16;obase=2;$hex"|bc)
|
||||
echo "Binary: $binary";
|
||||
revbinary=$(echo $binary|rev)
|
||||
if echo $binary | grep 1 ;then
|
||||
echo "ISSUES DETECTED"
|
||||
if [ ${revbinary:0:1} -eq 1 &> /dev/null ];then
|
||||
message="Under-voltage detected"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i voltage
|
||||
fi
|
||||
if [ ${revbinary:1:1} -eq 1 &> /dev/null ];then
|
||||
message="Arm frequency capped"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i frequen
|
||||
fi
|
||||
if [ ${revbinary:2:1} -eq 1 &> /dev/null ];then
|
||||
message="Currently Throttled"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i throttl
|
||||
fi
|
||||
if [ ${revbinary:3:1} -eq 1 &> /dev/null ];then
|
||||
message="Soft temperatue limit active"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i temperature
|
||||
fi
|
||||
if [ ${revbinary:16:1} -eq 1 &> /dev/null ];then
|
||||
message="Under-voltage has occurred"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i voltage
|
||||
fi
|
||||
if [ ${revbinary:17:1} -eq 1 &> /dev/null ];then
|
||||
message="Arm frequency capping has occurred"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i frequen
|
||||
fi
|
||||
if [ ${revbinary:18:1} -eq 1 &> /dev/null ];then
|
||||
message="Throttling has occurred"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i throttl
|
||||
fi
|
||||
if [ ${revbinary:19:1} -eq 1 &> /dev/null ];then
|
||||
message="Soft temperature limit has occurred"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i temperature
|
||||
if [ ! "$(dpkg -l | ! grep -q "vcgencmd")" ]
|
||||
then
|
||||
echo "..................................\`vcgencmd stats\`.............................."
|
||||
sudo -u$USER vcgencmd get_throttled
|
||||
hex=$(sudo -u$USER vcgencmd get_throttled | cut -d'x' -f2)
|
||||
binary=$(echo "ibase=16;obase=2;$hex" | bc)
|
||||
echo "Binary: $binary"
|
||||
revbinary=$(echo $binary | rev)
|
||||
if echo $binary | grep 1; then
|
||||
echo "ISSUES DETECTED"
|
||||
if [ ${revbinary:0:1} -eq 1 ] &>/dev/null; then
|
||||
message="Under-voltage detected"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i voltage
|
||||
fi
|
||||
if [ ${revbinary:1:1} -eq 1 ] &>/dev/null; then
|
||||
message="Arm frequency capped"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i frequen
|
||||
fi
|
||||
if [ ${revbinary:2:1} -eq 1 ] &>/dev/null; then
|
||||
message="Currently Throttled"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i throttl
|
||||
fi
|
||||
if [ ${revbinary:3:1} -eq 1 ] &>/dev/null; then
|
||||
message="Soft temperatue limit active"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i temperature
|
||||
fi
|
||||
if [ ${revbinary:16:1} -eq 1 ] &>/dev/null; then
|
||||
message="Under-voltage has occurred"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i voltage
|
||||
fi
|
||||
if [ ${revbinary:17:1} -eq 1 ] &>/dev/null; then
|
||||
message="Arm frequency capping has occurred"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i frequen
|
||||
fi
|
||||
if [ ${revbinary:18:1} -eq 1 ] &>/dev/null; then
|
||||
message="Throttling has occurred"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i throttl
|
||||
fi
|
||||
if [ ${revbinary:19:1} -eq 1 ] &>/dev/null; then
|
||||
message="Soft temperature limit has occurred"
|
||||
echo "$message"
|
||||
dmesg -H | grep -i temperature
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "....................................Clock Speeds................................"
|
||||
for i in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi; do
|
||||
echo -e "${i}:\t$(sudo -u$USER vcgencmd measure_clock ${i})"
|
||||
done
|
||||
echo "........................................Volts..................................."
|
||||
for i in core sdram_c sdram_i sdram_p; do
|
||||
echo -e "${i}:\t$(sudo -u$USER vcgencmd measure_volts ${i})"
|
||||
done
|
||||
fi
|
||||
echo "....................................Clock Speeds................................"
|
||||
for i in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi;do
|
||||
echo -e "${i}:\t$(sudo -u$USER vcgencmd measure_clock ${i})"
|
||||
done
|
||||
echo "........................................Volts..................................."
|
||||
for i in core sdram_c sdram_i sdram_p;do
|
||||
echo -e "${i}:\t$(sudo -u$USER vcgencmd measure_volts ${i})"
|
||||
done
|
||||
echo ".....................................Caddyfile.................................."
|
||||
cat /etc/caddy/Caddyfile
|
||||
echo ".................................... Crontab...................................."
|
||||
|
||||
@@ -214,8 +214,8 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse
|
||||
<?php } ?>
|
||||
<form action="" method="GET">
|
||||
<input type="hidden" name="view" value="Species Stats">
|
||||
<button type="submit" name="species" value="<?php echo $mostrecent['Com_Name'];?>"><?php echo $mostrecent['Com_Name'];?></button><img style="width: unset !important;display: inline;height: 1em;cursor:pointer" title="View species stats" onclick="generateMiniGraph(this, '<?php echo $comname; ?>')" width=25 src="images/chart.svg"></br>
|
||||
<a href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="_blank"/><i><?php echo $mostrecent['Sci_Name'];?></i></a>
|
||||
<button type="submit" name="species" value="<?php echo $mostrecent['Com_Name'];?>"><?php echo $mostrecent['Com_Name'];?></button><img style="width: unset !important;display: inline;height: 1em;cursor:pointer" title="View species stats" onclick="generateMiniGraph(this, '<?php echo $comname; ?>')" width=25 src="images/chart.svg"><br>
|
||||
<a href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="_blank"><i><?php echo $mostrecent['Sci_Name'];?></i></a>
|
||||
<br>Confidence: <?php echo $percent = round((float)round($mostrecent['Confidence'],2) * 100 ) . '%';?><br></div><br>
|
||||
<video style="margin-top:10px" onplay='setLiveStreamVolume(0)' onended='setLiveStreamVolume(1)' onpause='setLiveStreamVolume(1)' controls poster="<?php echo $filename.".png";?>" preload="none" title="<?php echo $filename;?>"><source src="<?php echo $filename;?>"></video></td>
|
||||
</form>
|
||||
|
||||
+78
-17
@@ -14,18 +14,65 @@ $RECS_DIR = $config["RECS_DIR"];
|
||||
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
||||
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
||||
$home = trim($home);
|
||||
$files = scandir($RECS_DIR."/".date('F-Y')."/".date('d-l')."/", SCANDIR_SORT_ASCENDING);
|
||||
|
||||
//Replace variables to Fix up the file paths just in case the ENV environment variables don't resolve via PHP
|
||||
$RECS_DIR = str_replace("\$HOME", $home, $RECS_DIR);
|
||||
$STREAM_DATA_DIR = $RECS_DIR . "/StreamData/";
|
||||
|
||||
//Try find the latest file out of the soundcard recording folder
|
||||
$look_in_directory = $RECS_DIR."/".date('F-Y')."/".date('d-l')."/";
|
||||
$files = scandir($look_in_directory, SCANDIR_SORT_ASCENDING);
|
||||
//Extract the filename, positions 0 and 1 are the folder hierarchy '.' and '..'
|
||||
$newest_file = $files[2];
|
||||
|
||||
//Couldn't find under e.g /home/pi/April-2023/03-Monday/ (where USB audio streams are recorded
|
||||
//look in the StreamData directory (RTSP streams are recorded here)
|
||||
if (empty($files) || array_key_exists(2, $files) === false) {
|
||||
$look_in_directory = $STREAM_DATA_DIR;
|
||||
|
||||
//Load the file in the directory
|
||||
$files = scandir($look_in_directory, SCANDIR_SORT_ASCENDING);
|
||||
|
||||
//Because there might be more than 1 stream, we can't really assume the file at index 2 is the latest, or even for the stream being listened to
|
||||
//Read the RTSP_STREAM_TO_LIVESTREAM setting, then try to find that CSV file
|
||||
if(!empty($config['RTSP_STREAM_TO_LIVESTREAM']) && is_numeric($config['RTSP_STREAM_TO_LIVESTREAM'])){
|
||||
//The stored setting of RTSP_STREAM_TO_LIVESTREAM is 0 based, but filenames are 1's based, so just add 1 to the config value
|
||||
//so we can match up the stream the user is listening to with the appropriate filename
|
||||
$RTSP_STREAM_LISTENED_TO = ($config['RTSP_STREAM_TO_LIVESTREAM'] + 1);
|
||||
}else{
|
||||
//Setting is invalid somehow
|
||||
//The stored setting of RTSP_STREAM_TO_LIVESTREAM is 0 based, but filenames are 1's based, so just add 1 to the config value
|
||||
//This will be the first stream
|
||||
$RTSP_STREAM_LISTENED_TO = 1;
|
||||
}
|
||||
|
||||
//The RTSP streams contain 'RTSP_X' in the filename, were X is the stream url index in the comma separated list of RTSP streams
|
||||
//We can use this to locate the file for this stream
|
||||
foreach ($files as $file_idx => $stream_file_name) {
|
||||
//Skip the folder hierarchy entries
|
||||
if ($stream_file_name != "." && $stream_file_name != "..") {
|
||||
//See if the filename contains the correct RTSP name, also only check .wav files by excluding the csv files with the filter .wav.csv
|
||||
if (stripos($stream_file_name, 'RTSP_' . $RTSP_STREAM_LISTENED_TO) !== false && stripos($stream_file_name, '.wav.csv') === false) {
|
||||
//Found a match - set it as the newest file
|
||||
$newest_file = $stream_file_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//If the newest file param has been supplied and it's the same as the newest file found
|
||||
//then stop processing
|
||||
if($newest_file == $_GET['newest_file']) {
|
||||
die();
|
||||
}
|
||||
|
||||
//Print out the filename
|
||||
echo "file,".$newest_file."\n";
|
||||
|
||||
//Print out the detected birds as CSV
|
||||
$row = 1;
|
||||
if (($handle = fopen($RECS_DIR."/".date('F-Y')."/".date('d-l')."/".$newest_file.".csv", "r")) !== FALSE) {
|
||||
if (($handle = fopen($look_in_directory . $newest_file . ".csv", "r")) !== FALSE) {
|
||||
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
||||
if($row != 1){
|
||||
$num = count($data);
|
||||
@@ -38,23 +85,25 @@ if (($handle = fopen($RECS_DIR."/".date('F-Y')."/".date('d-l')."/".$newest_file.
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
//Kill the script so no further processing or output is done
|
||||
die();
|
||||
}
|
||||
|
||||
$RSTP_Stream_Config = array();
|
||||
//Hold the array of RTSP steams once they are exploded
|
||||
$RTSP_Stream_Config = array();
|
||||
|
||||
//Load the birdnet config so we can read the RSTP setting
|
||||
//Load the birdnet config so we can read the RTSP setting
|
||||
// Valid config data
|
||||
if (is_array($config) && array_key_exists('RTSP_STREAM',$config)) {
|
||||
if (is_null($config['RTSP_STREAM']) === false && $config['RTSP_STREAM'] !== "") {
|
||||
$RSTP_Stream_Config_Data = explode(",", $config['RTSP_STREAM']);
|
||||
$RTSP_Stream_Config_Data = explode(",", $config['RTSP_STREAM']);
|
||||
|
||||
//Process the stream further
|
||||
//we need to able to ID it (just do this by position), get the hostname to show in the dropdown box
|
||||
foreach ($RSTP_Stream_Config_Data as $stream_idx => $stream_url) {
|
||||
foreach ($RTSP_Stream_Config_Data as $stream_idx => $stream_url) {
|
||||
//$stream_idx is the array position of the the RSP stream URL, idx of 0 is the first, 1 - second etc
|
||||
$rstp_stream_url = parse_url($stream_url);
|
||||
$RSTP_Stream_Config[$stream_idx] = $rstp_stream_url['host'];
|
||||
$RTSP_stream_url = parse_url($stream_url);
|
||||
$RTSP_Stream_Config[$stream_idx] = $RTSP_stream_url['host'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,21 +208,27 @@ function applyText(text,x,y,opacity) {
|
||||
|
||||
var add =0;
|
||||
var newest_file;
|
||||
var newest_file_tmp;
|
||||
var lastbird;
|
||||
function loadDetectionIfNewExists() {
|
||||
const xhttp = new XMLHttpRequest();
|
||||
xhttp.onload = function() {
|
||||
// if there's a new detection that needs to be updated to the page
|
||||
if(this.responseText.length > 0 && !this.responseText.includes("Database")) {
|
||||
|
||||
// Case insensitive match for RTSP_X
|
||||
var RTSP_regex = /RTSP_[0-9]+-/i;
|
||||
var RTSP_regex_match = false;
|
||||
var split = this.responseText.split("\n")
|
||||
for(var i = 1;i < split.length; i++) {
|
||||
if(parseInt(split[i].split(",")[0]) >= 0){
|
||||
|
||||
newest_file = split[0].split(",")[1]
|
||||
newest_file_tmp = newest_file;//Copy the file name var so we something to work with
|
||||
//Remove the string that denotes the RTSP stream from the filename to make things easier, it's not really needed
|
||||
RTSP_regex_match = RTSP_regex.test(newest_file_tmp)
|
||||
newest_file_tmp = newest_file_tmp.replace(RTSP_regex, "")
|
||||
//applyText(split[i].split(",")[1],document.body.querySelector('canvas').width - ((parseInt(split[i].split(",")[0]))*avgfps), (document.body.querySelector('canvas').height * 0.50))
|
||||
|
||||
d1 = new Date(newest_file.split("-")[0]+"/"+newest_file.split("-")[1]+"/"+newest_file.split("-")[2]+ " "+newest_file.split("-")[4].replace(".wav",""))
|
||||
d1 = new Date(newest_file_tmp.split("-")[0]+"/"+newest_file_tmp.split("-")[1]+"/"+newest_file_tmp.split("-")[2]+ " "+newest_file_tmp.split("-")[4].replace(".wav",""))
|
||||
console.log("d1 "+d1)
|
||||
d2 = new Date(xhttp.getResponseHeader("Date"));
|
||||
console.log("d2 "+d2)
|
||||
@@ -193,7 +248,13 @@ function loadDetectionIfNewExists() {
|
||||
console.log(add)
|
||||
|
||||
// Date csv file was created + relative detection time of bird + mic delay
|
||||
secago = Math.abs(timeDiff) - split[i].split(",")[0] - 6.8;
|
||||
//If we can't find the regex in the filename, then the RTSP_X string doesn't exist, unlikely to be a RTSP stream
|
||||
if (RTSP_regex_match == false){
|
||||
secago = (Math.abs(timeDiff) - split[i].split(",")[0]) - 6.8;
|
||||
}else{
|
||||
//half the delay for RTSP streams ~ just a rough guess
|
||||
secago = (Math.abs(timeDiff) - split[i].split(",")[0]) - 4;
|
||||
}
|
||||
|
||||
x = document.body.querySelector('canvas').width - ((parseInt(secago))*avgfps);
|
||||
// if the text is too close to the right side of the canvas and will be cut off, wait 3 seconds before adding text
|
||||
@@ -361,16 +422,16 @@ h1 {
|
||||
|
||||
<div class="centered">
|
||||
<?php
|
||||
if (isset($RSTP_Stream_Config) && !empty($RSTP_Stream_Config)) {
|
||||
if (isset($RTSP_Stream_Config) && !empty($RTSP_Stream_Config)) {
|
||||
?>
|
||||
<div style="display:inline" id="rstp_streams">
|
||||
<div style="display:inline" id="RTSP_streams">
|
||||
<label>RTSP Stream: </label>
|
||||
<select id="rtsp_stream_select" name="RTSP Streams">
|
||||
<?php
|
||||
//The setting representing which livestream to stream is more than the number of RTSP streams available
|
||||
//maybe the list of streams has been modified
|
||||
//This isn't the ideal for this, but needed a way to fix this setting without calling the advanced setting page
|
||||
if (array_key_exists($config['RTSP_STREAM_TO_LIVESTREAM'], $RSTP_Stream_Config) === false) {
|
||||
if (array_key_exists($config['RTSP_STREAM_TO_LIVESTREAM'], $RTSP_Stream_Config) === false) {
|
||||
$contents = file_get_contents('/etc/birdnet/birdnet.conf');
|
||||
$contents2 = file_get_contents('./scripts/thisrun.txt');
|
||||
$contents = preg_replace("/RTSP_STREAM_TO_LIVESTREAM=.*/", "RTSP_STREAM_TO_LIVESTREAM=\"0\"", $contents);
|
||||
@@ -383,7 +444,7 @@ h1 {
|
||||
}
|
||||
|
||||
//Print out the dropdown list for the RTSP streams
|
||||
foreach ($RSTP_Stream_Config as $stream_id => $stream_host) {
|
||||
foreach ($RTSP_Stream_Config as $stream_id => $stream_host) {
|
||||
$isSelected = "";
|
||||
//Match up the selected value saved in config so we can preselect it
|
||||
if ($config['RTSP_STREAM_TO_LIVESTREAM'] == $stream_id) {
|
||||
@@ -420,7 +481,7 @@ h1 {
|
||||
|
||||
<script>
|
||||
var rtsp_stream_select = document.getElementById("rtsp_stream_select");
|
||||
//When the dropdown selection is changed set the new value is settings, then restart the livestream service so it broadcasts newly selected RSTP stream
|
||||
//When the dropdown selection is changed set the new value is settings, then restart the livestream service so it broadcasts newly selected RTSP stream
|
||||
rtsp_stream_select.onchange = function() {
|
||||
if (this.value !== 'undefined'){
|
||||
// Get the audio player element
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
# Make sox spectrogram
|
||||
source /etc/birdnet/birdnet.conf
|
||||
analyzing_now="$(cat $HOME/BirdNET-Pi/analyzing_now.txt)"
|
||||
spectrogram_png=${EXTRACTED}/spectrogram.png
|
||||
sox -V1 "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now//$HOME\/}" -o "${spectrogram_png}"
|
||||
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
|
||||
|
||||
@@ -213,7 +213,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
|
||||
$_SESSION['images'] = [];
|
||||
}
|
||||
$iterations = 0;
|
||||
$lines;
|
||||
$lines=null;
|
||||
$licenses_urls = array();
|
||||
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
@@ -324,7 +324,8 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
|
||||
</td>
|
||||
<?php } else { //legacy mode ?>
|
||||
<tr class="relative" id="<?php echo $iterations; ?>">
|
||||
<td><?php if($_GET['kiosk'] == true) { echo relativeTime(strtotime($todaytable['Time'])); } else {echo $todaytable['Time'];}?><br></td><td id="recent_detection_middle_td">
|
||||
<td><?php if($_GET['kiosk'] == true) { echo relativeTime(strtotime($todaytable['Time'])); } else {echo $todaytable['Time'];}?><br></td>
|
||||
<td id="recent_detection_middle_td">
|
||||
<div>
|
||||
<div>
|
||||
<?php if(!empty($config["FLICKR_API_KEY"]) && (isset($_GET['hard_limit']) || $_GET['kiosk'] == true) && strlen($image[2]) > 0) { ?>
|
||||
@@ -332,14 +333,31 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div>
|
||||
<b><a class="a2" <?php if($_GET['kiosk'] == false){?>href="https://allaboutbirds.org/guide/<?php echo $comname;?>"<?php } else {echo "style='color:blue;'";} ?> target="top"><?php echo $todaytable['Com_Name'];?></a></b> <img style="height: 1em;cursor:pointer;float:unset;display:inline" title="View species stats" onclick="generateMiniGraph(this, '<?php echo $comname; ?>')" width=25 src="images/chart.svg"><br>
|
||||
<a class="a2" <?php if($_GET['kiosk'] == false){?>href="https://wikipedia.org/wiki/<?php echo $sciname;?>"<?php } else {echo "style='color:blue;'";} ?> target="top"><i><?php echo $todaytable['Sci_Name'];?></i></a><br></td>
|
||||
</div></div>
|
||||
<b><a class="a2" <?php if($_GET['kiosk'] == false){?>href="https://allaboutbirds.org/guide/<?php echo $comname;?>"<?php } else {echo "style='color:blue;'";} ?> target="top"><?php echo $todaytable['Com_Name'];?></a></b>
|
||||
<?php
|
||||
//If on mobile, add in a icon to link off to the recording so the user can see more info
|
||||
if (isset($_GET['mobile'])) {
|
||||
?>
|
||||
<br>
|
||||
<img style="height: 1em;cursor:pointer;float:unset;display:inline" title="View species stats" onclick="generateMiniGraph(this, '<?php echo $comname; ?>')" width=25 src="images/chart.svg">
|
||||
<a target="_blank" href="index.php?filename=<?php echo $todaytable['File_Name']; ?>"><img style="height: 1em;cursor:pointer;float:unset;display:inline" class="copyimage-mobile" title="Open in new tab" width=16 src="images/copy.png"></a>'
|
||||
<?php
|
||||
}else{
|
||||
//Else just put the species stats icon
|
||||
?>
|
||||
<img style="height: 1em;cursor:pointer;float:unset;display:inline" title="View species stats" onclick="generateMiniGraph(this, '<?php echo $comname; ?>')" width=25 src="images/chart.svg">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<a class="a2" <?php if($_GET['kiosk'] == false){?>href="https://wikipedia.org/wiki/<?php echo $sciname;?>"<?php } else {echo "style='color:blue;'";} ?> target="top"><i><?php echo $todaytable['Sci_Name'];?></i></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><b>Confidence:</b> <?php echo round((float)round($todaytable['Confidence'],2) * 100 ) . '%';?><br></td>
|
||||
<?php if(!isset($_GET['mobile'])) { ?>
|
||||
<td style="min-width:180px"><audio controls preload="none" title="<?php echo $filename;?>"><source preload="none" src="<?php echo $filename;?>"></video>
|
||||
<td style="min-width:180px"><audio controls preload="none" title="<?php echo $filename;?>"><source preload="none" src="<?php echo $filename;?>"></audio></td>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php }?>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user