Fixed tiny issue with bookmarks, added flight/tail ID transforms.
This commit is contained in:
parent
a680791caa
commit
a9eadffb3d
|
|
@ -9,6 +9,7 @@ import threading
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
import time
|
import time
|
||||||
|
import re
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
@ -221,13 +222,21 @@ class AircraftManager(object):
|
||||||
#
|
#
|
||||||
class AircraftParser(TextParser):
|
class AircraftParser(TextParser):
|
||||||
def __init__(self, filePrefix: str = None, service: bool = False):
|
def __init__(self, filePrefix: str = None, service: bool = False):
|
||||||
|
self.reFlight = re.compile("^([0-9A-Z]{2}|[A-Z]{3})0*([0-9]+)[A-Z]*$")
|
||||||
|
self.reAircraft = re.compile("^\.*([^\.].*)$")
|
||||||
super().__init__(filePrefix=filePrefix, service=service)
|
super().__init__(filePrefix=filePrefix, service=service)
|
||||||
|
|
||||||
def parse(self, msg: bytes):
|
def parse(self, msg: bytes):
|
||||||
# Parse incoming message via mode-specific function
|
# Parse incoming message via mode-specific function
|
||||||
out = self.parseAircraft(msg)
|
out = self.parseAircraft(msg)
|
||||||
# Update aircraft database with the new data
|
|
||||||
if out is not None:
|
if out is not None:
|
||||||
|
# Remove extra zeros from the flight ID
|
||||||
|
if "flight" in out:
|
||||||
|
out["flight"] = self.reFlight.sub("\\1\\2", out["flight"])
|
||||||
|
# Remove leading dots from the aircraft ID
|
||||||
|
if "aircraft" in out:
|
||||||
|
out["aircraft"] = self.reAircraft.sub("\\1", out["aircraft"])
|
||||||
|
# Update aircraft database with the new data
|
||||||
AircraftManager.getSharedInstance().update(out)
|
AircraftManager.getSharedInstance().update(out)
|
||||||
# Done
|
# Done
|
||||||
return out
|
return out
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
||||||
def updateBookmarkSubscription(*args):
|
def updateBookmarkSubscription(*args):
|
||||||
if self.bookmarkSub is not None:
|
if self.bookmarkSub is not None:
|
||||||
self.bookmarkSub.cancel()
|
self.bookmarkSub.cancel()
|
||||||
|
self.bookmarkSub = None
|
||||||
if "center_freq" in configProps and "samp_rate" in configProps:
|
if "center_freq" in configProps and "samp_rate" in configProps:
|
||||||
cf = configProps["center_freq"]
|
cf = configProps["center_freq"]
|
||||||
srh = configProps["samp_rate"] / 2
|
srh = configProps["samp_rate"] / 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue