mirror of https://github.com/caronc/apprise
Pushover to support numerical priority values (#597)
parent
8ed4b7b72a
commit
463eb54897
|
@ -564,19 +564,25 @@ class NotifyPushover(NotifyBase):
|
||||||
# Set our priority
|
# Set our priority
|
||||||
if 'priority' in results['qsd'] and len(results['qsd']['priority']):
|
if 'priority' in results['qsd'] and len(results['qsd']['priority']):
|
||||||
_map = {
|
_map = {
|
||||||
|
# Keep for backwards compatibility
|
||||||
'l': PushoverPriority.LOW,
|
'l': PushoverPriority.LOW,
|
||||||
'm': PushoverPriority.MODERATE,
|
'm': PushoverPriority.MODERATE,
|
||||||
'n': PushoverPriority.NORMAL,
|
'n': PushoverPriority.NORMAL,
|
||||||
'h': PushoverPriority.HIGH,
|
'h': PushoverPriority.HIGH,
|
||||||
'e': PushoverPriority.EMERGENCY,
|
'e': PushoverPriority.EMERGENCY,
|
||||||
}
|
|
||||||
try:
|
|
||||||
results['priority'] = \
|
|
||||||
_map[results['qsd']['priority'][0].lower()]
|
|
||||||
|
|
||||||
except KeyError:
|
# Entries to additionally support (so more like PushOver's API
|
||||||
# No priority was set
|
'-2': PushoverPriority.LOW,
|
||||||
pass
|
'-1': PushoverPriority.MODERATE,
|
||||||
|
'0': PushoverPriority.NORMAL,
|
||||||
|
'1': PushoverPriority.HIGH,
|
||||||
|
'2': PushoverPriority.EMERGENCY,
|
||||||
|
}
|
||||||
|
priority = results['qsd']['priority'][0].lower()
|
||||||
|
results['priority'] = \
|
||||||
|
next((
|
||||||
|
v for k, v in _map.items() if priority.startswith(k)),
|
||||||
|
NotifyPushover.template_args['priority']['default'])
|
||||||
|
|
||||||
# Retrieve all of our targets
|
# Retrieve all of our targets
|
||||||
results['targets'] = NotifyPushover.split_path(results['fullpath'])
|
results['targets'] = NotifyPushover.split_path(results['fullpath'])
|
||||||
|
|
|
@ -115,6 +115,10 @@ apprise_url_tests = (
|
||||||
('pover://%s@%s?priority=emergency' % ('u' * 30, 'a' * 30), {
|
('pover://%s@%s?priority=emergency' % ('u' * 30, 'a' * 30), {
|
||||||
'instance': plugins.NotifyPushover,
|
'instance': plugins.NotifyPushover,
|
||||||
}),
|
}),
|
||||||
|
# API Key + emergency(2) priority setting (via numeric value
|
||||||
|
('pover://%s@%s?priority=2' % ('u' * 30, 'a' * 30), {
|
||||||
|
'instance': plugins.NotifyPushover,
|
||||||
|
}),
|
||||||
# API Key + emergency priority setting with retry and expire
|
# API Key + emergency priority setting with retry and expire
|
||||||
('pover://%s@%s?priority=emergency&%s&%s' % ('u' * 30,
|
('pover://%s@%s?priority=emergency&%s&%s' % ('u' * 30,
|
||||||
'a' * 30,
|
'a' * 30,
|
||||||
|
|
Loading…
Reference in New Issue