Skip to content

Commit

Permalink
Add additional apprise notification option (Nachtzuster#88)
Browse files Browse the repository at this point in the history
* Update config.php

Added $maskedlistenurl as an option for apprise notifications.

* Update notifications.py

Make sure $maskedlistenurl also works with default detections, and not only when testing.

* Update config.php

Changed maskedlistenurl to friendlyurl

* Update notifications.py

Changed maskedlistenurl to friendlyurl
  • Loading branch information
OliNau authored Jun 9, 2024
1 parent f84c44b commit e6f48f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ function() {
$filename = "http://".$_SERVER['SERVER_NAME']."/"."?filename=".$filename;
}

$friendlyfilename = "[Listen here](".$filename.")";

$attach="";
$exampleimage = "https://live.staticflickr.com/7430/27545810581_8bfa8289a3_c.jpg";
if (strpos($body, '$flickrimage') !== false) {
Expand All @@ -234,6 +236,7 @@ function() {
$title = str_replace("\$confidencepct", round($confidence*100), $title);
$title = str_replace("\$confidence", $confidence, $title);
$title = str_replace("\$listenurl", $filename, $title);
$title = str_replace("\$friendlyurl", $friendlyfilename, $title);
$title = str_replace("\$date", $date, $title);
$title = str_replace("\$time", $time, $title);
$title = str_replace("\$week", $week, $title);
Expand All @@ -250,6 +253,7 @@ function() {
$body = str_replace("\$confidencepct", round($confidence*100), $body);
$body = str_replace("\$confidence", $confidence, $body);
$body = str_replace("\$listenurl", $filename, $body);
$body = str_replace("\$friendlyurl", $friendlyfilename, $body);
$body = str_replace("\$date", $date, $body);
$body = str_replace("\$time", $time, $body);
$body = str_replace("\$week", $week, $body);
Expand Down Expand Up @@ -499,6 +503,8 @@ function runProcess() {
<dd>Confidence Score as a percentage (eg. 0.91 => 91)</dd>
<dt>$listenurl</dt>
<dd>A link to the detection</dd>
<dt>$friendlyurl</dt>
<dd>A masked link to the detection. Only useful for services that support Markdown (e.g. Discord). </dd>
<dt>$date</dt>
<dd>Date</dd>
<dt>$time</dt>
Expand Down
2 changes: 2 additions & 0 deletions scripts/utils/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def render_template(template, reason=""):
.replace("$confidencepct", confidencepct) \
.replace("$confidence", confidence) \
.replace("$listenurl", listenurl) \
.replace("$friendlyurl", friendlyurl) \
.replace("$date", date) \
.replace("$time", time) \
.replace("$week", week) \
Expand Down Expand Up @@ -97,6 +98,7 @@ def render_template(template, reason=""):
websiteurl = "http://"+socket.gethostname()+".local"

listenurl = websiteurl+"?filename="+path
friendlyurl = "[Listen here]("+listenurl+")"
image_url = ""

if len(settings_dict.get('FLICKR_API_KEY')) > 0 and "$flickrimage" in body:
Expand Down

0 comments on commit e6f48f8

Please sign in to comment.