Switch to side-by-side view

--- a/web/scweb.py
+++ b/web/scweb.py
@@ -3,6 +3,31 @@
 import bottle
 import re
 import time
+
+SPLITRE = '''\|\|'''
+
+def _listReceivers():
+    devnull = open('/dev/null', 'w')
+    try:
+        data = subprocess.check_output(['scctl', '-lm'], stderr = devnull)
+    except:
+        data = "scctl error"
+    o = []
+    for line in data.splitlines():
+        #print >> sys.stderr, line
+        fields = re.split(SPLITRE, line);
+        if len(fields) == 4:
+            status, fname, uuid, uri = fields
+        elif len(fields) == 3:
+            status, fname, uuid = fields
+            uri = ''
+        else:
+            status = None
+        if status:
+            status = status.strip()
+        if status is not None:
+            o.append((fname, status, uuid, uri))
+    return o
 
 @bottle.route('/static/:path#.+#')
 def server_static(path):
@@ -20,25 +45,7 @@
 @bottle.route('/list')
 @bottle.view('list')
 def listReceivers():
-    devnull = open('/dev/null', 'w')
-    try:
-        data = subprocess.check_output(['scctl', '-l'], stderr = devnull)
-    except:
-        data = "scctl error"
-    o = []
-    for line in data.splitlines():
-        #print >> sys.stderr, line
-        fields = re.split('''\s+''', line);
-        if len(fields) == 4:
-            status, fname, uuid, uri = fields
-        elif len(fields) == 3:
-            status, fname, uuid = fields
-            uri = ''
-        else:
-            status = None
-        if status is not None:
-            o.append((fname, status, uuid, uri))
-    return {'receivers' : o}
+    return {'receivers' : _listReceivers()}
 
 @bottle.route('/assoc')
 @bottle.post('/assoc')
@@ -47,35 +54,30 @@
     devnull = open('/dev/null', 'w')
 
     assocs = bottle.request.forms.getall('Assoc')
-    master = bottle.request.forms.get('Master')
-    if master != '' and len(assocs) != 0:
-        arglist = ['scctl', '-s', master]
+    sender = bottle.request.forms.get('Sender')
+    if sender != '' and len(assocs) != 0:
+        arglist = ['scctl', '-r', sender]
         for uuid in assocs:
             arglist.append(uuid)
-            try:
-                subprocess.check_call(arglist, stderr = devnull)
-            except:
-                pass
+        print >> sys.stderr, arglist
+
+        try:
+            subprocess.check_call(arglist, stderr = devnull)
+        except:
+            pass
 
     try:
-        data = subprocess.check_output(['scctl', '-l'], stderr = devnull)
+        data = subprocess.check_output(['scctl', '-Lm'], stderr = devnull)
     except:
         data = "scctl error"
 
-    a = []
-    o = []
+    s = []
     for line in data.splitlines():
-        fields = re.split('''\s+''', line);
-        if len(fields) == 4:
-            status, fname, uuid, uri = fields
-            if status != 'Off' and uri != '':
-                a.append((fname, status, uuid, uri))
-            else:
-                o.append((fname, status, uuid, uri))
-        elif len(fields) == 3:
-            status, fname, uuid = fields
-            o.append(fname, status, uuid, '')
-    return {'active' : a, 'others' : o}
+        fields = re.split(SPLITRE, line);
+        fname, uuid, reason, uri = fields
+        s.append((fname, uuid, uri))
+
+    return {'receivers' : _listReceivers(), 'senders' : s}
 
 
 @bottle.route('/stop')
@@ -90,13 +92,13 @@
             pass
 
     try:
-        data = subprocess.check_output(['scctl', '-l'], stderr = devnull)
+        data = subprocess.check_output(['scctl', '-lm'], stderr = devnull)
     except:
         data = "scctl error"
 
     a = []
     for line in data.splitlines():
-        fields = re.split('''\s+''', line);
+        fields = re.split(SPLITRE, line);
         if len(fields) == 4:
             status, fname, uuid, uri = fields
             if status != 'Off':