From 19a9947d3d72c77ae49e7cc35c605b6218491623 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Thu, 11 Nov 2021 11:03:03 +0100 Subject: [PATCH] add a json dumper for the server --- aman/types/Inbound.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aman/types/Inbound.py b/aman/types/Inbound.py index cd55aff..f6a2733 100644 --- a/aman/types/Inbound.py +++ b/aman/types/Inbound.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import json import pytz import sys @@ -83,6 +84,13 @@ class Inbound: self.PlannedRunway = runway break + def toJSON(self): + pta = str(self.PlannedArrivalTime) + delimiter = pta.find('.') + if -1 == delimiter: + delimiter = pta.find('+') + return json.dumps({ 'callsign' : self.Callsign, 'runway' : self.PlannedRunway.Name, 'pta' : pta[0:delimiter] }, ensure_ascii=True) + def arrivalEstimation(self, runway : Runway, star : ArrivalRoute, weather : WeatherModel): # calculate remaining trackmiles trackmiles = self.Report.distanceToIAF