Added distances to bookmark descriptions.

This commit is contained in:
Marat Fayzullin 2024-06-28 20:18:07 -04:00
parent 90d3381529
commit 4cb1b38822
2 changed files with 12 additions and 3 deletions

View File

@ -84,10 +84,14 @@ class EIBI(object):
)] )]
# Describe transmitter locations # Describe transmitter locations
if "src" in b and b["src"] in EIBI_Locations: if "src" in b and b["src"] in EIBI_Locations:
pm = Config.get()
rxPos = (pm["receiver_gps"]["lat"], pm["receiver_gps"]["lon"])
description += [( description += [(
"Transmitting from " + "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 # Done
return " ".join(description) return " ".join(description)

View File

@ -75,7 +75,12 @@ class Repeaters(object):
description = [] description = []
# Add information from the entry to the description # Add information from the entry to the description
if "status" in entry: 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: if "updated" in entry:
description += ["Last updated " + entry["updated"] + "."] description += ["Last updated " + entry["updated"] + "."]
if "comment" in entry: if "comment" in entry: