From 03853a8ac0af2b20bacc43d0270d0852da002e4d Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 4 Jun 2012 18:37:40 +0200 Subject: [PATCH] read nickname from wiki --- bat2nodes.py | 2 ++ nodedb.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bat2nodes.py b/bat2nodes.py index d07faed..6c818a8 100644 --- a/bat2nodes.py +++ b/bat2nodes.py @@ -33,6 +33,8 @@ db.import_batman(list(fileinput.input(options['batmanjson']))) if options['aliases']: db.import_aliases(json.load(open(options['aliases']))) +db.import_wikigps("http://freifunk.metameute.de/Knoten") + if options['gateway']: db.mark_gateways(options['gateway']) diff --git a/nodedb.py b/nodedb.py index 87a0c27..64e1fa1 100644 --- a/nodedb.py +++ b/nodedb.py @@ -190,8 +190,9 @@ class NodeDB: macs = [s for s in [s.strip() for s in node['MAC'].split(',')] if s] gps = [s for s in [s.strip() for s in node['GPS'].split(',')] if s] + names = [s for s in [s.strip() for s in node['Nick'].split(',')] if s] - for pair in zip(macs, gps): + for pair in zip(macs, gps, names): try: node = self.maybe_node_by_mac((pair[0], )) except: @@ -199,6 +200,9 @@ class NodeDB: node.add_mac(pair[0]) self._nodes.append(node) + if pair[2]: + node.name = pair[2] + node.gps = pair[1] def find_link(self, i):