mirror of
https://github.com/caronc/apprise.git
synced 2025-12-15 10:04:06 +08:00
feat(bark): Add 'call' parameter support to NotifyBark for ringtones (#1444)
This commit is contained in:
@@ -213,6 +213,11 @@ class NotifyBark(NotifyBase):
|
||||
"name": _("Icon URL"),
|
||||
"type": "string",
|
||||
},
|
||||
"call": {
|
||||
"name": _("Call"),
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@@ -228,6 +233,7 @@ class NotifyBark(NotifyBase):
|
||||
badge=None,
|
||||
volume=None,
|
||||
icon=None,
|
||||
call=None,
|
||||
**kwargs,
|
||||
):
|
||||
"""Initialize Notify Bark Object."""
|
||||
@@ -306,6 +312,9 @@ class NotifyBark(NotifyBase):
|
||||
volume,
|
||||
)
|
||||
|
||||
# Call
|
||||
self.call = parse_bool(call)
|
||||
|
||||
# Icon URL
|
||||
self.icon = icon if isinstance(icon, str) else None
|
||||
|
||||
@@ -388,6 +397,9 @@ class NotifyBark(NotifyBase):
|
||||
if self.volume:
|
||||
payload["volume"] = self.volume
|
||||
|
||||
if self.call:
|
||||
payload["call"] = 1
|
||||
|
||||
auth = None
|
||||
if self.user:
|
||||
auth = (self.user, self.password)
|
||||
@@ -502,6 +514,9 @@ class NotifyBark(NotifyBase):
|
||||
if self.icon:
|
||||
params["icon"] = self.icon
|
||||
|
||||
if self.call:
|
||||
params["call"] = "yes"
|
||||
|
||||
# Extend our parameters
|
||||
params.update(self.url_parameters(privacy=privacy, *args, **kwargs))
|
||||
|
||||
@@ -608,4 +623,9 @@ class NotifyBark(NotifyBase):
|
||||
results["qsd"]["icon"].strip()
|
||||
)
|
||||
|
||||
# Call
|
||||
results["call"] = parse_bool(
|
||||
results["qsd"].get("call", False)
|
||||
)
|
||||
|
||||
return results
|
||||
|
||||
@@ -254,6 +254,20 @@ apprise_url_tests = (
|
||||
"instance": NotifyBark,
|
||||
},
|
||||
),
|
||||
(
|
||||
"bark://192.168.0.6:8081/device_key/?call=1",
|
||||
{
|
||||
# set call parameter to repeat ringtone
|
||||
"instance": NotifyBark,
|
||||
},
|
||||
),
|
||||
(
|
||||
"bark://192.168.0.6:8081/device_key/?call=1&sound=alarm&level=critical",
|
||||
{
|
||||
# set call parameter with other parameters
|
||||
"instance": NotifyBark,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user