From 2e5f3c3ea526be543ef5c37f07dfc74fa10a3892 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 31 May 2012 20:05:04 +0200 Subject: [PATCH] =?UTF-8?q?wilder=20scheiss=20um=20die=20macs=20f=C3=BCr?= =?UTF-8?q?=20die=20geomap=20zuzuordnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bat2geomap.py | 2 ++ nodedb.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/bat2geomap.py b/bat2geomap.py index d8b7e40..0148e05 100644 --- a/bat2geomap.py +++ b/bat2geomap.py @@ -32,6 +32,8 @@ if options['aliases']: db.import_wikigps("http://freifunk.metameute.de/Knoten") +db.wilder_scheiss() + m = GeoMapBuilder(db) print(m.build()) diff --git a/nodedb.py b/nodedb.py index 069b391..fc7b6af 100644 --- a/nodedb.py +++ b/nodedb.py @@ -178,3 +178,26 @@ class NodeDB: self._nodes.append(node) node.gps = pair[1] + + def find_link(self, i): + for link in self._links: + if i in link: + return link + + def wilder_scheiss(self): + for node in self._nodes: + if node.group == 3 and node.gps: + i = self._nodes.index(node) + link = self.find_link(i) + if link: + linklist = list(link) + linklist.remove(i) + j = linklist[0] + + for mac in self._nodes[i].macs: + self._nodes[j].add_mac(mac) + + self._nodes[j].gps = self._nodes[i].gps + + self._links.remove(link) + self._nodes.remove(node)