diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html
index b04047c0..d57ca0ed 100644
--- a/data/interfaces/default/config.html
+++ b/data/interfaces/default/config.html
@@ -448,7 +448,7 @@
XBMC Host:Port:
-
e.g. http://localhost:8080
+
e.g. http://localhost:8080. Separate hosts with commas
XBMC Username:
XBMC Password:
Update XBMC Library
diff --git a/data/interfaces/remix/config.html b/data/interfaces/remix/config.html
index b04047c0..d57ca0ed 100644
--- a/data/interfaces/remix/config.html
+++ b/data/interfaces/remix/config.html
@@ -448,7 +448,7 @@
Enable XBMC Updates
XBMC Host:Port:
- e.g. http://localhost:8080
+ e.g. http://localhost:8080. Separate hosts with commas
XBMC Username:
XBMC Password:
Update XBMC Library
diff --git a/headphones/notifiers.py b/headphones/notifiers.py
index 166636fd..9101d741 100644
--- a/headphones/notifiers.py
+++ b/headphones/notifiers.py
@@ -66,37 +66,39 @@ class XBMC:
def __init__(self):
- self.host = headphones.XBMC_HOST
+ self.hosts = headphones.XBMC_HOST
self.username = headphones.XBMC_USERNAME
self.password = headphones.XBMC_PASSWORD
def _send(self, command):
- host = self.host
+ hosts = [x.strip() for x in self.hosts.split(',')]
username = self.username
password = self.password
url_command = urllib.urlencode(command)
- url = host + '/xbmcCmds/xbmcHttp/?' + url_command
+ for host in hosts:
- req = urllib2.Request(url)
-
- if password:
- base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
- req.add_header("Authorization", "Basic %s" % base64string)
+ url = host + '/xbmcCmds/xbmcHttp/?' + url_command
- logger.info('XBMC url: %s' % url)
-
- try:
- handle = urllib2.urlopen(req)
- except Exception, e:
- logger.warn('Error opening XBMC url: ' % e)
- return
-
- response = handle.read().decode(headphones.SYS_ENCODING)
-
- return response
+ req = urllib2.Request(url)
+
+ if password:
+ base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
+ req.add_header("Authorization", "Basic %s" % base64string)
+
+ logger.info('XBMC url: %s' % url)
+
+ try:
+ handle = urllib2.urlopen(req)
+ except Exception, e:
+ logger.warn('Error opening XBMC url: ' % e)
+ return
+
+ response = handle.read().decode(headphones.SYS_ENCODING)
+
+ return response
def update(self):