diff --git a/couchpotato/core/notifications/base.py b/couchpotato/core/notifications/base.py index f4444fb..2663c33 100644 --- a/couchpotato/core/notifications/base.py +++ b/couchpotato/core/notifications/base.py @@ -30,11 +30,11 @@ class Notification(Plugin): def notify(message, data): if not self.conf('on_snatch', default = True) and listener == 'movie.snatched': return - return self.notify(message = message, data = data) + return self.notify(message = message, data = data, listener = listener) return notify - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): pass def test(self): @@ -45,7 +45,8 @@ class Notification(Plugin): success = self.notify( message = self.test_message, - data = {} + data = {}, + listener = 'test' ) return jsonified({'success': success}) diff --git a/couchpotato/core/notifications/boxcar/main.py b/couchpotato/core/notifications/boxcar/main.py index cbf907f..3135614 100644 --- a/couchpotato/core/notifications/boxcar/main.py +++ b/couchpotato/core/notifications/boxcar/main.py @@ -10,7 +10,7 @@ class Boxcar(Notification): url = 'https://boxcar.io/devices/providers/7MNNXY3UIzVBwvzkKwkC/notifications' - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return try: diff --git a/couchpotato/core/notifications/core/main.py b/couchpotato/core/notifications/core/main.py index 7081740..1a56718 100644 --- a/couchpotato/core/notifications/core/main.py +++ b/couchpotato/core/notifications/core/main.py @@ -96,10 +96,12 @@ class CoreNotifier(Notification): 'notifications': notifications }) - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): db = get_session() + data['notification_type'] = listener if listener else 'unknown' + n = Notif( message = toUnicode(message), data = data diff --git a/couchpotato/core/notifications/growl/main.py b/couchpotato/core/notifications/growl/main.py index 40cc7e5..eadea51 100644 --- a/couchpotato/core/notifications/growl/main.py +++ b/couchpotato/core/notifications/growl/main.py @@ -43,7 +43,7 @@ class Growl(Notification): except: log.error('Failed register of growl: %s' % traceback.format_exc()) - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return self.register() diff --git a/couchpotato/core/notifications/history/main.py b/couchpotato/core/notifications/history/main.py index f235fd0..d924f87 100644 --- a/couchpotato/core/notifications/history/main.py +++ b/couchpotato/core/notifications/history/main.py @@ -12,7 +12,7 @@ class History(Notification): listen_to = ['movie.downloaded', 'movie.snatched', 'renamer.canceled'] - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): db = get_session() history = Hist( diff --git a/couchpotato/core/notifications/notifo/main.py b/couchpotato/core/notifications/notifo/main.py index d4baaf6..e372f28 100644 --- a/couchpotato/core/notifications/notifo/main.py +++ b/couchpotato/core/notifications/notifo/main.py @@ -12,7 +12,7 @@ class Notifo(Notification): url = 'https://api.notifo.com/v1/send_notification' - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return try: diff --git a/couchpotato/core/notifications/notifymyandroid/main.py b/couchpotato/core/notifications/notifymyandroid/main.py index 2f84317..195278e 100644 --- a/couchpotato/core/notifications/notifymyandroid/main.py +++ b/couchpotato/core/notifications/notifymyandroid/main.py @@ -7,7 +7,7 @@ log = CPLog(__name__) class NotifyMyAndroid(Notification): - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return nma = pynma.PyNMA() diff --git a/couchpotato/core/notifications/notifymywp/main.py b/couchpotato/core/notifications/notifymywp/main.py index 203fdad..17252c1 100644 --- a/couchpotato/core/notifications/notifymywp/main.py +++ b/couchpotato/core/notifications/notifymywp/main.py @@ -7,7 +7,7 @@ log = CPLog(__name__) class NotifyMyWP(Notification): - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return keys = [x.strip() for x in self.conf('api_key').split(',')] diff --git a/couchpotato/core/notifications/prowl/main.py b/couchpotato/core/notifications/prowl/main.py index 44aaa9c..5f24d4e 100644 --- a/couchpotato/core/notifications/prowl/main.py +++ b/couchpotato/core/notifications/prowl/main.py @@ -8,7 +8,7 @@ log = CPLog(__name__) class Prowl(Notification): - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return http_handler = HTTPSConnection('api.prowlapp.com') diff --git a/couchpotato/core/notifications/pushover/main.py b/couchpotato/core/notifications/pushover/main.py index d531f2b..be99df1 100644 --- a/couchpotato/core/notifications/pushover/main.py +++ b/couchpotato/core/notifications/pushover/main.py @@ -10,7 +10,7 @@ class Pushover(Notification): app_token = 'YkxHMYDZp285L265L3IwH3LmzkTaCy' - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return http_handler = HTTPSConnection("api.pushover.net:443") diff --git a/couchpotato/core/notifications/twitter/main.py b/couchpotato/core/notifications/twitter/main.py index 700f7fa..b956dd0 100644 --- a/couchpotato/core/notifications/twitter/main.py +++ b/couchpotato/core/notifications/twitter/main.py @@ -31,7 +31,7 @@ class Twitter(Notification): addApiView('notify.%s.auth_url' % self.getName().lower(), self.getAuthorizationUrl) addApiView('notify.%s.credentials' % self.getName().lower(), self.getCredentials) - def notify(self, message = '', data = {}): + 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 cbc81df..eff591a 100644 --- a/couchpotato/core/notifications/xbmc/main.py +++ b/couchpotato/core/notifications/xbmc/main.py @@ -10,7 +10,7 @@ class XBMC(Notification): listen_to = ['movie.downloaded'] - def notify(self, message = '', data = {}): + def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return for host in [x.strip() for x in self.conf('host').split(",")]: