diff --git a/owrx/aeronautical.py b/owrx/aeronautical.py index 44c0f240..b62cc6e5 100644 --- a/owrx/aeronautical.py +++ b/owrx/aeronautical.py @@ -34,12 +34,12 @@ class IcaoSource(Source): return d -class AcarsSource(Source): +class FlightSource(Source): def __init__(self, flight): self.flight = flight def getKey(self) -> str: - return "acars:{}".format(self.flight) + return "flight:{}".format(self.flight) def __dict__(self): return {"flight": self.flight} @@ -72,7 +72,7 @@ class AcarsProcessor(JsonParser, metaclass=ABCMeta): if icao is not None: source = IcaoSource(icao, flight=flight_id) else: - source = AcarsSource(flight_id) + source = FlightSource(flight_id) Map.getSharedInstance().updateLocation( source, AirplaneLocation(msg), "ACARS over {}".format(self.mode) ) diff --git a/owrx/hfdl/dumphfdl.py b/owrx/hfdl/dumphfdl.py index bd7ea8e6..db20ed20 100644 --- a/owrx/hfdl/dumphfdl.py +++ b/owrx/hfdl/dumphfdl.py @@ -1,7 +1,7 @@ from pycsdr.modules import ExecModule from pycsdr.types import Format -from owrx.aeronautical import AirplaneLocation, AcarsProcessor, IcaoSource -from owrx.map import Map, Source +from owrx.aeronautical import AirplaneLocation, AcarsProcessor, IcaoSource, FlightSource +from owrx.map import Map from owrx.metrics import Metrics, CounterMetric from datetime import datetime, timezone, timedelta @@ -10,21 +10,6 @@ import logging logger = logging.getLogger(__name__) -class HfdlAirplaneLocation(AirplaneLocation): - pass - - -class HfdlSource(Source): - def __init__(self, flight): - self.flight = flight - - def getKey(self) -> str: - return "hfdl:{}".format(self.flight) - - def __dict__(self): - return {"flight": self.flight} - - class DumpHFDLModule(ExecModule): def __init__(self): super().__init__( @@ -88,7 +73,7 @@ class HFDLMessageParser(AcarsProcessor): if icao is not None: source = IcaoSource(icao, flight=flight) elif flight: - source = HfdlSource(flight) + source = FlightSource(flight) else: source = None @@ -104,7 +89,7 @@ class HFDLMessageParser(AcarsProcessor): ts = self.processTimestamp(**hfnpdu["time"]) else: ts = None - Map.getSharedInstance().updateLocation(source, HfdlAirplaneLocation(msg), "HFDL", timestamp=ts) + Map.getSharedInstance().updateLocation(source, AirplaneLocation(msg), "HFDL", timestamp=ts) def processTimestamp(self, hour, min, sec) -> datetime: now = datetime.now(timezone.utc)