Add notification_type to core notifications. closes #189
This commit is contained in:
1 parent
eb0669f15c
commit
50b5d01d95
12 files changed
+17
-14
No files matched your search
@@ -30,11 +30,11 @@ class Notification(Plugin):
|
|||||||
def notify(message, data):
|
def notify(message, data):
|
||||||
if not self.conf('on_snatch', default = True) and listener == 'movie.snatched':
|
if not self.conf('on_snatch', default = True) and listener == 'movie.snatched':
|
||||||
return
|
return
|
||||||
return self.notify(message = message, data = data)
|
return self.notify(message = message, data = data, listener = listener)
|
||||||
|
|
||||||
return notify
|
return notify
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
@@ -45,7 +45,8 @@ class Notification(Plugin):
|
|||||||
|
|
||||||
success = self.notify(
|
success = self.notify(
|
||||||
message = self.test_message,
|
message = self.test_message,
|
||||||
data = {}
|
data = {},
|
||||||
|
listener = 'test'
|
||||||
)
|
)
|
||||||
|
|
||||||
return jsonified({'success': success})
|
return jsonified({'success': success})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Boxcar(Notification):
|
|||||||
|
|
||||||
url = 'https://boxcar.io/devices/providers/7MNNXY3UIzVBwvzkKwkC/notifications'
|
url = 'https://boxcar.io/devices/providers/7MNNXY3UIzVBwvzkKwkC/notifications'
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -96,10 +96,12 @@ class CoreNotifier(Notification):
|
|||||||
'notifications': notifications
|
'notifications': notifications
|
||||||
})
|
})
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
|
|
||||||
db = get_session()
|
db = get_session()
|
||||||
|
|
||||||
|
data['notification_type'] = listener if listener else 'unknown'
|
||||||
|
|
||||||
n = Notif(
|
n = Notif(
|
||||||
message = toUnicode(message),
|
message = toUnicode(message),
|
||||||
data = data
|
data = data
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Growl(Notification):
|
|||||||
except:
|
except:
|
||||||
log.error('Failed register of growl: %s' % traceback.format_exc())
|
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
|
if self.isDisabled(): return
|
||||||
|
|
||||||
self.register()
|
self.register()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class History(Notification):
|
|||||||
|
|
||||||
listen_to = ['movie.downloaded', 'movie.snatched', 'renamer.canceled']
|
listen_to = ['movie.downloaded', 'movie.snatched', 'renamer.canceled']
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
|
|
||||||
db = get_session()
|
db = get_session()
|
||||||
history = Hist(
|
history = Hist(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Notifo(Notification):
|
|||||||
|
|
||||||
url = 'https://api.notifo.com/v1/send_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
|
if self.isDisabled(): return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ log = CPLog(__name__)
|
|||||||
|
|
||||||
class NotifyMyAndroid(Notification):
|
class NotifyMyAndroid(Notification):
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
|
|
||||||
nma = pynma.PyNMA()
|
nma = pynma.PyNMA()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ log = CPLog(__name__)
|
|||||||
|
|
||||||
class NotifyMyWP(Notification):
|
class NotifyMyWP(Notification):
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
|
|
||||||
keys = [x.strip() for x in self.conf('api_key').split(',')]
|
keys = [x.strip() for x in self.conf('api_key').split(',')]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ log = CPLog(__name__)
|
|||||||
|
|
||||||
class Prowl(Notification):
|
class Prowl(Notification):
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
|
|
||||||
http_handler = HTTPSConnection('api.prowlapp.com')
|
http_handler = HTTPSConnection('api.prowlapp.com')
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Pushover(Notification):
|
|||||||
|
|
||||||
app_token = 'YkxHMYDZp285L265L3IwH3LmzkTaCy'
|
app_token = 'YkxHMYDZp285L265L3IwH3LmzkTaCy'
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
|
|
||||||
http_handler = HTTPSConnection("api.pushover.net:443")
|
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.auth_url' % self.getName().lower(), self.getAuthorizationUrl)
|
||||||
addApiView('notify.%s.credentials' % self.getName().lower(), self.getCredentials)
|
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
|
if self.isDisabled(): return
|
||||||
|
|
||||||
api = Api(self.consumer_key, self.consumer_secret, self.conf('access_token_key'), self.conf('access_token_secret'))
|
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']
|
listen_to = ['movie.downloaded']
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
|
|
||||||
for host in [x.strip() for x in self.conf('host').split(",")]:
|
for host in [x.strip() for x in self.conf('host').split(",")]:
|
||||||
|
|||||||
Reference in new issue
Block a user