Added ability to set custom notification sound for Pushover

This commit is contained in:
Brian Charbonneau 2015-10-03 22:05:27 -07:00
parent cf49f4d6bf
commit 280a5ae744
2 changed files with 13 additions and 3 deletions

View file

@ -185,6 +185,7 @@ _CONFIG_DEFINITIONS = {
'PUSHOVER_ENABLED': (int, 'Pushover', 0),
'PUSHOVER_KEYS': (str, 'Pushover', ''),
'PUSHOVER_PRIORITY': (int, 'Pushover', 0),
'PUSHOVER_SOUND': (str, 'Pushover', ''),
'PUSHOVER_ON_PLAY': (int, 'Pushover', 0),
'PUSHOVER_ON_STOP': (int, 'Pushover', 0),
'PUSHOVER_ON_PAUSE': (int, 'Pushover', 0),
@ -320,4 +321,4 @@ class Config(object):
"""
for name, value in kwargs.items():
key, definition_type, section, ini_key, default = self._define(name)
self._config[section][ini_key] = definition_type(value)
self._config[section][ini_key] = definition_type(value)

View file

@ -845,6 +845,7 @@ class PUSHOVER(object):
self.enabled = plexpy.CONFIG.PUSHOVER_ENABLED
self.keys = plexpy.CONFIG.PUSHOVER_KEYS
self.priority = plexpy.CONFIG.PUSHOVER_PRIORITY
self.sound = plexpy.CONFIG.PUSHOVER_SOUND
self.on_play = plexpy.CONFIG.PUSHOVER_ON_PLAY
self.on_stop = plexpy.CONFIG.PUSHOVER_ON_STOP
self.on_watched = plexpy.CONFIG.PUSHOVER_ON_WATCHED
@ -867,6 +868,7 @@ class PUSHOVER(object):
'user': plexpy.CONFIG.PUSHOVER_KEYS,
'title': event,
'message': message.encode("utf-8"),
'sound': plexpy.CONFIG.PUSHOVER_SOUND,
'priority': plexpy.CONFIG.PUSHOVER_PRIORITY}
http_handler.request("POST",
@ -893,10 +895,11 @@ class PUSHOVER(object):
#For uniformity reasons not removed
return
def test(self, keys, priority):
def test(self, keys, priority, sound):
self.enabled = True
self.keys = keys
self.priority = priority
self.sound = sound
self.notify('Main Screen Activate', 'Test Message')
@ -913,6 +916,12 @@ class PUSHOVER(object):
'description': 'Set the priority (-2,-1,0,1 or 2).',
'input_type': 'number'
},
{'label': 'Sound',
'value': self.sound,
'name': 'pushover_sound',
'description': 'Set the notification sound (choose from <a href="https://pushover.net/api#sounds" target="_blank">this list</a> or leave blank for default)',
'input_type': 'text'
},
{'label': 'Pushover API Token',
'value': plexpy.CONFIG.PUSHOVER_APITOKEN,
'name': 'pushover_apitoken',
@ -1251,4 +1260,4 @@ class Email(object):
}
]
return config_option
return config_option