From 82bec43f22b901032e4fdccb7a44647f839ebf69 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sat, 13 Sep 2025 18:21:09 -0700 Subject: [PATCH] Update locationdata.py move this and add miles --- modules/locationdata.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/locationdata.py b/modules/locationdata.py index 0573d91..af87243 100644 --- a/modules/locationdata.py +++ b/modules/locationdata.py @@ -804,16 +804,19 @@ def checkUSGSEarthQuake(lat=0, lon=0): for event in quake_xml.getElementsByTagName("event"): mag = event.getElementsByTagName("magnitude")[0] mag_value = float(mag.getElementsByTagName("value")[0].childNodes[0].nodeValue) - mag_value = round(mag_value, 1) if mag_value > largest_mag: largest_mag = mag_value # set description text description_text = event.getElementsByTagName("description")[0].getElementsByTagName("text")[0].childNodes[0].nodeValue - + largest_mag = round(largest_mag, 1) if quake_count == 0: return NO_ALERTS else: - return f"{quake_count} 🫨quakes in last {history} days within {radius}km of you largest was {largest_mag}. {description_text}" + if use_metric: + return f"{quake_count} 🫨quakes in last {history} days within {radius} km. Largest: {largest_mag}M\n{description_text}" + else: + radius = round(radius * 0.621371) + return f"{quake_count} 🫨quakes in last {history} days within {radius} mi. Largest: {largest_mag}M\n{description_text}" howfarDB = {} def distance(lat=0,lon=0,nodeID=0, reset=False):