summaryrefslogtreecommitdiffstats
path: root/avahi-utils
diff options
context:
space:
mode:
authorSebastien Estienne <sebastien.estienne@gmail.com>2005-10-27 19:50:01 +0000
committerSebastien Estienne <sebastien.estienne@gmail.com>2005-10-27 19:50:01 +0000
commit7bf288feae074e17626b94cbf3b37a5ec4224187 (patch)
tree652720d9c0298403edf50094398b6fcb7a0db1a6 /avahi-utils
parent9aa4773acbfadbcf95aaf0063510f8be8ddcbd86 (diff)
* nicer display of txt records
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@900 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-utils')
-rwxr-xr-xavahi-utils/avahi-discover.in29
1 files changed, 22 insertions, 7 deletions
diff --git a/avahi-utils/avahi-discover.in b/avahi-utils/avahi-discover.in
index 1083b6c..00a5602 100755
--- a/avahi-utils/avahi-discover.in
+++ b/avahi-utils/avahi-discover.in
@@ -73,12 +73,7 @@ class Main_window(SimpleGladeApp):
print "\tHost %s (%s), port %i, TXT data: %s" % (host, address, port, str(avahi.txt_array_to_string_array(txt)))
- if len(txt) == 0:
- txt_data = "<i>empty</i>"
- else:
- txt_data = str(avahi.txt_array_to_string_array(txt))
-
- self.update_label(interface, protocol, name, stype, domain, host, aprotocol, address, port, txt_data)
+ self.update_label(interface, protocol, name, stype, domain, host, aprotocol, address, port, avahi.txt_array_to_string_array(txt))
def print_error(self, err):
error_label = "<b>Error:</b> %s" % (err)
@@ -172,8 +167,28 @@ class Main_window(SimpleGladeApp):
if domain != "local":
self.browse_domain(interface, protocol, domain)
+ def pair_to_dict(self, l):
+ res = dict()
+ for el in l:
+ if "=" not in el:
+ res[el]=''
+ else:
+ tmp = el.split('=',1)
+ if len(tmp[0]) > 0:
+ res[tmp[0]] = tmp[1]
+ return res
+
+
def update_label(self,interface, protocol, name, stype, domain, host, aprotocol, address, port, txt):
- infos = "<b>Service Type:</b> %s\n<b>Service Name:</b> %s\n<b>Domain Name:</b> %s\n<b>Interface:</b> %s %s\n<b>Address:</b> %s/%s:%i\n<b>TXT Data:</b> %s" % (stype, name, domain, self.siocgifname(interface), self.protoname(protocol), host, address, port, str(txt))
+ if len(txt) != 0:
+ txts = ""
+ txtd = self.pair_to_dict(txt)
+ for k,v in txtd.items():
+ txts+="<b>TXT <i>%s</i></b> = %s\n" % (k,v)
+ else:
+ txts = "<b>TXT Data:</b> <i>empty</i>"
+
+ infos = "<b>Service Type:</b> %s\n<b>Service Name:</b> %s\n<b>Domain Name:</b> %s\n<b>Interface:</b> %s %s\n<b>Address:</b> %s/%s:%i\n%s" % (stype, name, domain, self.siocgifname(interface), self.protoname(protocol), host, address, port, txts.strip())
self.info_label.set_markup(infos)
def insert_row(self, model,parent,