Merge branch 'main' of https://github.com/mcguirepr89/BirdNET-Pi into mcguirepr89-main
This commit is contained in:
@@ -51,6 +51,7 @@ Currently listening in these countries . . . that I know of . . .
|
||||
- Belgium
|
||||
- Israel
|
||||
- Ireland
|
||||
- Denmark
|
||||
|
||||
## Features
|
||||
* 24/7 recording and BirdNET-Lite analysis
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ body::-webkit-scrollbar {
|
||||
display:none
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="style.css?v=14.0.6">
|
||||
<link rel="stylesheet" href="style.css?v=6.22.22">
|
||||
<body>
|
||||
<div class="banner">
|
||||
<div class="logo">
|
||||
|
||||
@@ -777,3 +777,16 @@ form#views button .updatenumber {
|
||||
margin:0px;
|
||||
font-size: xx-large;
|
||||
}
|
||||
|
||||
.testbtn {
|
||||
background:#77c487 !important;
|
||||
}
|
||||
|
||||
pre.bash {
|
||||
background-color: black;
|
||||
color: white;
|
||||
font-size: medium ;
|
||||
font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ if(!isset($_SESSION['behind'])) {
|
||||
</style>
|
||||
<?php }}
|
||||
?>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="style.css?v=6.22.22">
|
||||
<style>
|
||||
body::-webkit-scrollbar {
|
||||
display:none
|
||||
|
||||
Binary file not shown.
@@ -11,5 +11,6 @@ seaborn
|
||||
streamlit
|
||||
plotly
|
||||
apprise
|
||||
paho-mqtt
|
||||
pytest==7.1.2
|
||||
pytest-mock==3.7.0
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
error_reporting(E_ERROR);
|
||||
ini_set('display_errors',1);
|
||||
|
||||
$db = new SQLite3('./birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
|
||||
function syslog_shell_exec($cmd, $sudo_user = null) {
|
||||
if ($sudo_user) {
|
||||
$cmd = "sudo -u $sudo_user $cmd";
|
||||
@@ -137,6 +139,54 @@ if(isset($_GET["latitude"])){
|
||||
shell_exec("sudo restart_services.sh");
|
||||
}
|
||||
|
||||
if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") {
|
||||
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
||||
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
||||
$home = trim($home);
|
||||
|
||||
if (file_exists('./thisrun.txt')) {
|
||||
$config = parse_ini_file('./thisrun.txt');
|
||||
} elseif (file_exists('./firstrun.ini')) {
|
||||
$config = parse_ini_file('./firstrun.ini');
|
||||
}
|
||||
|
||||
$cf = explode("\n",$_GET['apprise_config']);
|
||||
$cf = "'".implode("' '", $cf)."'";
|
||||
|
||||
$statement0 = $db->prepare('SELECT * FROM detections WHERE Date == DATE(\'now\', \'localtime\') ORDER BY TIME DESC LIMIT 1');
|
||||
$result0 = $statement0->execute();
|
||||
while($todaytable=$result0->fetchArray(SQLITE3_ASSOC))
|
||||
{
|
||||
$comname = $todaytable['Com_Name'];
|
||||
$filename = $todaytable['File_Name'];
|
||||
$sciname = $todaytable['Sci_Name'];
|
||||
$confidence = $todaytable["Confidence"];
|
||||
}
|
||||
|
||||
$title = $_GET['apprise_notification_title'];
|
||||
$body = $_GET['apprise_notification_body'];
|
||||
|
||||
if($config["BIRDNETPI_URL"] != "") {
|
||||
$filename = $config["BIRDNETPI_URL"]."?filename=".$filename;
|
||||
} else{
|
||||
$filename = "http://birdnetpi.local/"."?filename=".$filename;
|
||||
}
|
||||
|
||||
$title = str_replace("\$comname", $comname, $title);
|
||||
$title = str_replace("\$sciname", $sciname, $title);
|
||||
$title = str_replace("\$confidence", $confidence, $title);
|
||||
$title = str_replace("\$listenurl", $filename, $title);
|
||||
|
||||
$body = str_replace("\$comname", $comname, $body);
|
||||
$body = str_replace("\$sciname", $sciname, $body);
|
||||
$body = str_replace("\$confidence", $confidence, $body);
|
||||
$body = str_replace("\$listenurl", $filename, $body);
|
||||
|
||||
echo "<pre class=\"bash\">".shell_exec($home."/BirdNET-Pi/birdnet/bin/apprise -vv -t '".$title."' -b '".$body."' ".$cf." ")."</pre>";
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
?>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
@@ -177,6 +227,27 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
}
|
||||
?>
|
||||
|
||||
<script>
|
||||
function sendTestNotification(e) {
|
||||
document.getElementById("testsuccessmsg").innerHTML = "";
|
||||
e.classList.add("disabled");
|
||||
|
||||
var apprise_notification_title = document.getElementsByName("apprise_notification_title")[0].value;
|
||||
var apprise_notification_body = document.getElementsByName("apprise_notification_body")[0].value;
|
||||
var apprise_config = encodeURIComponent(document.getElementsByName("apprise_input")[0].value);
|
||||
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function() {
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||
document.getElementById("testsuccessmsg").innerHTML = this.responseText+" Test sent! Make sure to <b>Update Settings</b> below."
|
||||
e.classList.remove("disabled");
|
||||
}
|
||||
}
|
||||
xmlHttp.open("GET", "scripts/config.php?sendtest=true&apprise_notification_title="+apprise_notification_title+"&apprise_notification_body="+apprise_notification_body+"&apprise_config="+apprise_config, true); // true for asynchronous
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
</script>
|
||||
|
||||
<table class="settingstable"><tr><td>
|
||||
<h2>Location</h2>
|
||||
<label for="latitude">Latitude: </label>
|
||||
@@ -221,6 +292,9 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}
|
||||
<label for="apprise_notify_new_species_each_day">Notify each new species detection of the day</label><br>
|
||||
<input type="checkbox" name="apprise_notify_each_detection" <?php if($config['APPRISE_NOTIFY_EACH_DETECTION'] == 1 && filesize($home."/BirdNET-Pi/apprise.txt") != 0) { echo "checked"; };?> >
|
||||
<label for="apprise_notify_each_detection">Notify each new detection</label><br><br>
|
||||
|
||||
<button type="button" class="testbtn" onclick="sendTestNotification(this)">Send Test Notification</button><br>
|
||||
<span id="testsuccessmsg"></span>
|
||||
</td></tr></table><br>
|
||||
<table class="settingstable"><tr><td>
|
||||
<h2>Bird Photos from Flickr</h2>
|
||||
|
||||
@@ -56,7 +56,7 @@ if [[ "$apprise_installation_status" = "not installed" ]];then
|
||||
~/BirdNET-Pi/birdnet/bin/pip3 install -U pip
|
||||
~/BirdNET-Pi/birdnet/bin/pip3 install apprise
|
||||
fi
|
||||
[ -f $HOME/BirdNET-Pi/apprise.txt ] || sudo -E -u$USER touch $HOME/BirdNET-Pi/apprise.txt
|
||||
[ -f $HOME/BirdNET-Pi/apprise.txt ] || sudo -E -ucaddy touch $HOME/BirdNET-Pi/apprise.txt
|
||||
if ! which lsof &>/dev/null;then
|
||||
sudo apt update && sudo apt -y install lsof
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user