General notification icons
This commit is contained in:
@@ -37,6 +37,9 @@ class Notification(Plugin):
|
|||||||
|
|
||||||
return notify
|
return notify
|
||||||
|
|
||||||
|
def getNotificationImage(self, size = 'small'):
|
||||||
|
return 'https://raw.github.com/RuudBurger/CouchPotatoServer/master/couchpotato/static/images/notify.couch.%s.png' % size
|
||||||
|
|
||||||
def notify(self, message = '', data = {}, listener = None):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ class Pushalot(Notification):
|
|||||||
'AuthorizationToken': self.conf('auth_token'),
|
'AuthorizationToken': self.conf('auth_token'),
|
||||||
'Title': self.default_title,
|
'Title': self.default_title,
|
||||||
'Body': toUnicode(message),
|
'Body': toUnicode(message),
|
||||||
'LinkTitle': toUnicode("CouchPotato"),
|
|
||||||
'link': toUnicode("https://couchpota.to/"),
|
|
||||||
'IsImportant': self.conf('important'),
|
'IsImportant': self.conf('important'),
|
||||||
'IsSilent': self.conf('silent'),
|
'IsSilent': self.conf('silent'),
|
||||||
|
'Image': toUnicode(self.getNotificationImage('medium')),
|
||||||
|
'Source': toUnicode(self.default_title)
|
||||||
}
|
}
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ class XBMC(Notification):
|
|||||||
|
|
||||||
listen_to = ['renamer.after']
|
listen_to = ['renamer.after']
|
||||||
use_json_notifications = {}
|
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):
|
def notify(self, message = '', data = {}, listener = None):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
@@ -28,7 +27,7 @@ class XBMC(Notification):
|
|||||||
|
|
||||||
if self.use_json_notifications.get(host):
|
if self.use_json_notifications.get(host):
|
||||||
response = self.request(host, [
|
response = self.request(host, [
|
||||||
('GUI.ShowNotification', {'title': self.default_title, 'message': message, 'image': self.couch_logo_url}),
|
('GUI.ShowNotification', {'title': self.default_title, 'message': message, 'image': self.getNotificationImage('small')}),
|
||||||
('VideoLibrary.Scan', {}),
|
('VideoLibrary.Scan', {}),
|
||||||
])
|
])
|
||||||
else:
|
else:
|
||||||
@@ -90,7 +89,7 @@ class XBMC(Notification):
|
|||||||
self.use_json_notifications[host] = True
|
self.use_json_notifications[host] = True
|
||||||
|
|
||||||
# send the text message
|
# send the text message
|
||||||
resp = self.request(host, [('GUI.ShowNotification', {'title':self.default_title, 'message':message, 'image':self.couch_logo_url})])
|
resp = self.request(host, [('GUI.ShowNotification', {'title':self.default_title, 'message':message, 'image': self.getNotificationImage('small')})])
|
||||||
for result in resp:
|
for result in resp:
|
||||||
if (result.get('result') and result['result'] == 'OK'):
|
if (result.get('result') and result['result'] == 'OK'):
|
||||||
log.debug('Message delivered successfully!')
|
log.debug('Message delivered successfully!')
|
||||||
@@ -113,7 +112,7 @@ class XBMC(Notification):
|
|||||||
server = 'http://%s/xbmcCmds/' % host
|
server = 'http://%s/xbmcCmds/' % host
|
||||||
|
|
||||||
# Notification(title, message [, timeout , image])
|
# 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))
|
cmd = "xbmcHttp?command=ExecBuiltIn(Notification(%s,%s,'',%s))" % (urllib.quote(data['title']), urllib.quote(data['message']), urllib.quote(self.getNotificationImage('medium')))
|
||||||
server += cmd
|
server += cmd
|
||||||
|
|
||||||
# I have no idea what to set to, just tried text/plain and seems to be working :)
|
# I have no idea what to set to, just tried text/plain and seems to be working :)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Reference in New Issue
Block a user