Browse Source

Add notification_type to core notifications. closes #189

tags/build/2.0.0.pre1
Ruud 13 years ago
parent
commit
50b5d01d95
  1. 7
      couchpotato/core/notifications/base.py
  2. 2
      couchpotato/core/notifications/boxcar/main.py
  3. 4
      couchpotato/core/notifications/core/main.py
  4. 2
      couchpotato/core/notifications/growl/main.py
  5. 2
      couchpotato/core/notifications/history/main.py
  6. 2
      couchpotato/core/notifications/notifo/main.py
  7. 2
      couchpotato/core/notifications/notifymyandroid/main.py
  8. 2
      couchpotato/core/notifications/notifymywp/main.py
  9. 2
      couchpotato/core/notifications/prowl/main.py
  10. 2
      couchpotato/core/notifications/pushover/main.py
  11. 2
      couchpotato/core/notifications/twitter/main.py
  12. 2
      couchpotato/core/notifications/xbmc/main.py

7
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})

2
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:

4
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

2
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()

2
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(

2
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:

2
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()

2
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(',')]

2
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')

2
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")

2
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'))

2
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(",")]:

Loading…
Cancel
Save