From b5eee9450c88800651224dd875806beaadb1d2e9 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 10 Sep 2023 00:09:49 +0200 Subject: [PATCH] don't differentiate between "human-readable" and "flight" --- htdocs/map.js | 14 +++++++++----- owrx/aeronautical.py | 10 +++++----- owrx/hfdl/dumphfdl.py | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/map.js b/htdocs/map.js index 3e213f36..33fe8d74 100644 --- a/htdocs/map.js +++ b/htdocs/map.js @@ -404,17 +404,21 @@ $(function(){ }; var linkifyAircraft = function(source, identification) { - var aircraftString = identification || source.humanReadable || source.flight || source.icao; + var aircraftString = identification || source.flight || source.icao; var link = false; switch (aircraft_tracking_service) { case 'flightaware': - if (!source.icao) break; - link = 'https://flightaware.com/live/modes/' + source.icao; - if (identification) link += "/ident/" + identification - link += '/redirect'; + if (source.icao) { + link = 'https://flightaware.com/live/modes/' + source.icao; + if (identification) link += "/ident/" + identification + link += '/redirect'; + } else if (source.flight) { + link = 'https://flightaware.com/live/flight/' + source.flight; + } break; case 'planefinder': if (identification) link = 'https://planefinder.net/flight/' + identification; + if (source.flight) link = 'https://planefinder.net/flight/' + source.flight; break; } if (link) { diff --git a/owrx/aeronautical.py b/owrx/aeronautical.py index 61056c13..22bb6f93 100644 --- a/owrx/aeronautical.py +++ b/owrx/aeronautical.py @@ -19,17 +19,17 @@ class AirplaneLocation(LatLngLocation): class IcaoSource(Source): - def __init__(self, icao: str, humanReadable: str = None): + def __init__(self, icao: str, flight: str = None): self.icao = icao.upper() - self.humanReadable = humanReadable + self.flight = flight def getKey(self) -> str: return "icao:{}".format(self.icao) def __dict__(self): d = {"icao": self.icao} - if self.humanReadable is not None: - d["humanReadable"] = self.humanReadable + if self.flight is not None: + d["flight"] = self.flight return d @@ -67,7 +67,7 @@ class AcarsProcessor(JsonParser, metaclass=ABCMeta): "altitude": basic_report["alt"] } if icao is not None: - source = IcaoSource(icao, humanReadable=flight_id) + source = IcaoSource(icao, flight=flight_id) else: source = AcarsSource(flight_id) Map.getSharedInstance().updateLocation( diff --git a/owrx/hfdl/dumphfdl.py b/owrx/hfdl/dumphfdl.py index 52028d6d..fb38df2d 100644 --- a/owrx/hfdl/dumphfdl.py +++ b/owrx/hfdl/dumphfdl.py @@ -83,7 +83,7 @@ class HFDLMessageParser(AcarsProcessor): if icao is None: source = HfdlSource(hfnpdu["flight_id"]) else: - source = IcaoSource(icao, humanReadable=hfnpdu["flight_id"]) + source = IcaoSource(icao, flight=hfnpdu["flight_id"]) if "utc_time" in hfnpdu: ts = self.processTimestamp(**hfnpdu["utc_time"]) elif "time" in hfnpdu: