Browse Source

Disabled notifications still enabled

pull/110/head
Ruud 13 years ago
parent
commit
24a65ea927
  1. 13
      couchpotato/core/notifications/base.py
  2. 2
      couchpotato/core/notifications/growl/main.py
  3. 5
      couchpotato/core/notifications/notifymywp/main.py

13
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

2
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()

5
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

Loading…
Cancel
Save