Add notification_type to core notifications. closes #189
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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(',')]
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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(",")]:
|
||||
|
||||
Reference in New Issue
Block a user