mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-24 16:24:32 +00:00
First attempt at converting "sig" to "activity" for v3
This commit is contained in:
+35
-35
@@ -68,10 +68,10 @@ class GMA(HTTPSpotProvider):
|
||||
# Filter out some weird mode strings
|
||||
mode=Mode.from_name(source_spot["MODE"].upper()) if "<>" not in source_spot["MODE"] else None,
|
||||
comment=source_spot["TEXT"],
|
||||
sig_refs=[
|
||||
activity_refs=[
|
||||
ActivityRef(
|
||||
id=source_spot["REF"],
|
||||
sig="",
|
||||
activity="",
|
||||
name=source_spot["NAME"],
|
||||
latitude=lat,
|
||||
longitude=lon,
|
||||
@@ -98,57 +98,57 @@ class GMA(HTTPSpotProvider):
|
||||
and ref_response.text != "\n"
|
||||
):
|
||||
ref_info = ref_response.json()
|
||||
if spot.sig_refs and ref_info and "reftype" in ref_info:
|
||||
if spot.activity_refs and ref_info and "reftype" in ref_info:
|
||||
match ref_info["reftype"]:
|
||||
case "Summit":
|
||||
# Summits are a bit complicated, they can be SOTA or GMA depending on the
|
||||
# separate "sota" field:
|
||||
if "sota" in ref_info and ref_info["sota"] != "":
|
||||
spot.sig_refs[0].sig = ActivityName.SOTA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
|
||||
spot.sig = ActivityName.SOTA
|
||||
spot.activity_refs[0].activity = ActivityName.SOTA
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.SUMMIT
|
||||
spot.activity = ActivityName.SOTA
|
||||
else:
|
||||
spot.sig_refs[0].sig = ActivityName.GMA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
|
||||
spot.sig = ActivityName.GMA
|
||||
spot.activity_refs[0].activity = ActivityName.GMA
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.SUMMIT
|
||||
spot.activity = ActivityName.GMA
|
||||
case "POTA":
|
||||
spot.sig_refs[0].sig = ActivityName.POTA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.PARK
|
||||
spot.sig = ActivityName.POTA
|
||||
spot.activity_refs[0].activity = ActivityName.POTA
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.PARK
|
||||
spot.activity = ActivityName.POTA
|
||||
case "WWFF":
|
||||
spot.sig_refs[0].sig = ActivityName.WWFF
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.PARK
|
||||
spot.sig = ActivityName.WWFF
|
||||
spot.activity_refs[0].activity = ActivityName.WWFF
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.PARK
|
||||
spot.activity = ActivityName.WWFF
|
||||
case "IOTA Island":
|
||||
spot.sig_refs[0].sig = ActivityName.IOTA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
|
||||
spot.sig = ActivityName.IOTA
|
||||
spot.activity_refs[0].activity = ActivityName.IOTA
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.ISLAND
|
||||
spot.activity = ActivityName.IOTA
|
||||
case "GMA Island":
|
||||
spot.sig_refs[0].sig = ActivityName.GMA_ISLANDS
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
|
||||
spot.sig = ActivityName.GMA_ISLANDS
|
||||
spot.activity_refs[0].activity = ActivityName.GMA_ISLANDS
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.ISLAND
|
||||
spot.activity = ActivityName.GMA_ISLANDS
|
||||
case "Lighthouse (ILLW)":
|
||||
spot.sig_refs[0].sig = ActivityName.ILLW
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
|
||||
spot.sig = ActivityName.ILLW
|
||||
spot.activity_refs[0].activity = ActivityName.ILLW
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
|
||||
spot.activity = ActivityName.ILLW
|
||||
case "Lighthouse (ARLHS)":
|
||||
spot.sig_refs[0].sig = ActivityName.ARLHS
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
|
||||
spot.sig = ActivityName.ARLHS
|
||||
spot.activity_refs[0].activity = ActivityName.ARLHS
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
|
||||
spot.activity = ActivityName.ARLHS
|
||||
case "Castle":
|
||||
spot.sig_refs[0].sig = ActivityName.WCA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.CASTLE
|
||||
spot.sig = ActivityName.WCA
|
||||
spot.activity_refs[0].activity = ActivityName.WCA
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.CASTLE
|
||||
spot.activity = ActivityName.WCA
|
||||
case "Mill":
|
||||
spot.sig_refs[0].sig = ActivityName.MOTA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.MILL
|
||||
spot.sig = ActivityName.MOTA
|
||||
spot.activity_refs[0].activity = ActivityName.MOTA
|
||||
spot.activity_refs[0].ref_type = ActivityRefType.MILL
|
||||
spot.activity = ActivityName.MOTA
|
||||
case _:
|
||||
logger.warning(
|
||||
f"GMA spot found with ref type {ref_info['reftype']}, developer needs to add support for this!"
|
||||
)
|
||||
spot.sig_refs[0].sig = ref_info["reftype"]
|
||||
spot.sig = ref_info["reftype"]
|
||||
spot.activity_refs[0].activity = ref_info["reftype"]
|
||||
spot.activity = ref_info["reftype"]
|
||||
|
||||
elif not ref_response.from_cache:
|
||||
if not ref_response.ok:
|
||||
|
||||
Reference in New Issue
Block a user