diff --git a/couchpotato/core/notifications/base.py b/couchpotato/core/notifications/base.py index 3965973f..bc2e6a39 100644 --- a/couchpotato/core/notifications/base.py +++ b/couchpotato/core/notifications/base.py @@ -25,7 +25,7 @@ class Notification(Plugin): if not listener in self.dont_listen_to: addEvent(listener, self.notify) - def notify(self, message = '', data = {}, type = ''): + def notify(self, message = '', data = {}): pass def test(self): @@ -36,11 +36,10 @@ class Notification(Plugin): success = self.notify( message = self.test_message, - data = {}, - type = test_type + data = {} ) - return jsonified({'success': success}) + #return jsonified({'success': success}) def testNotifyName(self): return 'notify.%s.test' % self.getName().lower() diff --git a/couchpotato/core/notifications/growl/main.py b/couchpotato/core/notifications/growl/main.py index b46a8de8..33ff3d6b 100644 --- a/couchpotato/core/notifications/growl/main.py +++ b/couchpotato/core/notifications/growl/main.py @@ -16,6 +16,7 @@ class Growl(Notification): return Env.setting(attr, 'growl') def notify(self, message = '', data = {}): + if self.isDisabled(): return hosts = [x.strip() for x in self.conf('host').split(",")] password = self.conf('password') diff --git a/couchpotato/core/notifications/history/main.py b/couchpotato/core/notifications/history/main.py index c56ad23d..d770498b 100644 --- a/couchpotato/core/notifications/history/main.py +++ b/couchpotato/core/notifications/history/main.py @@ -3,6 +3,7 @@ from couchpotato.core.event import addEvent from couchpotato.core.logger import CPLog from couchpotato.core.notifications.base import Notification from couchpotato.core.settings.model import History as Hist +from couchpotato.environment import Env import time log = CPLog(__name__) @@ -13,11 +14,10 @@ class History(Notification): listen_to = ['movie.downloaded', 'movie.snatched', 'renamer.canceled'] def __init__(self): + super(Notification, self).__init__() - addEvent('notify', self.notify) - - addEvent('app.load', self.test) - + if Env.doDebug(): + addEvent('app.load', self.test) def notify(self, message = '', data = {}): @@ -25,7 +25,6 @@ class History(Notification): history = Hist( added = int(time.time()), message = message, - type = type, release_id = data.get('id', 0) ) db.add(history) diff --git a/couchpotato/core/notifications/nmj/main.py b/couchpotato/core/notifications/nmj/main.py index 6b322ded..03cb272b 100644 --- a/couchpotato/core/notifications/nmj/main.py +++ b/couchpotato/core/notifications/nmj/main.py @@ -74,6 +74,7 @@ class NMJ(Notification): }) def notify(self, message = '', data = {}): + if self.isDisabled(): return host = self.conf('host') mount = self.conf('mount') diff --git a/couchpotato/core/notifications/notifo/main.py b/couchpotato/core/notifications/notifo/main.py index fd462046..cc22c309 100644 --- a/couchpotato/core/notifications/notifo/main.py +++ b/couchpotato/core/notifications/notifo/main.py @@ -20,6 +20,7 @@ class Notifo(Notification): return Env.setting(attr, 'notifo') def notify(self, message = '', data = {}): + if self.isDisabled(): return try: data = urllib.urlencode({ diff --git a/couchpotato/core/notifications/notifymyandroid/main.py b/couchpotato/core/notifications/notifymyandroid/main.py index 0c119346..a4574a61 100644 --- a/couchpotato/core/notifications/notifymyandroid/main.py +++ b/couchpotato/core/notifications/notifymyandroid/main.py @@ -1,6 +1,6 @@ from couchpotato.core.logger import CPLog from couchpotato.core.notifications.base import Notification -from libs import pynma +import pynma log = CPLog(__name__) @@ -8,6 +8,7 @@ log = CPLog(__name__) class NotifyMyAndroid(Notification): def notify(self, message = '', data = {}): + if self.isDisabled(): return nma = pynma.PyNMA() keys = self.conf('api_key').split(',') diff --git a/couchpotato/core/notifications/plex/main.py b/couchpotato/core/notifications/plex/main.py index 2008286a..79e6dd3a 100644 --- a/couchpotato/core/notifications/plex/main.py +++ b/couchpotato/core/notifications/plex/main.py @@ -11,6 +11,7 @@ log = CPLog(__name__) class Plex(Notification): def notify(self, message = '', data = {}): + if self.isDisabled(): return log.info('Sending notification to Plex') hosts = [x.strip() for x in self.conf('host').split(",")] diff --git a/couchpotato/core/notifications/prowl/main.py b/couchpotato/core/notifications/prowl/main.py index 3b851b39..87887b39 100644 --- a/couchpotato/core/notifications/prowl/main.py +++ b/couchpotato/core/notifications/prowl/main.py @@ -10,6 +10,7 @@ log = CPLog(__name__) class Prowl(Notification): def notify(self, message = '', data = {}): + if self.isDisabled(): return http_handler = HTTPSConnection('api.prowlapp.com') diff --git a/couchpotato/core/notifications/twitter/main.py b/couchpotato/core/notifications/twitter/main.py index 8ba04ae8..dd896fa8 100644 --- a/couchpotato/core/notifications/twitter/main.py +++ b/couchpotato/core/notifications/twitter/main.py @@ -20,6 +20,7 @@ class Twitter(Notification): } def notify(self, message = '', data = {}): + if self.isDisabled(): return api = Api(self.consumer_key, self.consumer_secret, self.conf('username'), self.conf('password')) diff --git a/couchpotato/core/notifications/xbmc/main.py b/couchpotato/core/notifications/xbmc/main.py index b9dcb03d..c8e2f70f 100644 --- a/couchpotato/core/notifications/xbmc/main.py +++ b/couchpotato/core/notifications/xbmc/main.py @@ -10,6 +10,7 @@ log = CPLog(__name__) class XBMC(Notification): def notify(self, message = '', data = {}): + if self.isDisabled(): return for host in [x.strip() for x in self.conf('host').split(",")]: self.send({'command': 'ExecBuiltIn', 'parameter': 'Notification(CouchPotato, %s)' % message}, host)