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
-10
View File
@@ -68,16 +68,6 @@ RTSP_STREAM=
PUSHED_APP_KEY= PUSHED_APP_KEY=
PUSHED_APP_SECRET= PUSHED_APP_SECRET=
#------------------- Browser Notifications via Notify.run -------------------#
#________________The variable below enables browser notifications______________#
#________________________See https://notify.run/ to get________________________#
#_________________ __these subscription URL for your device.___________________#
# Keep these EMPTY if haven't setup a Notify.run Channel yet. #
## Notify.run Channel ID
NOTIFY_RUN_CHANNEL_ID=
################################################################################ ################################################################################
#-------------------------------- Defaults ----------------------------------# #-------------------------------- Defaults ----------------------------------#
+1
View File
@@ -10,3 +10,4 @@ pandas
seaborn seaborn
streamlit streamlit
plotly plotly
apprise
+13 -4
View File
@@ -9,7 +9,7 @@ $longitude = $_GET["longitude"];
$birdweather_id = $_GET["birdweather_id"]; $birdweather_id = $_GET["birdweather_id"];
$pushed_app_key = $_GET["pushed_app_key"]; $pushed_app_key = $_GET["pushed_app_key"];
$pushed_app_secret = $_GET["pushed_app_secret"]; $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 = file_get_contents("/etc/birdnet/birdnet.conf");
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents); $contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
@@ -32,6 +32,10 @@ $fh2 = fopen("./scripts/thisrun.txt", "w");
fwrite($fh, $contents); fwrite($fh, $contents);
fwrite($fh2, $contents2); fwrite($fh2, $contents2);
$appriseconfig = fopen("~/.apprise");
fwrite($appriseconfig, $apprise_input);
$language = $_GET["language"]; $language = $_GET["language"];
if ($language != "none"){ if ($language != "none"){
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"); $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')) { } elseif (file_exists('./scripts/firstrun.ini')) {
$config = parse_ini_file('./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']; $caddypwd = $config['CADDY_PWD'];
if (!isset($_SERVER['PHP_AUTH_USER'])) { if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"'); 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> <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> <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> <label for="apprise_input">Apprise Notifications Configuration: </label>
<input name="notify_run_channel" type="text" value="<?php print($config['NOTIFY_RUN_CHANNEL_ID']);?>" /><br> <textarea name="apprise_input" type="text" ><?php print($apprise_config);?></textarea>
<p><a target="_blank" href="https://notify.run/">Notify.run browser notifications</a> can be setup and enabled for New Species notifications.</p> <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> <label for="language">Database Language: </label>
<select name="language"> <select name="language">
+4
View File
@@ -33,5 +33,9 @@ ${NOTIFICATION}"
--form-string "content=${NOTIFICATION}" \ --form-string "content=${NOTIFICATION}" \
https://api.pushed.co/1/push https://api.pushed.co/1/push
fi fi
if [ ! -s ~/.apprise ];then
apprise -vv -t 'New Species Detected' -b ${NOTIFICATION}
fi
fi fi
+5
View File
@@ -15,3 +15,8 @@ fi
if ! which lsof &>/dev/null;then if ! which lsof &>/dev/null;then
sudo apt update && sudo apt -y install lsof sudo apt update && sudo apt -y install lsof
fi 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