From 4cb1b388226320825f6d75bf65b4093b5d9eb7b2 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Fri, 28 Jun 2024 20:18:07 -0400 Subject: [PATCH] Added distances to bookmark descriptions. --- owrx/eibi.py | 8 ++++++-- owrx/repeaters.py | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/owrx/eibi.py b/owrx/eibi.py index 6a14e31c..d7a438de 100644 --- a/owrx/eibi.py +++ b/owrx/eibi.py @@ -84,10 +84,14 @@ class EIBI(object): )] # Describe transmitter locations if "src" in b and b["src"] in EIBI_Locations: + pm = Config.get() + rxPos = (pm["receiver_gps"]["lat"], pm["receiver_gps"]["lon"]) description += [( "Transmitting from " + - ", ".join([x["name"] for x in EIBI_Locations[b["src"]]]) + - "." + ", ".join([ + "{0} ({1}km)".format(x["name"], EIBI.distKm(rxPos, (x["lat"], x["lon"]))) + for x in EIBI_Locations[b["src"]] + ]) + "." )] # Done return " ".join(description) diff --git a/owrx/repeaters.py b/owrx/repeaters.py index a1d50a14..6f052296 100644 --- a/owrx/repeaters.py +++ b/owrx/repeaters.py @@ -75,7 +75,12 @@ class Repeaters(object): description = [] # Add information from the entry to the description if "status" in entry: - description += [entry["status"] + "."] + pm = Config.get() + rxPos = (pm["receiver_gps"]["lat"], pm["receiver_gps"]["lon"]) + description += ["{0}, {1}km away.".format( + entry["status"], + Repeaters.distKm(rxPos, (entry["lat"], entry["lon"])) + )] if "updated" in entry: description += ["Last updated " + entry["updated"] + "."] if "comment" in entry: