mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-02-04 06:44:16 +01:00
remove a few superfluous intermediate classes
This commit is contained in:
parent
77fd879c86
commit
34da0a9148
|
|
@ -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)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue