Merge branch 'main' into ui-tweaks

This commit is contained in:
ehpersonal38
2022-05-16 13:33:06 -04:00
10 changed files with 71 additions and 21 deletions
+3 -3
View File
@@ -33,8 +33,8 @@ if(isset($_GET['submit'])) {
if(isset($_GET["caddy_pwd"])) {
$caddy_pwd = $_GET["caddy_pwd"];
if(strcmp($caddy_pwd,$config['CADDY_PWD']) !== 0) {
$contents = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents);
$contents2 = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents2);
$contents = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=\"$caddy_pwd\"", $contents);
$contents2 = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=\"$caddy_pwd\"", $contents2);
$fh = fopen('/etc/birdnet/birdnet.conf', "w");
$fh2 = fopen("./scripts/thisrun.txt", "w");
fwrite($fh, $contents);
@@ -235,7 +235,7 @@ foreach($formats as $format){
<label for="caddy_pwd">Password: </label>
<input name="caddy_pwd" type="text" value="<?php print($newconfig['CADDY_PWD']);?>" /><br>
<h3>Custom URL</h3>
<p><a href="mailto:@gmail.com?subject=Request%20BirdNET-Pi%20Subdomain&body=<?php include('birdnetpi_request.php'); ?>" target="_blank">Email Me</a> if you would like a BirdNETPi.com subdomain. This would be, <i>https://YourLocation.birdnetpi.com</i></p>
<p><a href="mailto:mcguirepr89@gmail.com?subject=Request%20BirdNET-Pi%20Subdomain&body=<?php include('birdnetpi_request.php'); ?>" target="_blank">Email Me</a> if you would like a BirdNETPi.com subdomain. This would be, <i>https://YourLocation.birdnetpi.com</i></p>
<p>When you update the URL below, the web server will reload, so be sure to wait at least 30 seconds and then go to your new URL.</p>
<label for="birdnetpi_url">BirdNET-Pi URL: </label>
<input name="birdnetpi_url" type="url" value="<?php print($newconfig['BIRDNETPI_URL']);?>" /><br>
+49 -2
View File
@@ -1,5 +1,5 @@
<?php
error_reporting(E_ALL);
error_reporting(E_ERROR);
ini_set('display_errors',1);
# Basic Settings
@@ -21,6 +21,21 @@ if(isset($_GET['apprise_notify_each_species'])) {
exec('sudo systemctl stop pushed_notifications.service');
}
// logic for setting the date and time based on user inputs from the form below
if(isset($_GET['date']) && isset($_GET['time'])) {
// can't set the date manually if it's getting it from the internet, disable ntp
exec("sudo timedatectl set-ntp false");
exec("sudo date -s '".$_GET['date']." ".$_GET['time']."'");
} else {
// user checked 'use time from internet if available,' so make sure that's on
if(strlen(trim(exec("sudo timedatectl | grep \"NTP service: active\""))) == 0){
exec("sudo timedatectl set-ntp true");
sleep(3);
}
}
$contents = file_get_contents("/etc/birdnet/birdnet.conf");
@@ -164,9 +179,41 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}
<option value="labels_uk.txt">Ukrainian</option>
</select>
<br><br>
<script>
function handleChange(checkbox) {
// this disables the input of manual date and time if the user wants to use the internet time
var date=document.getElementById("date");
var time=document.getElementById("time");
if(checkbox.checked) {
date.setAttribute("disabled", "disabled");
time.setAttribute("disabled", "disabled");
} else {
date.removeAttribute("disabled");
time.removeAttribute("disabled");
}
}
</script>
<?php
// if NTP service is active, show the checkboxes as checked, and disable the manual input
$tdc = trim(exec("sudo timedatectl | grep \"NTP service: active\""));
if (strlen($tdc) > 0) {
$checkedvalue = "checked";
$disabledvalue = "disabled";
} else {
$checkedvalue = "";
$disabledvalue = "";
}
?>
<label for="appt">Select a Date and Time:</label><br>
<span>If connected to the internet, retrieve time automatically?</span>
<input type="checkbox" onchange='handleChange(this)' name="apprise_notify_each_detection" <?php echo $checkedvalue; ?> ><br>
<input onclick="this.showPicker()" type="date" id="date" name="date" value="<?php echo date('Y-m-d') ?>" <?php echo $disabledvalue; ?>>
<input onclick="this.showPicker()" type="time" id="time" name="time" value="<?php echo date('H:i') ?>" <?php echo $disabledvalue; ?>>
<br><br><br>
<input type="hidden" name="status" value="success">
<input type="hidden" name="submit" value="settings">
<button onclick="if(Boolean(Number(<?php print($config['APPRISE_NOTIFY_EACH_DETECTION']); ?>)) != document.getElementsByName('apprise_notify_each_detection')[0].checked) type="submit" name="view" value="Settings">
<button type="submit" name="view" value="Settings">
<?php
if(isset($_GET['status'])){
echo "Success!";
+3 -3
View File
@@ -116,11 +116,11 @@ for h in "${SCAN_DIRS[@]}";do
END=${RECORDING_LENGTH}
fi
sox "${h}/${OLDFILE}" "${NEWSPECIES_BYDATE}/${NEWFILE}" \
trim "${START}" "${END}"
sox -V1 "${h}/${OLDFILE}" "${NEWSPECIES_BYDATE}/${NEWFILE}" \
trim ="${START}" ="${END}"
# Create spectrogram for extraction
sox "${NEWSPECIES_BYDATE}/${NEWFILE}" -n remix 1 rate 24k spectrogram \
sox -V1 "${NEWSPECIES_BYDATE}/${NEWFILE}" -n remix 1 rate 24k spectrogram \
-t "${COMMON_NAME}" \
-c "${NEWSPECIES_BYDATE//$HOME\/}/${NEWFILE}" \
-o "${NEWSPECIES_BYDATE}/${NEWFILE}.png"
+1 -1
View File
@@ -212,7 +212,7 @@ http://localhost http://$(hostname).local ${BIRDNETPI_URL} {
handle /Charts/* {
file_server browse
}
basicauth views.php?view=File* {
basicauth /views.php?view=File* {
birdnet ${HASHWORD}
}
basicauth /Processed* {
-1
View File
@@ -7,7 +7,6 @@ my_dir=$HOME/BirdNET-Pi/scripts
sudo systemctl stop birdnet_server.service
sudo pkill server.py
sudo systemctl stop birdnet_recording.service
sudo rm -rf ${RECS_DIR}/$(date +%B-%Y/%d-%A)/*
services=(web_terminal.service
spectrogram_viewer.service
pushed_notifications.service
+1 -1
View File
@@ -3,4 +3,4 @@
source /etc/birdnet/birdnet.conf
analyzing_now="$(cat $HOME/BirdNET-Pi/analyzing_now.txt)"
spectrogram_png=${EXTRACTED}/spectrogram.png
sox "${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}"
+2 -1
View File
@@ -6,6 +6,7 @@ USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)
HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)
my_dir=$HOME/BirdNET-Pi/scripts
sudo -u$USER git -C $my_dir rm privacy_server.py
sudo -u${USER} git -C $my_dir stash
sudo -u${USER} git -C $my_dir pull -f
sudo systemctl daemon-reload
@@ -14,4 +15,4 @@ sudo ln -sf $my_dir/* /usr/local/bin/
# The script below handles changes to the host system
# Any additions to the updater should be placed in that file.
sudo $my_dir/update_birdnet_snippets.sh
sudo $my_dir/update_birdnet_snippets.sh
+1 -1
View File
@@ -18,7 +18,7 @@ http://localhost http://$(hostname).local ${BIRDNETPI_URL} {
handle /Charts/* {
file_server browse
}
basicauth views.php?view=File* {
basicauth /views.php?view=File* {
birdnet ${HASHWORD}
}
basicauth /Processed* {