Icon lookup for SIGs in preparation for #47. Improved ZLOTA spotter lookup.

This commit is contained in:
Ian Renton
2025-10-20 10:33:18 +01:00
parent ae72649df8
commit a21782cb62
18 changed files with 89 additions and 60 deletions

View File

@@ -75,6 +75,8 @@ class DXCluster(SpotProvider):
icon="desktop",
time=spot_datetime.timestamp())
# See if the comment looks like it contains a SIG (and optionally SIG reference)
# Add to our list
self.submit(spot)

View File

@@ -57,27 +57,20 @@ class GMA(HTTPSpotProvider):
match ref_info["reftype"]:
case "Summit":
spot.sig = "GMA"
spot.icon = "mountain"
case "IOTA Island":
spot.sig = "IOTA"
spot.icon = "umbrella-beach"
case "Lighthouse (ILLW)":
spot.sig = "ILLW"
spot.icon = "tower-observation"
case "Lighthouse (ARLHS)":
spot.sig = "ARLHS"
spot.icon = "tower-observation"
case "Castle":
spot.sig = "WCA/COTA"
spot.icon = "chess-rook"
spot.sig = "WCA"
case "Mill":
spot.sig = "MOTA"
spot.icon = "fan"
case _:
logging.warn("GMA spot found with ref type " + ref_info[
"reftype"] + ", developer needs to figure out an icon for this!")
"reftype"] + ", developer needs to add support for this!")
spot.sig = ref_info["reftype"]
spot.icon = "person-hiking"
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
# that for us.

View File

@@ -54,7 +54,6 @@ class HEMA(HTTPSpotProvider):
sig="HEMA",
sig_refs=[spot_items[3].upper()],
sig_refs_names=[spot_items[4]],
icon="mound",
time=datetime.strptime(spot_items[0], "%d/%m/%Y %H:%M").replace(tzinfo=pytz.UTC).timestamp(),
dx_latitude=float(spot_items[7]),
dx_longitude=float(spot_items[8]))

View File

@@ -1,5 +1,6 @@
import csv
import logging
import re
from datetime import datetime, timedelta
import pytz
@@ -32,7 +33,7 @@ class ParksNPeaks(HTTPSpotProvider):
spot = Spot(source=self.name,
source_id=source_spot["actID"],
dx_call=source_spot["actCallsign"].upper(),
de_call=source_spot["actSpoter"].upper(), # typo exists in API
de_call=source_spot["actSpoter"].upper() if source_spot["actSpoter"] != "" else None, # typo exists in API
freq=float(source_spot["actFreq"].replace(",", "")) * 1000000 if (
source_spot["actFreq"] != "") else None,
# Seen PNP spots with empty frequency, and with comma-separated thousands digits
@@ -47,21 +48,14 @@ class ParksNPeaks(HTTPSpotProvider):
if "actLocation" in source_spot and source_spot["actLocation"] != "":
spot.sig_refs_names = [source_spot["actLocation"]]
# PNP supports a bunch of programs which should have different icons
if spot.sig == "SiOTA":
spot.icon = "wheat-awn"
elif spot.sig == "ZLOTA":
spot.icon = "kiwi-bird"
elif spot.sig == "KRMNPA":
spot.icon = "earth-oceania"
elif spot.sig in ["POTA", "SOTA", "WWFF"]:
# Don't care about an icon as this will be rejected anyway, we have better data from POTA/SOTA/WWFF direct
spot.icon = ""
else:
# Unknown programme we've never seen before
logging.warn(
"PNP spot found with sig " + spot.sig + ", developer needs to add support for icon and grid/lat/lon lookup!")
spot.icon = "question"
# Extract a de_call if it's in the comment but not in the "actSpoter" field
m = re.search(r"\(de ([A-Za-z0-9]*)\)", spot.comment)
if (not spot.de_call or spot.de_call == "ZLOTA") and m is not None:
spot.de_call = m.group(1)
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before
if spot.sig not in ["POTA", "SOTA", "WWFF", "SiOTA", "ZLOTA", "KRMNPA"]:
logging.warn("PNP spot found with sig " + spot.sig + ", developer needs to add support for this!")
# SiOTA lat/lon/grid lookup
if spot.sig == "SiOTA":
@@ -82,8 +76,6 @@ class ParksNPeaks(HTTPSpotProvider):
spot.sig_refs_names = [asset["name"]]
spot.dx_latitude = asset["y"]
spot.dx_longitude = asset["x"]
# Junk the "DE call", PNP always returns "ZLOTA" as the spotter for ZLOTA spots
spot.de_call = None
break
# Note there is currently no support for KRMNPA location lookup, see issue #61.

View File

@@ -30,7 +30,6 @@ class POTA(HTTPSpotProvider):
sig_refs=[source_spot["reference"]],
sig_refs_names=[source_spot["name"]],
sig_refs_urls=["https://pota.app/#/park/" + source_spot["reference"]],
icon="tree",
time=datetime.strptime(source_spot["spotTime"], "%Y-%m-%dT%H:%M:%S").replace(tzinfo=pytz.UTC).timestamp(),
dx_grid=source_spot["grid6"],
dx_latitude=source_spot["latitude"],

View File

@@ -51,7 +51,6 @@ class SOTA(HTTPSpotProvider):
sig_refs=[source_spot["summitCode"]],
sig_refs_names=[source_spot["summitName"]],
sig_refs_urls=["https://www.sotadata.org.uk/en/summit/" + source_spot["summitCode"]],
icon="mountain-sun",
time=datetime.fromisoformat(source_spot["timeStamp"]).timestamp(),
activation_score=source_spot["points"])

View File

@@ -38,7 +38,6 @@ class WWBOTA(SSESpotProvider):
sig="WWBOTA",
sig_refs=refs,
sig_refs_names=ref_names,
icon="radiation",
time=datetime.fromisoformat(source_spot["time"]).timestamp(),
# WWBOTA spots can contain multiple references for bunkers being activated simultaneously. For
# now, we will just pick the first one to use as our grid, latitude and longitude.

View File

@@ -30,7 +30,6 @@ class WWFF(HTTPSpotProvider):
sig_refs=[source_spot["reference"]],
sig_refs_names=[source_spot["reference_name"]],
sig_refs_urls=["https://wwff.co/directory/?showRef=" + source_spot["reference"]],
icon="seedling",
time=datetime.fromtimestamp(source_spot["spot_time"], tz=pytz.UTC).timestamp(),
dx_latitude=source_spot["latitude"],
dx_longitude=source_spot["longitude"])