diff --git a/couchpotato/core/notifications/base.py b/couchpotato/core/notifications/base.py index 8ae4bb86..dda3dade 100644 --- a/couchpotato/core/notifications/base.py +++ b/couchpotato/core/notifications/base.py @@ -22,7 +22,7 @@ class Notification(Provider): dont_listen_to = [] def __init__(self): - addEvent('notify.%s' % self.getName().lower(), self.notify) + addEvent('notify.%s' % self.getName().lower(), self._notify) addApiView(self.testNotifyName(), self.test) @@ -35,13 +35,17 @@ class Notification(Provider): def notify(message = None, group = {}, data = None): if not self.conf('on_snatch', default = True) and listener == 'movie.snatched': return - return self.notify(message = message, data = data if data else group, listener = listener) + return self._notify(message = message, data = data if data else group, listener = listener) return notify def getNotificationImage(self, size = 'small'): return 'https://raw.github.com/RuudBurger/CouchPotatoServer/master/couchpotato/static/images/notify.couch.%s.png' % size + def _notify(self, *args, **kwargs): + if self.isEnabled(): + self.notify(*args, **kwargs) + def notify(self, message = '', data = {}, listener = None): pass @@ -51,7 +55,7 @@ class Notification(Provider): log.info('Sending test to %s', test_type) - success = self.notify( + success = self._notify( message = self.test_message, data = {}, listener = 'test' diff --git a/couchpotato/core/notifications/boxcar/main.py b/couchpotato/core/notifications/boxcar/main.py index 3135614a..b30d487a 100644 --- a/couchpotato/core/notifications/boxcar/main.py +++ b/couchpotato/core/notifications/boxcar/main.py @@ -11,7 +11,6 @@ class Boxcar(Notification): url = 'https://boxcar.io/devices/providers/7MNNXY3UIzVBwvzkKwkC/notifications' def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return try: message = message.strip() diff --git a/couchpotato/core/notifications/email/main.py b/couchpotato/core/notifications/email/main.py index 014b5856..21fcf157 100644 --- a/couchpotato/core/notifications/email/main.py +++ b/couchpotato/core/notifications/email/main.py @@ -12,7 +12,6 @@ log = CPLog(__name__) class Email(Notification): def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return # Extract all the settings from settings from_address = self.conf('from') @@ -50,6 +49,5 @@ class Email(Notification): return True except: log.error('E-mail failed: %s', traceback.format_exc()) - return False return False diff --git a/couchpotato/core/notifications/growl/main.py b/couchpotato/core/notifications/growl/main.py index 7f1398d9..caad661b 100644 --- a/couchpotato/core/notifications/growl/main.py +++ b/couchpotato/core/notifications/growl/main.py @@ -44,7 +44,6 @@ class Growl(Notification): log.error('Failed register of growl: %s', traceback.format_exc()) def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return self.register() diff --git a/couchpotato/core/notifications/notifo/main.py b/couchpotato/core/notifications/notifo/main.py index 64eee5ec..312055a8 100644 --- a/couchpotato/core/notifications/notifo/main.py +++ b/couchpotato/core/notifications/notifo/main.py @@ -13,7 +13,6 @@ class Notifo(Notification): url = 'https://api.notifo.com/v1/send_notification' def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return try: params = { diff --git a/couchpotato/core/notifications/notifymyandroid/main.py b/couchpotato/core/notifications/notifymyandroid/main.py index cc6ef662..2c4ac90c 100644 --- a/couchpotato/core/notifications/notifymyandroid/main.py +++ b/couchpotato/core/notifications/notifymyandroid/main.py @@ -9,7 +9,6 @@ log = CPLog(__name__) class NotifyMyAndroid(Notification): def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return nma = pynma.PyNMA() keys = splitString(self.conf('api_key')) diff --git a/couchpotato/core/notifications/notifymywp/main.py b/couchpotato/core/notifications/notifymywp/main.py index 3258e85f..167b6eeb 100644 --- a/couchpotato/core/notifications/notifymywp/main.py +++ b/couchpotato/core/notifications/notifymywp/main.py @@ -9,7 +9,6 @@ log = CPLog(__name__) class NotifyMyWP(Notification): def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return keys = splitString(self.conf('api_key')) p = PyNMWP(keys, self.conf('dev_key')) diff --git a/couchpotato/core/notifications/plex/main.py b/couchpotato/core/notifications/plex/main.py index 9790ccfe..95139eed 100644 --- a/couchpotato/core/notifications/plex/main.py +++ b/couchpotato/core/notifications/plex/main.py @@ -46,7 +46,6 @@ class Plex(Notification): return True def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return hosts = [x.strip() + ':3000' for x in self.conf('host').split(",")] successful = 0 diff --git a/couchpotato/core/notifications/prowl/main.py b/couchpotato/core/notifications/prowl/main.py index 0990d0d1..e5c4678b 100644 --- a/couchpotato/core/notifications/prowl/main.py +++ b/couchpotato/core/notifications/prowl/main.py @@ -13,7 +13,6 @@ class Prowl(Notification): } def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return data = { 'apikey': self.conf('api_key'), diff --git a/couchpotato/core/notifications/pushalot/main.py b/couchpotato/core/notifications/pushalot/main.py index c35efa5c..4c5e76c3 100644 --- a/couchpotato/core/notifications/pushalot/main.py +++ b/couchpotato/core/notifications/pushalot/main.py @@ -12,7 +12,6 @@ class Pushalot(Notification): } def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return data = { 'AuthorizationToken': self.conf('auth_token'), diff --git a/couchpotato/core/notifications/pushover/main.py b/couchpotato/core/notifications/pushover/main.py index bcd3245c..8df4ed1f 100644 --- a/couchpotato/core/notifications/pushover/main.py +++ b/couchpotato/core/notifications/pushover/main.py @@ -11,7 +11,6 @@ class Pushover(Notification): app_token = 'YkxHMYDZp285L265L3IwH3LmzkTaCy' def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return http_handler = HTTPSConnection("api.pushover.net:443") diff --git a/couchpotato/core/notifications/toasty/main.py b/couchpotato/core/notifications/toasty/main.py index 638c75dd..79b021e2 100644 --- a/couchpotato/core/notifications/toasty/main.py +++ b/couchpotato/core/notifications/toasty/main.py @@ -12,7 +12,6 @@ class Toasty(Notification): } def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return data = { 'title': self.default_title, diff --git a/couchpotato/core/notifications/trakt/main.py b/couchpotato/core/notifications/trakt/main.py index 63c19050..86d47086 100644 --- a/couchpotato/core/notifications/trakt/main.py +++ b/couchpotato/core/notifications/trakt/main.py @@ -14,7 +14,6 @@ class Trakt(Notification): listen_to = ['movie.downloaded'] def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return post_data = { 'username': self.conf('automation_username'), diff --git a/couchpotato/core/notifications/twitter/main.py b/couchpotato/core/notifications/twitter/main.py index bbb9262b..2db19743 100644 --- a/couchpotato/core/notifications/twitter/main.py +++ b/couchpotato/core/notifications/twitter/main.py @@ -32,7 +32,6 @@ class Twitter(Notification): addApiView('notify.%s.credentials' % self.getName().lower(), self.getCredentials) def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return api = Api(self.consumer_key, self.consumer_secret, self.conf('access_token_key'), self.conf('access_token_secret')) diff --git a/couchpotato/core/notifications/xbmc/main.py b/couchpotato/core/notifications/xbmc/main.py index 0187a833..84b9f7e4 100755 --- a/couchpotato/core/notifications/xbmc/main.py +++ b/couchpotato/core/notifications/xbmc/main.py @@ -15,7 +15,6 @@ class XBMC(Notification): use_json_notifications = {} def notify(self, message = '', data = {}, listener = None): - if self.isDisabled(): return hosts = splitString(self.conf('host'))