Simpler notifications

This commit is contained in:
Ruud
2011-08-30 13:41:45 +02:00
parent 0dc68c2839
commit 4e5a7c22a4
13 changed files with 25 additions and 47 deletions
+7 -8
View File
@@ -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()