apprise starting point

This commit is contained in:
ehpersonal38
2022-05-07 12:33:14 -04:00
parent 50dec20c47
commit 9e5331168c
5 changed files with 23 additions and 14 deletions
+13 -4
View File
@@ -9,7 +9,7 @@ $longitude = $_GET["longitude"];
$birdweather_id = $_GET["birdweather_id"];
$pushed_app_key = $_GET["pushed_app_key"];
$pushed_app_secret = $_GET["pushed_app_secret"];
$notify_run_channel = $_GET["notify_run_channel"];
$apprise_input = $_GET['apprise_input'];
$contents = file_get_contents("/etc/birdnet/birdnet.conf");
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
@@ -32,6 +32,10 @@ $fh2 = fopen("./scripts/thisrun.txt", "w");
fwrite($fh, $contents);
fwrite($fh2, $contents2);
$appriseconfig = fopen("~/.apprise");
fwrite($appriseconfig, $apprise_input);
$language = $_GET["language"];
if ($language != "none"){
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
@@ -57,6 +61,11 @@ if (file_exists('./scripts/thisrun.txt')) {
} elseif (file_exists('./scripts/firstrun.ini')) {
$config = parse_ini_file('./scripts/firstrun.ini');
}
if (file_exists('~/.apprise')) {
$apprise_config = file_get_contents('~/.apprise');
} else {
$apprise_config = "";
}
$caddypwd = $config['CADDY_PWD'];
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
@@ -88,9 +97,9 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
<input name="pushed_app_secret" type="text" value="<?php print($config['PUSHED_APP_SECRET']);?>" /><br>
<p><a target="_blank" href="https://pushed.co/quick-start-guide">Pushed iOS Notifications</a> can be setup and enabled for New Species notifications. Be sure to "Enable" the "Pushed Notifications" in "Tools" > "Services" if you would like to use this feature. Sorry, Android users, this only works on iOS.</p>
<label for="notify_run_channel">Notify.run Channel ID: </label>
<input name="notify_run_channel" type="text" value="<?php print($config['NOTIFY_RUN_CHANNEL_ID']);?>" /><br>
<p><a target="_blank" href="https://notify.run/">Notify.run browser notifications</a> can be setup and enabled for New Species notifications.</p>
<label for="apprise_input">Apprise Notifications Configuration: </label>
<textarea name="apprise_input" type="text" ><?php print($apprise_config);?></textarea>
<p><a target="_blank" href="https://github.com/caronc/apprise/wiki">Apprise Notifications</a> can be setup and enabled for New Species notifications.</p>
<label for="language">Database Language: </label>
<select name="language">
+4
View File
@@ -33,5 +33,9 @@ ${NOTIFICATION}"
--form-string "content=${NOTIFICATION}" \
https://api.pushed.co/1/push
fi
if [ ! -s ~/.apprise ];then
apprise -vv -t 'New Species Detected' -b ${NOTIFICATION}
fi
fi
+5
View File
@@ -15,3 +15,8 @@ fi
if ! which lsof &>/dev/null;then
sudo apt update && sudo apt -y install lsof
fi
apprise_installation_status=$(~/BirdNET-Pi/birdnet/bin/python3 -c 'import pkgutil; print("installed" if pkgutil.find_loader("apprise") else "not installed")')
if [[ "$apprise_installation_status" = "not installed" ]];then
~/BirdNET-Pi/birdnet/bin/pip3 install -U pip
~/BirdNET-Pi/birdnet/bin/pip3 install apprise
fi