Fixing callsign updates in RDS.

This commit is contained in:
Marat Fayzullin 2024-02-06 18:35:55 -05:00
parent a1000a4432
commit 71f35c8a4d
1 changed files with 7 additions and 2 deletions

View File

@ -131,8 +131,13 @@ class RdsParser(TextParser):
# Expect JSON data in text form
data = json.loads(msg)
# Delete constantly changing group ID
if "group" in data:
del data["group"]
data.pop("group", None)
# Treat uncertain callsigns as normal
if "callsign_uncertain" in data:
data["callsign"] = data.pop("callsign_uncertain")
# Clear callsign if PI changes
if data.get("pi") != self.rds.get("pi"):
self.rds.pop("callsign", None)
# Only update if there is new data
if data.items() <= self.rds.items():
return None