wilder scheiss um die macs für die geomap zuzuordnen

This commit is contained in:
Nils Schneider 2012-05-31 20:05:04 +02:00
parent 02d5026491
commit 2e5f3c3ea5
2 changed files with 25 additions and 0 deletions

View file

@ -32,6 +32,8 @@ if options['aliases']:
db.import_wikigps("http://freifunk.metameute.de/Knoten") db.import_wikigps("http://freifunk.metameute.de/Knoten")
db.wilder_scheiss()
m = GeoMapBuilder(db) m = GeoMapBuilder(db)
print(m.build()) print(m.build())

View file

@ -178,3 +178,26 @@ class NodeDB:
self._nodes.append(node) self._nodes.append(node)
node.gps = pair[1] 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)