|
|
@ -13,6 +13,7 @@ class XBMC(Notification): |
|
|
|
|
|
|
|
listen_to = ['renamer.after'] |
|
|
|
use_json_notifications = {} |
|
|
|
couch_logo_url = 'https://raw.github.com/RuudBurger/CouchPotatoServer/master/couchpotato/static/images/xbmc-notify.png' |
|
|
|
|
|
|
|
def notify(self, message = '', data = {}, listener = None): |
|
|
|
if self.isDisabled(): return |
|
|
@ -27,7 +28,7 @@ class XBMC(Notification): |
|
|
|
|
|
|
|
if self.use_json_notifications.get(host): |
|
|
|
response = self.request(host, [ |
|
|
|
('GUI.ShowNotification', {'title':self.default_title, 'message':message}), |
|
|
|
('GUI.ShowNotification', {'title': self.default_title, 'message': message, 'image': self.couch_logo_url}), |
|
|
|
('VideoLibrary.Scan', {}), |
|
|
|
]) |
|
|
|
else: |
|
|
@ -89,7 +90,7 @@ class XBMC(Notification): |
|
|
|
self.use_json_notifications[host] = True |
|
|
|
|
|
|
|
# send the text message |
|
|
|
resp = self.request(host, [('GUI.ShowNotification', {'title':self.default_title, 'message':message})]) |
|
|
|
resp = self.request(host, [('GUI.ShowNotification', {'title':self.default_title, 'message':message, 'image':self.couch_logo_url})]) |
|
|
|
for result in resp: |
|
|
|
if (result.get('result') and result['result'] == 'OK'): |
|
|
|
log.debug('Message delivered successfully!') |
|
|
@ -111,8 +112,8 @@ class XBMC(Notification): |
|
|
|
|
|
|
|
server = 'http://%s/xbmcCmds/' % host |
|
|
|
|
|
|
|
# title, message [, timeout , image #can be added!] |
|
|
|
cmd = "xbmcHttp?command=ExecBuiltIn(Notification('%s','%s'))" % (urllib.quote(data['title']), urllib.quote(data['message'])) |
|
|
|
# Notification(title, message [, timeout , image]) |
|
|
|
cmd = "xbmcHttp?command=ExecBuiltIn(Notification(%s,%s,'',%s))" % (urllib.quote(data['title']), urllib.quote(data['message']), urllib.quote(self.couch_logo_url)) |
|
|
|
server += cmd |
|
|
|
|
|
|
|
# I have no idea what to set to, just tried text/plain and seems to be working :) |
|
|
|