From abc5cd177e82acd44bcbb7be117f9a233b7f4b6d Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Wed, 6 Sep 2023 15:53:08 +0200 Subject: [PATCH] icao should be part of the source, not the location --- htdocs/map.js | 2 +- owrx/adsb/modes.py | 12 +++++------- owrx/hfdl/dumphfdl.py | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/map.js b/htdocs/map.js index 7d9dc128..68ef0025 100644 --- a/htdocs/map.js +++ b/htdocs/map.js @@ -481,7 +481,7 @@ $(function(){ distance = " at " + distanceKm(receiverMarker.position, marker.position) + " km"; } var title; - if (marker.icao) { + if (marker.source.icao || marker.source.flight) { title = linkifyAircraft(source, marker.identification); if ('altitude' in marker) { commentString += '
Altitude: ' + marker.altitude + ' ft
'; diff --git a/owrx/adsb/modes.py b/owrx/adsb/modes.py index 3e7b51c3..a58c4617 100644 --- a/owrx/adsb/modes.py +++ b/owrx/adsb/modes.py @@ -23,11 +23,10 @@ class AirplaneLocation(IncrementalUpdate, LatLngLocation): "heading", ] - def __init__(self, icao, message): + def __init__(self, message): self.history = [] self.timestamp = datetime.now() self.props = message - self.icao = icao if "lat" in message and "lon" in message: super().__init__(message["lat"], message["lon"]) else: @@ -55,10 +54,9 @@ class AirplaneLocation(IncrementalUpdate, LatLngLocation): self.lon = merged["lon"] def __dict__(self): - dict = super().__dict__() - dict.update(self.props) - dict["icao"] = self.icao - return dict + res = super().__dict__() + res.update(self.props) + return res class AdsbLocation(AirplaneLocation): @@ -283,7 +281,7 @@ class ModeSParser(PickleModule): if "icao" in message and AirplaneLocation.mapKeys & message.keys(): data = {k: message[k] for k in AirplaneLocation.mapKeys if k in message} - loc = AdsbLocation(message["icao"], data) + loc = AdsbLocation(data) Map.getSharedInstance().updateLocation({"icao": message['icao']}, loc, "ADS-B", None) return message diff --git a/owrx/hfdl/dumphfdl.py b/owrx/hfdl/dumphfdl.py index 16dfe703..6c48ceaf 100644 --- a/owrx/hfdl/dumphfdl.py +++ b/owrx/hfdl/dumphfdl.py @@ -6,8 +6,7 @@ from owrx.map import Map class HfdlAirplaneLocation(AirplaneLocation): - def __init__(self, message): - super().__init__(None, message) + pass class DumpHFDLModule(ExecModule):