mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Extract SIG and SIG_INFO from cluster spots. Closes #47
This commit is contained in:
@@ -7,6 +7,8 @@ from time import sleep
|
||||
import pytz
|
||||
import telnetlib3
|
||||
|
||||
from core.constants import SIGS
|
||||
from core.utils import ANY_SIG_REGEX, ANY_SIG_REF_REGEX, get_icon_for_sig
|
||||
from data.spot import Spot
|
||||
from core.config import SERVER_OWNER_CALLSIGN
|
||||
from spotproviders.spot_provider import SpotProvider
|
||||
@@ -75,7 +77,15 @@ class DXCluster(SpotProvider):
|
||||
icon="desktop",
|
||||
time=spot_datetime.timestamp())
|
||||
|
||||
# See if the comment looks like it contains a SIG (and optionally SIG reference)
|
||||
# See if the comment looks like it contains a SIG (and optionally SIG reference). Currently,
|
||||
# only one sig ref is supported.
|
||||
sig_match = re.search(r"(^|\W)" + ANY_SIG_REGEX + r"($|\W)", spot.comment, re.IGNORECASE)
|
||||
if sig_match:
|
||||
spot.sig = sig_match.group(2).upper()
|
||||
spot.icon = get_icon_for_sig(spot.sig)
|
||||
sig_ref_match = re.search(r"(^|\W)" + spot.sig + r"($|\W)(" + ANY_SIG_REF_REGEX + r")($|\W)", spot.comment, re.IGNORECASE)
|
||||
if sig_ref_match:
|
||||
spot.sig_refs = [sig_ref_match.group(3).upper()]
|
||||
|
||||
# Add to our list
|
||||
self.submit(spot)
|
||||
|
||||
@@ -5,6 +5,7 @@ import pytz
|
||||
from requests_cache import CachedSession
|
||||
|
||||
from core.constants import HTTP_HEADERS
|
||||
from core.utils import get_icon_for_sig
|
||||
from data.spot import Spot
|
||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
|
||||
@@ -71,6 +72,7 @@ class GMA(HTTPSpotProvider):
|
||||
logging.warn("GMA spot found with ref type " + ref_info[
|
||||
"reftype"] + ", developer needs to add support for this!")
|
||||
spot.sig = ref_info["reftype"]
|
||||
spot.icon = get_icon_for_sig(spot.sig)
|
||||
|
||||
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
||||
# that for us.
|
||||
|
||||
@@ -5,6 +5,7 @@ import pytz
|
||||
import requests
|
||||
|
||||
from core.constants import HTTP_HEADERS
|
||||
from core.utils import get_icon_for_sig
|
||||
from data.spot import Spot
|
||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
|
||||
@@ -54,6 +55,7 @@ class HEMA(HTTPSpotProvider):
|
||||
sig="HEMA",
|
||||
sig_refs=[spot_items[3].upper()],
|
||||
sig_refs_names=[spot_items[4]],
|
||||
icon=get_icon_for_sig("HEMA"),
|
||||
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]))
|
||||
|
||||
@@ -7,6 +7,7 @@ import pytz
|
||||
from requests_cache import CachedSession
|
||||
|
||||
from core.constants import HTTP_HEADERS
|
||||
from core.utils import get_icon_for_sig
|
||||
from data.spot import Spot
|
||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
|
||||
@@ -41,6 +42,7 @@ class ParksNPeaks(HTTPSpotProvider):
|
||||
comment=source_spot["actComments"],
|
||||
sig=source_spot["actClass"],
|
||||
sig_refs=[source_spot["actSiteID"]],
|
||||
icon=get_icon_for_sig(source_spot["actClass"]),
|
||||
time=datetime.strptime(source_spot["actTime"], "%Y-%m-%d %H:%M:%S").replace(
|
||||
tzinfo=pytz.UTC).timestamp())
|
||||
|
||||
@@ -50,7 +52,7 @@ class ParksNPeaks(HTTPSpotProvider):
|
||||
|
||||
# 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:
|
||||
if (not spot.de_call or spot.de_call == "ZLOTA") and m:
|
||||
spot.de_call = m.group(1)
|
||||
|
||||
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before
|
||||
|
||||
@@ -2,6 +2,7 @@ from datetime import datetime
|
||||
|
||||
import pytz
|
||||
|
||||
from core.utils import get_icon_for_sig
|
||||
from data.spot import Spot
|
||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
|
||||
@@ -30,6 +31,7 @@ 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=get_icon_for_sig("POTA"),
|
||||
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"],
|
||||
|
||||
@@ -5,6 +5,7 @@ import requests
|
||||
from requests_cache import CachedSession
|
||||
|
||||
from core.constants import HTTP_HEADERS
|
||||
from core.utils import get_icon_for_sig
|
||||
from data.spot import Spot
|
||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
|
||||
@@ -51,6 +52,7 @@ 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=get_icon_for_sig("SOTA"),
|
||||
time=datetime.fromisoformat(source_spot["timeStamp"]).timestamp(),
|
||||
activation_score=source_spot["points"])
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
from core.utils import get_icon_for_sig
|
||||
from data.spot import Spot
|
||||
from spotproviders.sse_spot_provider import SSESpotProvider
|
||||
|
||||
@@ -38,6 +39,7 @@ class WWBOTA(SSESpotProvider):
|
||||
sig="WWBOTA",
|
||||
sig_refs=refs,
|
||||
sig_refs_names=ref_names,
|
||||
icon=get_icon_for_sig("WWBOTA"),
|
||||
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.
|
||||
|
||||
@@ -2,6 +2,7 @@ from datetime import datetime
|
||||
|
||||
import pytz
|
||||
|
||||
from core.utils import get_icon_for_sig
|
||||
from data.spot import Spot
|
||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
|
||||
@@ -30,6 +31,7 @@ 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=get_icon_for_sig("WWFF"),
|
||||
time=datetime.fromtimestamp(source_spot["spot_time"], tz=pytz.UTC).timestamp(),
|
||||
dx_latitude=source_spot["latitude"],
|
||||
dx_longitude=source_spot["longitude"])
|
||||
|
||||
Reference in New Issue
Block a user