don't differentiate between "human-readable" and "flight"

This commit is contained in:
Jakob Ketterl 2023-09-10 00:09:49 +02:00
parent 3a1eb72e8d
commit b5eee9450c
3 changed files with 15 additions and 11 deletions

View file

@ -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) {

View file

@ -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(

View file

@ -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: