Add $confidencepct variable to apprise notification.
This commit is contained in:
+4
-2
@@ -512,6 +512,8 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}
|
||||
<dd>Common Name</dd>
|
||||
<dt>$confidence</dt>
|
||||
<dd>Confidence Score</dd>
|
||||
<dt>$confidencepct</dt>
|
||||
<dd>Confidence Score as a percentage (eg. 0.91 => 91)</dd>
|
||||
<dt>$listenurl</dt>
|
||||
<dd>A link to the detection</dd>
|
||||
<dt>$date</dt>
|
||||
@@ -535,9 +537,9 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}
|
||||
</dl>
|
||||
<p>Use the variables defined above to customize your notification title and body.</p>
|
||||
<label for="apprise_notification_title">Notification Title: </label>
|
||||
<input name="apprise_notification_title" type="text" value="<?php print($config['APPRISE_NOTIFICATION_TITLE']);?>" /><br>
|
||||
<input name="apprise_notification_title" style="width: 100%" type="text" value="<?php print($config['APPRISE_NOTIFICATION_TITLE']);?>" /><br>
|
||||
<label for="apprise_notification_body">Notification Body: </label>
|
||||
<input name="apprise_notification_body" type="text" value='<?php print($config['APPRISE_NOTIFICATION_BODY']);?>' /><br>
|
||||
<input name="apprise_notification_body" style="width: 100%" type="text" value='<?php print($config['APPRISE_NOTIFICATION_BODY']);?>' /><br>
|
||||
<input type="checkbox" name="apprise_notify_new_species" <?php if($config['APPRISE_NOTIFY_NEW_SPECIES'] == 1 && filesize($home."/BirdNET-Pi/apprise.txt") != 0) { echo "checked"; };?> >
|
||||
<label for="apprise_notify_new_species">Notify each new infrequent species detection (<5 visits per week)</label><br>
|
||||
<input type="checkbox" name="apprise_notify_new_species_each_day" <?php if($config['APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY'] == 1 && filesize($home."/BirdNET-Pi/apprise.txt") != 0) { echo "checked"; };?> >
|
||||
|
||||
@@ -485,6 +485,7 @@ def handle_client(conn, addr):
|
||||
settings_dict = config_to_settings(userDir + '/BirdNET-Pi/scripts/thisrun.txt')
|
||||
sendAppriseNotifications(species,
|
||||
str(score),
|
||||
str(round(score * 100)),
|
||||
File_Name,
|
||||
Date,
|
||||
Time,
|
||||
|
||||
@@ -38,7 +38,7 @@ def notify(body, title, attached=""):
|
||||
)
|
||||
|
||||
|
||||
def sendAppriseNotifications(species, confidence, path, date, time, week, latitude, longitude, cutoff, sens, overlap, settings_dict, db_path=DB_PATH):
|
||||
def sendAppriseNotifications(species, confidence, confidencepct, path, date, time, week, latitude, longitude, cutoff, sens, overlap, settings_dict, db_path=DB_PATH):
|
||||
# print(sendAppriseNotifications)
|
||||
# print(settings_dict)
|
||||
if os.path.exists(APPRISE_CONFIG) and os.path.getsize(APPRISE_CONFIG) > 0:
|
||||
@@ -90,6 +90,7 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latitu
|
||||
notify_body = body.replace("$sciname", sciName)\
|
||||
.replace("$comname", comName)\
|
||||
.replace("$confidence", confidence)\
|
||||
.replace("$confidencepct", confidencepct)\
|
||||
.replace("$listenurl", listenurl)\
|
||||
.replace("$date", date)\
|
||||
.replace("$time", time)\
|
||||
@@ -103,6 +104,7 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latitu
|
||||
notify_title = title.replace("$sciname", sciName)\
|
||||
.replace("$comname", comName)\
|
||||
.replace("$confidence", confidence)\
|
||||
.replace("$confidencepct", confidencepct)\
|
||||
.replace("$listenurl", listenurl)\
|
||||
.replace("$date", date)\
|
||||
.replace("$time", time)\
|
||||
@@ -133,6 +135,7 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latitu
|
||||
notify_body = body.replace("$sciname", sciName)\
|
||||
.replace("$comname", comName)\
|
||||
.replace("$confidence", confidence)\
|
||||
.replace("$confidencepct", confidencepct)\
|
||||
.replace("$listenurl", listenurl)\
|
||||
.replace("$date", date)\
|
||||
.replace("$time", time)\
|
||||
@@ -147,6 +150,7 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latitu
|
||||
notify_title = title.replace("$sciname", sciName)\
|
||||
.replace("$comname", comName)\
|
||||
.replace("$confidence", confidence)\
|
||||
.replace("$confidencepct", confidencepct)\
|
||||
.replace("$listenurl", listenurl)\
|
||||
.replace("$date", date)\
|
||||
.replace("$time", time)\
|
||||
@@ -181,6 +185,7 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latitu
|
||||
notify_body = body.replace("$sciname", sciName)\
|
||||
.replace("$comname", comName)\
|
||||
.replace("$confidence", confidence)\
|
||||
.replace("$confidencepct", confidencepct)\
|
||||
.replace("$listenurl", listenurl)\
|
||||
.replace("$date", date)\
|
||||
.replace("$time", time)\
|
||||
@@ -195,6 +200,7 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latitu
|
||||
notify_title = title.replace("$sciname", sciName)\
|
||||
.replace("$comname", comName)\
|
||||
.replace("$confidence", confidence)\
|
||||
.replace("$confidencepct", confidencepct)\
|
||||
.replace("$listenurl", listenurl)\
|
||||
.replace("$date", date)\
|
||||
.replace("$time", time)\
|
||||
|
||||
@@ -50,6 +50,7 @@ def test_notifications(mocker):
|
||||
"APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY": "0"
|
||||
}
|
||||
sendAppriseNotifications("Myiarchus crinitus_Great Crested Flycatcher",
|
||||
"0.91",
|
||||
"91",
|
||||
"filename",
|
||||
"1666-06-06",
|
||||
@@ -70,6 +71,7 @@ def test_notifications(mocker):
|
||||
notify_call.reset_mock()
|
||||
settings_dict["APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY"] = "1"
|
||||
sendAppriseNotifications("Myiarchus crinitus_Great Crested Flycatcher",
|
||||
"0.91",
|
||||
"91",
|
||||
"filename",
|
||||
"1666-06-06",
|
||||
@@ -92,6 +94,7 @@ def test_notifications(mocker):
|
||||
notify_call.reset_mock()
|
||||
settings_dict["APPRISE_NOTIFY_NEW_SPECIES"] = "1"
|
||||
sendAppriseNotifications("Myiarchus crinitus_Great Crested Flycatcher",
|
||||
"0.91",
|
||||
"91",
|
||||
"filename",
|
||||
"1666-06-06",
|
||||
@@ -117,6 +120,7 @@ def test_notifications(mocker):
|
||||
notify_call.reset_mock()
|
||||
settings_dict["APPRISE_NOTIFY_EACH_DETECTION"] = "1"
|
||||
sendAppriseNotifications("Myiarchus crinitus_Great Crested Flycatcher",
|
||||
"0.91",
|
||||
"91",
|
||||
"filename",
|
||||
"1666-06-06",
|
||||
|
||||
Reference in New Issue
Block a user