mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Icon lookup for SIGs in preparation for #47. Improved ZLOTA spotter lookup.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user