Simpler notifications
This commit is contained in:
@@ -12,15 +12,19 @@ class Notification(Plugin):
|
||||
default_title = 'CouchPotato'
|
||||
test_message = 'ZOMG Lazors Pewpewpew!'
|
||||
|
||||
listen_to = []
|
||||
listen_to = ['movie.downloaded', 'movie.snatched']
|
||||
dont_listen_to = []
|
||||
|
||||
def __init__(self):
|
||||
addEvent('notify', self.notify)
|
||||
addEvent('notify.%s' % self.getName().lower(), self.notify)
|
||||
|
||||
addApiView(self.testNotifyName(), self.test)
|
||||
|
||||
# Attach listeners
|
||||
for listener in self.listen_to:
|
||||
if not listener in self.dont_listen_to:
|
||||
addEvent(listener, self.notify)
|
||||
|
||||
def notify(self, message = '', data = {}, type = ''):
|
||||
pass
|
||||
|
||||
@@ -36,12 +40,7 @@ class Notification(Plugin):
|
||||
type = test_type
|
||||
)
|
||||
|
||||
#return jsonified({'success': success})
|
||||
|
||||
def dontNotify(self, type = ''):
|
||||
return (not type in self.listen_to and len(self.listen_to) == 0 and type != self.testNotifyName()) \
|
||||
or type in self.dont_listen_to \
|
||||
or self.isDisabled()
|
||||
return jsonified({'success': success})
|
||||
|
||||
def testNotifyName(self):
|
||||
return 'notify.%s.test' % self.getName().lower()
|
||||
|
||||
Reference in New Issue
Block a user