diff --git a/bat2geomap.py b/bat2geomap.py new file mode 100644 index 0000000..d8b7e40 --- /dev/null +++ b/bat2geomap.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# TODO +# Gatewayliste +# aliases.json + +import json +import fileinput +import argparse + +from nodedb import NodeDB +from geomapbuilder import GeoMapBuilder + +parser = argparse.ArgumentParser() + +parser.add_argument('-a', '--aliases', + help='read aliases from FILE', + metavar='FILE') + +parser.add_argument('batmanjson', help='output of batman vd json') + +args = parser.parse_args() + +options = vars(args) + +db = NodeDB() + +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") + +m = GeoMapBuilder(db) + +print(m.build()) diff --git a/geomapbuilder.py b/geomapbuilder.py new file mode 100644 index 0000000..5ac8fea --- /dev/null +++ b/geomapbuilder.py @@ -0,0 +1,113 @@ +class GeoMapBuilder: + kml_template = """ + + + + + + + + %s + +""" + + def __init__(self, db): + self._db = db + + def build(self): + text = [] + + nodes = self._db.get_nodes() + + for node in nodes: + try: + text.append(GeoNode(node).render()) + except: + continue + + for link in self._db.get_links(): + try: + text.append(GeoEdge(nodes, link).render()) + except: + continue + + return self.kml_template % "".join(text) + +def gps_format(s): + return ",".join(s.split(" ")[::-1]) + +class GeoNode: + kml_template = """ + %s + #router-%s + + %s,0 + + %s +""" + + def __init__(self, node): + self._node = node + + def render(self): + if not self._node.gps: + raise + + name = self._node.name + status = "up" if self._node.online else "down" + gps = gps_format(self._node.gps) + text = " ".join(self._node.macs) + + return self.kml_template % (name, status, gps, text) + +class GeoEdge: + kml_template = """ + + %s,0. %s,0. + + #%s +""" + + def __init__(self, nodes, link): + self._link = link + self.pair = [nodes[k] for k in link.pair] + + def render(self): + if not (self.pair[0].gps and self.pair[1].gps): + raise + + a = gps_format(self.pair[0].gps) + b = gps_format(self.pair[1].gps) + + return self.kml_template % (a, b, "wifi-link") diff --git a/html/geomap.html b/html/geomap.html new file mode 100644 index 0000000..bad4f19 --- /dev/null +++ b/html/geomap.html @@ -0,0 +1,122 @@ + + + + + + + Freifunk Lübeck - Knotenkarte + + + + + + + + + +

luebeck.freifunk.net

+ +

Knotenkarte

+
+ diff --git a/html/img/blank.gif b/html/img/blank.gif new file mode 100644 index 0000000..4bcc753 Binary files /dev/null and b/html/img/blank.gif differ diff --git a/html/img/cloud-popup-relative.png b/html/img/cloud-popup-relative.png new file mode 100755 index 0000000..9db138a Binary files /dev/null and b/html/img/cloud-popup-relative.png differ diff --git a/html/img/drag-rectangle-off.png b/html/img/drag-rectangle-off.png new file mode 100644 index 0000000..fc6daf4 Binary files /dev/null and b/html/img/drag-rectangle-off.png differ diff --git a/html/img/drag-rectangle-on.png b/html/img/drag-rectangle-on.png new file mode 100644 index 0000000..7f783ce Binary files /dev/null and b/html/img/drag-rectangle-on.png differ diff --git a/html/img/east-mini.png b/html/img/east-mini.png new file mode 100644 index 0000000..0707567 Binary files /dev/null and b/html/img/east-mini.png differ diff --git a/html/img/layer-switcher-maximize.png b/html/img/layer-switcher-maximize.png new file mode 100644 index 0000000..8d7bb16 Binary files /dev/null and b/html/img/layer-switcher-maximize.png differ diff --git a/html/img/layer-switcher-minimize.png b/html/img/layer-switcher-minimize.png new file mode 100644 index 0000000..e80bf21 Binary files /dev/null and b/html/img/layer-switcher-minimize.png differ diff --git a/html/img/marker-blue.png b/html/img/marker-blue.png new file mode 100644 index 0000000..83a90b4 Binary files /dev/null and b/html/img/marker-blue.png differ diff --git a/html/img/marker-gold.png b/html/img/marker-gold.png new file mode 100644 index 0000000..2ff9ec5 Binary files /dev/null and b/html/img/marker-gold.png differ diff --git a/html/img/marker-green.png b/html/img/marker-green.png new file mode 100644 index 0000000..17168f1 Binary files /dev/null and b/html/img/marker-green.png differ diff --git a/html/img/marker.png b/html/img/marker.png new file mode 100644 index 0000000..ccd1913 Binary files /dev/null and b/html/img/marker.png differ diff --git a/html/img/measuring-stick-off.png b/html/img/measuring-stick-off.png new file mode 100644 index 0000000..70c2dff Binary files /dev/null and b/html/img/measuring-stick-off.png differ diff --git a/html/img/measuring-stick-on.png b/html/img/measuring-stick-on.png new file mode 100644 index 0000000..cdb8f34 Binary files /dev/null and b/html/img/measuring-stick-on.png differ diff --git a/html/img/north-mini.png b/html/img/north-mini.png new file mode 100644 index 0000000..a8a0b40 Binary files /dev/null and b/html/img/north-mini.png differ diff --git a/html/img/panning-hand-off.png b/html/img/panning-hand-off.png new file mode 100644 index 0000000..4c912ac Binary files /dev/null and b/html/img/panning-hand-off.png differ diff --git a/html/img/panning-hand-on.png b/html/img/panning-hand-on.png new file mode 100644 index 0000000..6094c64 Binary files /dev/null and b/html/img/panning-hand-on.png differ diff --git a/html/img/slider.png b/html/img/slider.png new file mode 100644 index 0000000..23afd57 Binary files /dev/null and b/html/img/slider.png differ diff --git a/html/img/south-mini.png b/html/img/south-mini.png new file mode 100644 index 0000000..6c4ac8a Binary files /dev/null and b/html/img/south-mini.png differ diff --git a/html/img/west-mini.png b/html/img/west-mini.png new file mode 100644 index 0000000..db5f420 Binary files /dev/null and b/html/img/west-mini.png differ diff --git a/html/img/zoom-minus-mini.png b/html/img/zoom-minus-mini.png new file mode 100644 index 0000000..f9b63ab Binary files /dev/null and b/html/img/zoom-minus-mini.png differ diff --git a/html/img/zoom-plus-mini.png b/html/img/zoom-plus-mini.png new file mode 100644 index 0000000..eecf2eb Binary files /dev/null and b/html/img/zoom-plus-mini.png differ diff --git a/html/img/zoom-world-mini.png b/html/img/zoom-world-mini.png new file mode 100644 index 0000000..2159dde Binary files /dev/null and b/html/img/zoom-world-mini.png differ diff --git a/html/img/zoombar.png b/html/img/zoombar.png new file mode 100644 index 0000000..959f01a Binary files /dev/null and b/html/img/zoombar.png differ diff --git a/html/nodes.html b/html/nodes.html index 066c19a..e8cd737 100644 --- a/html/nodes.html +++ b/html/nodes.html @@ -2,9 +2,16 @@ - freifunk.luebeck.net nodes + Freifunk Lübeck - Knotengraph +

luebeck.freifunk.net

+ +

Knotenkarte

+
diff --git a/html/router-down.png b/html/router-down.png new file mode 100644 index 0000000..3b663cc Binary files /dev/null and b/html/router-down.png differ diff --git a/html/router-unknown.png b/html/router-unknown.png new file mode 100644 index 0000000..6f9a256 Binary files /dev/null and b/html/router-unknown.png differ diff --git a/html/router-up.png b/html/router-up.png new file mode 100644 index 0000000..4601bfb Binary files /dev/null and b/html/router-up.png differ diff --git a/html/theme/default/framedCloud.css b/html/theme/default/framedCloud.css new file mode 100644 index 0000000..e69de29 diff --git a/html/theme/default/google.css b/html/theme/default/google.css new file mode 100644 index 0000000..7f3c369 --- /dev/null +++ b/html/theme/default/google.css @@ -0,0 +1,9 @@ +.olLayerGoogleCopyright { + right: 3px; + bottom: 2px; +} +.olLayerGooglePoweredBy { + left: 2px; + bottom: 2px; +} + diff --git a/html/theme/default/ie6-style.css b/html/theme/default/ie6-style.css new file mode 100755 index 0000000..65f6b19 --- /dev/null +++ b/html/theme/default/ie6-style.css @@ -0,0 +1,7 @@ +.olControlZoomPanel div { + background-image: url(img/zoom-panel-NOALPHA.png); +} +.olControlPanPanel div { + background-image: url(img/pan-panel-NOALPHA.png); +} + diff --git a/html/theme/default/img/add_point_off.png b/html/theme/default/img/add_point_off.png new file mode 100644 index 0000000..aefd09c Binary files /dev/null and b/html/theme/default/img/add_point_off.png differ diff --git a/html/theme/default/img/add_point_on.png b/html/theme/default/img/add_point_on.png new file mode 100644 index 0000000..1294a2c Binary files /dev/null and b/html/theme/default/img/add_point_on.png differ diff --git a/html/theme/default/img/blank.gif b/html/theme/default/img/blank.gif new file mode 100644 index 0000000..4bcc753 Binary files /dev/null and b/html/theme/default/img/blank.gif differ diff --git a/html/theme/default/img/close.gif b/html/theme/default/img/close.gif new file mode 100644 index 0000000..a8958de Binary files /dev/null and b/html/theme/default/img/close.gif differ diff --git a/html/theme/default/img/drag-rectangle-off.png b/html/theme/default/img/drag-rectangle-off.png new file mode 100644 index 0000000..fc6daf4 Binary files /dev/null and b/html/theme/default/img/drag-rectangle-off.png differ diff --git a/html/theme/default/img/drag-rectangle-on.png b/html/theme/default/img/drag-rectangle-on.png new file mode 100644 index 0000000..7f783ce Binary files /dev/null and b/html/theme/default/img/drag-rectangle-on.png differ diff --git a/html/theme/default/img/draw_line_off.png b/html/theme/default/img/draw_line_off.png new file mode 100644 index 0000000..7f15612 Binary files /dev/null and b/html/theme/default/img/draw_line_off.png differ diff --git a/html/theme/default/img/draw_line_on.png b/html/theme/default/img/draw_line_on.png new file mode 100644 index 0000000..ba09186 Binary files /dev/null and b/html/theme/default/img/draw_line_on.png differ diff --git a/html/theme/default/img/draw_point_off.png b/html/theme/default/img/draw_point_off.png new file mode 100644 index 0000000..fde94bd Binary files /dev/null and b/html/theme/default/img/draw_point_off.png differ diff --git a/html/theme/default/img/draw_point_on.png b/html/theme/default/img/draw_point_on.png new file mode 100644 index 0000000..8804221 Binary files /dev/null and b/html/theme/default/img/draw_point_on.png differ diff --git a/html/theme/default/img/draw_polygon_off.png b/html/theme/default/img/draw_polygon_off.png new file mode 100644 index 0000000..53ce9d7 Binary files /dev/null and b/html/theme/default/img/draw_polygon_off.png differ diff --git a/html/theme/default/img/draw_polygon_on.png b/html/theme/default/img/draw_polygon_on.png new file mode 100644 index 0000000..2a33376 Binary files /dev/null and b/html/theme/default/img/draw_polygon_on.png differ diff --git a/html/theme/default/img/editing_tool_bar.png b/html/theme/default/img/editing_tool_bar.png new file mode 100644 index 0000000..464340e Binary files /dev/null and b/html/theme/default/img/editing_tool_bar.png differ diff --git a/html/theme/default/img/move_feature_off.png b/html/theme/default/img/move_feature_off.png new file mode 100644 index 0000000..9f588db Binary files /dev/null and b/html/theme/default/img/move_feature_off.png differ diff --git a/html/theme/default/img/move_feature_on.png b/html/theme/default/img/move_feature_on.png new file mode 100644 index 0000000..072f066 Binary files /dev/null and b/html/theme/default/img/move_feature_on.png differ diff --git a/html/theme/default/img/navigation_history.png b/html/theme/default/img/navigation_history.png new file mode 100644 index 0000000..053d1e0 Binary files /dev/null and b/html/theme/default/img/navigation_history.png differ diff --git a/html/theme/default/img/overview_replacement.gif b/html/theme/default/img/overview_replacement.gif new file mode 100644 index 0000000..a82cf5f Binary files /dev/null and b/html/theme/default/img/overview_replacement.gif differ diff --git a/html/theme/default/img/pan-panel-NOALPHA.png b/html/theme/default/img/pan-panel-NOALPHA.png new file mode 100755 index 0000000..2740d8b Binary files /dev/null and b/html/theme/default/img/pan-panel-NOALPHA.png differ diff --git a/html/theme/default/img/pan-panel.png b/html/theme/default/img/pan-panel.png new file mode 100755 index 0000000..9910121 Binary files /dev/null and b/html/theme/default/img/pan-panel.png differ diff --git a/html/theme/default/img/pan_off.png b/html/theme/default/img/pan_off.png new file mode 100644 index 0000000..30b2aed Binary files /dev/null and b/html/theme/default/img/pan_off.png differ diff --git a/html/theme/default/img/pan_on.png b/html/theme/default/img/pan_on.png new file mode 100644 index 0000000..d73e7dd Binary files /dev/null and b/html/theme/default/img/pan_on.png differ diff --git a/html/theme/default/img/panning-hand-off.png b/html/theme/default/img/panning-hand-off.png new file mode 100644 index 0000000..4c912ac Binary files /dev/null and b/html/theme/default/img/panning-hand-off.png differ diff --git a/html/theme/default/img/panning-hand-on.png b/html/theme/default/img/panning-hand-on.png new file mode 100644 index 0000000..6094c64 Binary files /dev/null and b/html/theme/default/img/panning-hand-on.png differ diff --git a/html/theme/default/img/remove_point_off.png b/html/theme/default/img/remove_point_off.png new file mode 100644 index 0000000..76c8606 Binary files /dev/null and b/html/theme/default/img/remove_point_off.png differ diff --git a/html/theme/default/img/remove_point_on.png b/html/theme/default/img/remove_point_on.png new file mode 100644 index 0000000..0ff28fc Binary files /dev/null and b/html/theme/default/img/remove_point_on.png differ diff --git a/html/theme/default/img/ruler.png b/html/theme/default/img/ruler.png new file mode 100644 index 0000000..aa4883b Binary files /dev/null and b/html/theme/default/img/ruler.png differ diff --git a/html/theme/default/img/save_features_off.png b/html/theme/default/img/save_features_off.png new file mode 100644 index 0000000..2bf2906 Binary files /dev/null and b/html/theme/default/img/save_features_off.png differ diff --git a/html/theme/default/img/save_features_on.png b/html/theme/default/img/save_features_on.png new file mode 100644 index 0000000..93c8f08 Binary files /dev/null and b/html/theme/default/img/save_features_on.png differ diff --git a/html/theme/default/img/view_next_off.png b/html/theme/default/img/view_next_off.png new file mode 100644 index 0000000..23c5ac1 Binary files /dev/null and b/html/theme/default/img/view_next_off.png differ diff --git a/html/theme/default/img/view_next_on.png b/html/theme/default/img/view_next_on.png new file mode 100644 index 0000000..e41fb7b Binary files /dev/null and b/html/theme/default/img/view_next_on.png differ diff --git a/html/theme/default/img/view_previous_off.png b/html/theme/default/img/view_previous_off.png new file mode 100644 index 0000000..b9c230f Binary files /dev/null and b/html/theme/default/img/view_previous_off.png differ diff --git a/html/theme/default/img/view_previous_on.png b/html/theme/default/img/view_previous_on.png new file mode 100644 index 0000000..c009c25 Binary files /dev/null and b/html/theme/default/img/view_previous_on.png differ diff --git a/html/theme/default/img/zoom-panel-NOALPHA.png b/html/theme/default/img/zoom-panel-NOALPHA.png new file mode 100755 index 0000000..cdde6fc Binary files /dev/null and b/html/theme/default/img/zoom-panel-NOALPHA.png differ diff --git a/html/theme/default/img/zoom-panel.png b/html/theme/default/img/zoom-panel.png new file mode 100755 index 0000000..f2c7c51 Binary files /dev/null and b/html/theme/default/img/zoom-panel.png differ diff --git a/html/theme/default/style.css b/html/theme/default/style.css new file mode 100644 index 0000000..cd29d4d --- /dev/null +++ b/html/theme/default/style.css @@ -0,0 +1,343 @@ +div.olMap { + z-index: 0; + padding: 0px!important; + margin: 0px!important; + cursor: default; +} + +div.olMapViewport { + text-align: left; +} + +div.olLayerDiv { + -moz-user-select: none; +} + +.olLayerGoogleCopyright { + left: 2px; + bottom: 2px; +} +.olLayerGooglePoweredBy { + left: 2px; + bottom: 15px; +} +.olControlAttribution { + font-size: smaller; + right: 3px; + bottom: 4.5em; + position: absolute; + display: block; +} +.olControlScale { + right: 3px; + bottom: 3em; + display: block; + position: absolute; + font-size: smaller; +} +.olControlScaleLine { + left: 10px; + bottom: 15px; + font-size: xx-small; +} +.olControlScaleLineBottom { + border: solid 2px black; + border-bottom: none; + margin-top:-2px; + text-align: center; +} +.olControlScaleLineTop { + border: solid 2px black; + border-top: none; + text-align: center; +} + +.olControlPermalink { + right: 3px; + bottom: 1.5em; + display: block; + position: absolute; + font-size: smaller; +} + +div.olControlMousePosition { + bottom: 0em; + right: 3px; + display: block; + position: absolute; + font-family: Arial; + font-size: smaller; +} + +.olControlOverviewMapContainer { + position: absolute; + bottom: 0px; + right: 0px; +} + +.olControlOverviewMapElement { + padding: 10px 18px 10px 10px; + background-color: #00008B; + -moz-border-radius: 1em 0 0 0; +} + +.olControlOverviewMapMinimizeButton { + right: 0px; + bottom: 80px; +} + +.olControlOverviewMapMaximizeButton { + right: 0px; + bottom: 80px; +} + +.olControlOverviewMapExtentRectangle { + overflow: hidden; + background-image: url("img/blank.gif"); + cursor: move; + border: 2px dotted red; +} +.olControlOverviewMapRectReplacement { + overflow: hidden; + cursor: move; + background-image: url("img/overview_replacement.gif"); + background-repeat: no-repeat; + background-position: center; +} + +.olLayerGeoRSSDescription { + float:left; + width:100%; + overflow:auto; + font-size:1.0em; +} +.olLayerGeoRSSClose { + float:right; + color:gray; + font-size:1.2em; + margin-right:6px; + font-family:sans-serif; +} +.olLayerGeoRSSTitle { + float:left;font-size:1.2em; +} + +.olPopupContent { + padding:5px; + overflow: auto; +} +.olControlNavToolbar { + width:0px; + height:0px; +} +.olControlNavToolbar div { + display:block; + width: 28px; + height: 28px; + top: 300px; + left: 6px; + position: relative; +} + +.olControlNavigationHistory { + background-image: url("img/navigation_history.png"); + background-repeat: no-repeat; + width: 24px; + height: 24px; + +} +.olControlNavigationHistoryPreviousItemActive { + background-position: 0px 0px; +} +.olControlNavigationHistoryPreviousItemInactive { + background-position: 0px -24px; +} +.olControlNavigationHistoryNextItemActive { + background-position: -24px 0px; +} +.olControlNavigationHistoryNextItemInactive { + background-position: -24px -24px; +} + +.olControlNavToolbar .olControlNavigationItemActive { + background-image: url("img/panning-hand-on.png"); + background-repeat: no-repeat; +} +.olControlNavToolbar .olControlNavigationItemInactive { + background-image: url("img/panning-hand-off.png"); + background-repeat: no-repeat; +} +.olControlNavToolbar .olControlZoomBoxItemActive { + background-image: url("img/drag-rectangle-on.png"); + background-color: orange; + background-repeat: no-repeat; +} +.olControlNavToolbar .olControlZoomBoxItemInactive { + background-image: url("img/drag-rectangle-off.png"); + background-repeat: no-repeat; +} +.olControlEditingToolbar { + float:right; + right: 0px; + height: 30px; + width: 200px; +} +.olControlEditingToolbar div { + background-image: url("img/editing_tool_bar.png"); + background-repeat: no-repeat; + float:right; + width: 24px; + height: 24px; + margin: 5px; +} +.olControlEditingToolbar .olControlNavigationItemActive { + background-position: -103px -23px; +} +.olControlEditingToolbar .olControlNavigationItemInactive { + background-position: -103px -0px; +} +.olControlEditingToolbar .olControlDrawFeaturePointItemActive { + background-position: -77px -23px; +} +.olControlEditingToolbar .olControlDrawFeaturePointItemInactive { + background-position: -77px -0px; +} +.olControlEditingToolbar .olControlDrawFeaturePathItemInactive { + background-position: -51px 0px; +} +.olControlEditingToolbar .olControlDrawFeaturePathItemActive { + background-position: -51px -23px; +} +.olControlEditingToolbar .olControlDrawFeaturePolygonItemInactive { + background-position: -26px 0px; +} +.olControlEditingToolbar .olControlDrawFeaturePolygonItemActive { + background-position: -26px -23px ; +} +.olControlSaveFeaturesItemActive { + background-image: url(img/save_features_on.png); + background-repeat: no-repeat; + background-position: 0px 1px; +} +.olControlSaveFeaturesItemInactive { + background-image: url(img/save_features_off.png); + background-repeat: no-repeat; + background-position: 0px 1px; +} + +.olHandlerBoxZoomBox { + border: 2px solid red; + position: absolute; + background-color: white; + opacity: 0.50; + font-size: 1px; + filter: alpha(opacity=50); +} +.olHandlerBoxSelectFeature { + border: 2px solid blue; + position: absolute; + background-color: white; + opacity: 0.50; + font-size: 1px; + filter: alpha(opacity=50); +} + +.olControlPanPanel { + top: 10px; + left: 5px; +} + +.olControlPanPanel div { + background-image: url(img/pan-panel.png); + height: 18px; + width: 18px; + cursor: pointer; + position: absolute; +} + +.olControlPanPanel .olControlPanNorthItemInactive { + top: 0px; + left: 9px; + background-position: 0px 0px; +} +.olControlPanPanel .olControlPanSouthItemInactive { + top: 36px; + left: 9px; + background-position: 18px 0px; +} +.olControlPanPanel .olControlPanWestItemInactive { + position: absolute; + top: 18px; + left: 0px; + background-position: 0px 18px; +} +.olControlPanPanel .olControlPanEastItemInactive { + top: 18px; + left: 18px; + background-position: 18px 18px; +} + +.olControlZoomPanel { + top: 71px; + left: 14px; +} + +.olControlZoomPanel div { + background-image: url(img/zoom-panel.png); + position: absolute; + height: 18px; + width: 18px; + cursor: pointer; +} + +.olControlZoomPanel .olControlZoomInItemInactive { + top: 0px; + left: 0px; + background-position: 0px 0px; +} + +.olControlZoomPanel .olControlZoomToMaxExtentItemInactive { + top: 18px; + left: 0px; + background-position: 0px -18px; +} + +.olControlZoomPanel .olControlZoomOutItemInactive { + top: 36px; + left: 0px; + background-position: 0px 18px; +} + +.olPopupCloseBox { + background: url("img/close.gif") no-repeat; + cursor: pointer; +} + +.olFramedCloudPopupContent { + padding: 5px; + overflow: auto; +} + +.olControlNoSelect { + -moz-user-select: none; +} + +/** + * Cursor styles + */ + +.olCursorWait { + cursor: wait; +} +.olDragDown { + cursor: move; +} +.olDrawBox { + cursor: crosshair; +} +.olControlDragFeatureOver { + cursor: move; +} +.olControlDragFeatureActive.olControlDragFeatureOver.olDragDown { + cursor: -moz-grabbing; +} diff --git a/mkmap.sh b/mkmap.sh index e0b03fd..578f73d 100644 --- a/mkmap.sh +++ b/mkmap.sh @@ -2,10 +2,12 @@ DEST=$1 -GWS=`/usr/sbin/batctl gwl -n | tail -n +2 | sed 's/=>//' | awk '{ print $1 }'|while read a;do echo -n "-g $a ";done` -mkdir $DEST +GWS=`(/usr/sbin/batctl gwl -n | tail -n +2 | grep -v '^No' | sed 's/=>//' | awk '{ print $1 }') | while read a; do echo -n "-g $a "; done` -cp html/* $DEST/ +/usr/sbin/batctl vd json | python "$(dirname "$0")"/bat2nodes.py -a "$(dirname "$0")"/aliases.json $GWS - > $DEST/nodes.json.new +/usr/sbin/batctl vd json | python "$(dirname "$0")"/bat2geomap.py -a "$(dirname "$0")"/aliases.json - > $DEST/geomap.kml.new + +mv $DEST/nodes.json.new $DEST/nodes.json +mv $DEST/geomap.kml.new $DEST/geomap.kml -ssh 188.138.99.158 batctl vd json|python ./bat2nodes.py -a aliases.json $GWS - > $DEST/nodes.json diff --git a/node.py b/node.py index b612e89..d6a2366 100644 --- a/node.py +++ b/node.py @@ -12,7 +12,7 @@ class Node(): # 3 TT def add_mac(self, mac): - self.macs.add(mac) + self.macs.add(mac.lower()) def __repr__(self): return self.macs.__repr__() diff --git a/nodedb.py b/nodedb.py index ecaffa1..069b391 100644 --- a/nodedb.py +++ b/nodedb.py @@ -21,7 +21,7 @@ class NodeDB: def maybe_node_by_mac(self, macs): for node in self._nodes: for mac in macs: - if mac in node.macs: + if mac.lower() in node.macs: return node raise @@ -171,9 +171,10 @@ class NodeDB: for pair in zip(macs, gps): try: - node = self.maybe_node_by_mac(pair[0]) + node = self.maybe_node_by_mac((pair[0], )) except: node = Node() + node.add_mac(pair[0]) self._nodes.append(node) node.gps = pair[1]