aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorDonald Williams <129223418+dwilliam62@users.noreply.github.com>2025-12-05 14:30:10 -0500
committerGitHub <noreply@github.com>2025-12-05 14:30:10 -0500
commit952d7deec41dde866e5c0053d3670257e796687a (patch)
tree276a4258118327cd9b46e107e9dfcb43995f63b9 /config
parentbf0ef84f2645be3b4151096e93da235d8d042946 (diff)
parentd3f0b79867deb344c03d50599e589b0a6e9a46f4 (diff)
Merge pull request #874 from albersonmiranda/weather-fix
fix: Check for empty strings in place parts and prevent coordinates from printing when a place is found.
Diffstat (limited to 'config')
-rwxr-xr-xconfig/hypr/UserScripts/Weather.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/config/hypr/UserScripts/Weather.py b/config/hypr/UserScripts/Weather.py
index a6483777..14256cfd 100755
--- a/config/hypr/UserScripts/Weather.py
+++ b/config/hypr/UserScripts/Weather.py
@@ -455,15 +455,15 @@ def fetch_aqi(lat: float, lon: float) -> Optional[Dict[str, Any]]:
def extract_place_parts_nominatim(data_dict: JSONDict) -> List[str]:
address = ensure_dict(data_dict.get("address"))
candidates = [data_dict.get("name"), address.get("city"), address.get("town"), address.get("village"), address.get("hamlet")]
- name = cast(Optional[str], next((c for c in candidates if c is not None), None))
+ name = cast(Optional[str], next((c for c in candidates if c is not None and c != ""), None))
admin1 = cast(Optional[str], address.get("state"))
country = cast(Optional[str], address.get("country"))
parts: List[str] = []
- if name is not None:
+ if name is not None and name != "":
parts.append(name)
- if admin1 is not None:
+ if admin1 is not None and admin1 != "":
parts.append(admin1)
- if country is not None:
+ if country is not None and country != "":
parts.append(country)
return parts
@@ -691,7 +691,7 @@ def build_aqi_info(aqi: Optional[Dict[str, Any]]) -> str:
def build_place_str(lat: float, lon: float, place: Optional[str]) -> str:
effective_place = MANUAL_PLACE or ENV_PLACE or place
if effective_place:
- return f"{effective_place} ({lat:.3f}, {lon:.3f})"
+ return effective_place
return f"{lat:.3f}, {lon:.3f}"
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage