Implemented old spot cleanup thread

This commit is contained in:
Ian Renton
2025-09-27 12:09:16 +01:00
parent b1346e26ea
commit efa4c402df
8 changed files with 73 additions and 13 deletions

View File

@@ -36,12 +36,15 @@ class GMA(HTTPProvider):
sig_refs=[source_spot["REF"]],
sig_refs_names=[source_spot["NAME"]],
time=datetime.strptime(source_spot["DATE"] + source_spot["TIME"], "%Y%m%d%H%M").replace(tzinfo=pytz.UTC),
latitude=float(source_spot["LAT"]),
longitude=float(source_spot["LON"]))
latitude=float(source_spot["LAT"]) if (source_spot["LAT"] != "") else None, # Seen GMA spots with no lat/lon
longitude=float(source_spot["LON"]) if (source_spot["LON"] != "") else None)
# GMA doesn't give what programme (SIG) the reference is for until we separately look it up.
ref_info = self.REF_INFO_CACHE.get(self.REF_INFO_URL_ROOT + source_spot["REF"], headers=self.HTTP_HEADERS).json()
spot.sig = ref_info["reftype"]
ref_response = self.REF_INFO_CACHE.get(self.REF_INFO_URL_ROOT + source_spot["REF"], headers=self.HTTP_HEADERS)
# Sometimes this is blank, so handle that
if ref_response.text is not None and ref_response.text != "":
ref_info = ref_response.json()
spot.sig = ref_info["reftype"]
# Fill in any missing data
spot.infer_missing()