From 108044948fef08006d43acdabd1fb2d3e0a816a3 Mon Sep 17 00:00:00 2001 From: mano3m <-> Date: Tue, 24 Jul 2012 22:49:49 +0200 Subject: [PATCH 1/4] Fix XBMC and NMA Notification tests --- .../core/notifications/notifymyandroid/main.py | 5 ++++- couchpotato/core/notifications/xbmc/main.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/notifications/notifymyandroid/main.py b/couchpotato/core/notifications/notifymyandroid/main.py index a6a316da..52e21413 100644 --- a/couchpotato/core/notifications/notifymyandroid/main.py +++ b/couchpotato/core/notifications/notifymyandroid/main.py @@ -21,8 +21,11 @@ class NotifyMyAndroid(Notification): response = nma.push(self.default_title, self.event , message, self.conf('priority'), batch_mode = len(keys) > 1) + successful = 0 for key in keys: if not response[str(key)]['code'] == u'200': log.error('Could not send notification to NotifyMyAndroid (%s). %s', (key, response[key]['message'])) + else: + successful += 1 - return response + return successful == len(keys) \ No newline at end of file diff --git a/couchpotato/core/notifications/xbmc/main.py b/couchpotato/core/notifications/xbmc/main.py index 4f6e62a7..5f16bdb8 100644 --- a/couchpotato/core/notifications/xbmc/main.py +++ b/couchpotato/core/notifications/xbmc/main.py @@ -13,11 +13,15 @@ class XBMC(Notification): def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return - for host in [x.strip() for x in self.conf('host').split(",")]: - self.send({'command': 'ExecBuiltIn', 'parameter': 'Notification(CouchPotato, %s)' % message}, host) - self.send({'command': 'ExecBuiltIn', 'parameter': 'XBMC.updatelibrary(video)'}, host) + hosts = [x.strip() for x in self.conf('host').split(",")] + successful = 0 + 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): From 80929b5806d498241e404cd352aecfc53e64bfe4 Mon Sep 17 00:00:00 2001 From: mano3m <-> Date: Tue, 24 Jul 2012 22:55:53 +0200 Subject: [PATCH 2/4] small fix to xbmc notification test --- couchpotato/core/notifications/xbmc/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/notifications/xbmc/main.py b/couchpotato/core/notifications/xbmc/main.py index 5f16bdb8..1c83bdd5 100644 --- a/couchpotato/core/notifications/xbmc/main.py +++ b/couchpotato/core/notifications/xbmc/main.py @@ -17,9 +17,9 @@ class XBMC(Notification): successful = 0 for host in hosts: if self.send({'command': 'ExecBuiltIn', 'parameter': 'Notification(CouchPotato, %s)' % message}, host): - success += 1 + successful += 1 if self.send({'command': 'ExecBuiltIn', 'parameter': 'XBMC.updatelibrary(video)'}, host): - success += 1 + successful += 1 return successful == len(hosts)*2 From 2406e9ef8554532849b48a9b8644fce243e4f13d Mon Sep 17 00:00:00 2001 From: mano3m <-> Date: Tue, 24 Jul 2012 23:27:26 +0200 Subject: [PATCH 3/4] Fixed NMJ test --- couchpotato/core/notifications/nmj/main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/notifications/nmj/main.py b/couchpotato/core/notifications/nmj/main.py index 8f0e201d..1a794fbe 100644 --- a/couchpotato/core/notifications/nmj/main.py +++ b/couchpotato/core/notifications/nmj/main.py @@ -19,7 +19,7 @@ class NMJ(Notification): def __init__(self): addEvent('renamer.after', self.addToLibrary) - + addApiView(self.testNotifyName(), self.test) addApiView('notify.nmj.auto_config', self.autoConfig) def autoConfig(self): @@ -76,7 +76,7 @@ class NMJ(Notification): mount = self.conf('mount') database = self.conf('database') - if self.mount: + if mount: log.debug('Try to mount network drive via url: %s', (mount)) try: data = self.urlopen(mount) @@ -114,3 +114,8 @@ class NMJ(Notification): def failed(self): return jsonified({'success': False}) + + def test(self): + return jsonified({'success': self.addToLibrary()}) + + From 46c73dc43cdce4a4b474b26661bc83ee090fdaec Mon Sep 17 00:00:00 2001 From: mano3m <-> Date: Wed, 25 Jul 2012 00:09:13 +0200 Subject: [PATCH 4/4] Fix hint being added to the notification test button texts --- couchpotato/core/notifications/core/static/notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/notifications/core/static/notification.js b/couchpotato/core/notifications/core/static/notification.js index 595a39ed..db9db843 100644 --- a/couchpotato/core/notifications/core/static/notification.js +++ b/couchpotato/core/notifications/core/static/notification.js @@ -216,7 +216,7 @@ var NotificationBase = new Class({ }, testButtonName: function(fieldset){ - var name = fieldset.getElement('h2').get('text'); + var name = String(fieldset.getElement('h2').innerHTML).substring(0,String(fieldset.getElement('h2').innerHTML).indexOf("