diff --git a/couchpotato/core/notifications/base.py b/couchpotato/core/notifications/base.py index 9dd3cfe3..254059e0 100644 --- a/couchpotato/core/notifications/base.py +++ b/couchpotato/core/notifications/base.py @@ -23,14 +23,15 @@ class Notification(Plugin): # Attach listeners for listener in self.listen_to: if not listener in self.dont_listen_to: + addEvent(listener, self.createNotifyHandler(listener)) - # Add on snatch default - def notify(message, data): - if not self.conf('on_snatch', default = 1) and listener == 'movie.snatched': - return - return self.notify(message = message, data = data) + def createNotifyHandler(self, listener): + def notify(message, data): + if not self.conf('on_snatch', default = True) and listener == 'movie.snatched': + return + return self.notify(message = message, data = data) - addEvent(listener, notify) + return notify def notify(self, message = '', data = {}): pass diff --git a/couchpotato/core/notifications/growl/main.py b/couchpotato/core/notifications/growl/main.py index 7bd6056d..29ade280 100644 --- a/couchpotato/core/notifications/growl/main.py +++ b/couchpotato/core/notifications/growl/main.py @@ -34,7 +34,7 @@ class Growl(Notification): except: log.error('Failed register of growl: %s' % traceback.format_exc()) - def notify(self, type = '', message = '', data = {}): + def notify(self, message = '', data = {}): if self.isDisabled(): return self.register() diff --git a/couchpotato/core/notifications/notifymywp/main.py b/couchpotato/core/notifications/notifymywp/main.py index 4445af66..7c294bfc 100644 --- a/couchpotato/core/notifications/notifymywp/main.py +++ b/couchpotato/core/notifications/notifymywp/main.py @@ -8,9 +8,7 @@ log = CPLog(__name__) class NotifyMyWP(Notification): def notify(self, message = '', data = {}): - - if self.isDisabled(): - return + if self.isDisabled(): return keys = self.conf('api_key').split(',') p = PyNMWP(keys, self.conf('dev_key')) @@ -20,5 +18,6 @@ class NotifyMyWP(Notification): for key in keys: if not response[key]['Code'] == u'200': log.error('Could not send notification to NotifyMyWindowsPhone (%s). %s' % (key, response[key]['message'])) + return False return response