Fix XBMC and NMA Notification tests
This commit is contained in:
@@ -21,8 +21,11 @@ class NotifyMyAndroid(Notification):
|
|||||||
|
|
||||||
response = nma.push(self.default_title, self.event , message, self.conf('priority'), batch_mode = len(keys) > 1)
|
response = nma.push(self.default_title, self.event , message, self.conf('priority'), batch_mode = len(keys) > 1)
|
||||||
|
|
||||||
|
successful = 0
|
||||||
for key in keys:
|
for key in keys:
|
||||||
if not response[str(key)]['code'] == u'200':
|
if not response[str(key)]['code'] == u'200':
|
||||||
log.error('Could not send notification to NotifyMyAndroid (%s). %s', (key, response[key]['message']))
|
log.error('Could not send notification to NotifyMyAndroid (%s). %s', (key, response[key]['message']))
|
||||||
|
else:
|
||||||
|
successful += 1
|
||||||
|
|
||||||
return response
|
return successful == len(keys)
|
||||||
@@ -13,11 +13,15 @@ class XBMC(Notification):
|
|||||||
def notify(self, message = '', data = {}, listener = None):
|
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(",")]:
|
hosts = [x.strip() for x in self.conf('host').split(",")]
|
||||||
self.send({'command': 'ExecBuiltIn', 'parameter': 'Notification(CouchPotato, %s)' % message}, host)
|
successful = 0
|
||||||
self.send({'command': 'ExecBuiltIn', 'parameter': 'XBMC.updatelibrary(video)'}, host)
|
for host in hosts:
|
||||||
|
if self.send({'command': 'ExecBuiltIn', 'parameter': 'Notification(CouchPotato, %s)' % message}, host):
|
||||||
|
success += 1
|
||||||
|
if self.send({'command': 'ExecBuiltIn', 'parameter': 'XBMC.updatelibrary(video)'}, host):
|
||||||
|
success += 1
|
||||||
|
|
||||||
return True
|
return successful == len(hosts)*2
|
||||||
|
|
||||||
def send(self, command, host):
|
def send(self, command, host):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user