mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-03-15 20:34:31 +00:00
Compare commits
2 Commits
4d344021c7
...
65957b4c01
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65957b4c01 | ||
|
|
522f90af97 |
@@ -416,7 +416,12 @@ class LookupHelper:
|
|||||||
# Infer a grid locator from a callsign (using DXCC, probably very inaccurate)
|
# Infer a grid locator from a callsign (using DXCC, probably very inaccurate)
|
||||||
def infer_grid_from_callsign_dxcc(self, call):
|
def infer_grid_from_callsign_dxcc(self, call):
|
||||||
latlon = self.infer_latlon_from_callsign_dxcc(call)
|
latlon = self.infer_latlon_from_callsign_dxcc(call)
|
||||||
return latlong_to_locator(latlon[0], latlon[1], 8)
|
grid = None
|
||||||
|
try:
|
||||||
|
grid = latlong_to_locator(latlon[0], latlon[1], 8)
|
||||||
|
except:
|
||||||
|
logging.debug("Invalid lat/lon received for DXCC")
|
||||||
|
return grid
|
||||||
|
|
||||||
# Infer a mode from the frequency (in Hz) according to the band plan. Just a guess really.
|
# Infer a mode from the frequency (in Hz) according to the band plan. Just a guess really.
|
||||||
def infer_mode_from_frequency(self, freq):
|
def infer_mode_from_frequency(self, freq):
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ def populate_sig_ref_info(sig_ref):
|
|||||||
if row["reference"] == ref_id:
|
if row["reference"] == ref_id:
|
||||||
sig_ref.name = row["name"] if "name" in row else None
|
sig_ref.name = row["name"] if "name" in row else None
|
||||||
sig_ref.url = "https://wwff.co/directory/?showRef=" + ref_id
|
sig_ref.url = "https://wwff.co/directory/?showRef=" + ref_id
|
||||||
sig_ref.grid = row["iaruLocator"] if "iaruLocator" in row else None
|
sig_ref.grid = row["iaruLocator"] if "iaruLocator" in row and row["iaruLocator"] != "-" else None
|
||||||
sig_ref.latitude = float(row["latitude"]) if "latitude" in row else None
|
sig_ref.latitude = float(row["latitude"]) if "latitude" in row and row["latitude"] != "-" else None
|
||||||
sig_ref.longitude = float(row["longitude"]) if "longitude" in row else None
|
sig_ref.longitude = float(row["longitude"]) if "longitude" in row and row["longitude"] != "-" else None
|
||||||
break
|
break
|
||||||
elif sig.upper() == "SIOTA":
|
elif sig.upper() == "SIOTA":
|
||||||
siota_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.silosontheair.com/data/silos.csv",
|
siota_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.silosontheair.com/data/silos.csv",
|
||||||
@@ -112,9 +112,12 @@ def populate_sig_ref_info(sig_ref):
|
|||||||
if asset["code"] == ref_id:
|
if asset["code"] == ref_id:
|
||||||
sig_ref.name = asset["name"]
|
sig_ref.name = asset["name"]
|
||||||
sig_ref.url = "https://ontheair.nz/assets/ZLI_OT-030" + ref_id.replace("/", "_")
|
sig_ref.url = "https://ontheair.nz/assets/ZLI_OT-030" + ref_id.replace("/", "_")
|
||||||
sig_ref.grid = latlong_to_locator(asset["y"], asset["x"], 6)
|
try:
|
||||||
sig_ref.latitude = asset["y"]
|
sig_ref.grid = latlong_to_locator(asset["y"], asset["x"], 6)
|
||||||
sig_ref.longitude = asset["x"]
|
except:
|
||||||
|
logging.debug("Invalid lat/lon received for reference")
|
||||||
|
sig_ref.latitude = asset["y"]
|
||||||
|
sig_ref.longitude = asset["x"]
|
||||||
break
|
break
|
||||||
elif sig.upper() == "BOTA":
|
elif sig.upper() == "BOTA":
|
||||||
if not sig_ref.name:
|
if not sig_ref.name:
|
||||||
@@ -124,9 +127,12 @@ def populate_sig_ref_info(sig_ref):
|
|||||||
ll = wab_wai_square_to_lat_lon(ref_id)
|
ll = wab_wai_square_to_lat_lon(ref_id)
|
||||||
if ll:
|
if ll:
|
||||||
sig_ref.name = ref_id
|
sig_ref.name = ref_id
|
||||||
sig_ref.grid = latlong_to_locator(ll[0], ll[1], 6)
|
try:
|
||||||
sig_ref.latitude = ll[0]
|
sig_ref.grid = latlong_to_locator(ll[0], ll[1], 6)
|
||||||
sig_ref.longitude = ll[1]
|
sig_ref.latitude = ll[0]
|
||||||
|
sig_ref.longitude = ll[1]
|
||||||
|
except:
|
||||||
|
logging.debug("Invalid lat/lon received for reference")
|
||||||
except:
|
except:
|
||||||
logging.warn("Failed to look up sig_ref info for " + sig + " ref " + ref_id + ".")
|
logging.warn("Failed to look up sig_ref info for " + sig + " ref " + ref_id + ".")
|
||||||
return sig_ref
|
return sig_ref
|
||||||
|
|||||||
@@ -47,13 +47,13 @@ class StatusReporter:
|
|||||||
self.status_data["spot_providers"] = list(
|
self.status_data["spot_providers"] = list(
|
||||||
map(lambda p: {"name": p.name, "enabled": p.enabled, "status": p.status,
|
map(lambda p: {"name": p.name, "enabled": p.enabled, "status": p.status,
|
||||||
"last_updated": p.last_update_time.replace(
|
"last_updated": p.last_update_time.replace(
|
||||||
tzinfo=pytz.UTC).timestamp() if p.last_update_time else 0,
|
tzinfo=pytz.UTC).timestamp() if p.last_update_time.year > 2000 else 0,
|
||||||
"last_spot": p.last_spot_time.replace(
|
"last_spot": p.last_spot_time.replace(
|
||||||
tzinfo=pytz.UTC).timestamp() if p.last_spot_time else 0}, self.spot_providers))
|
tzinfo=pytz.UTC).timestamp() if p.last_spot_time.year > 2000 else 0}, self.spot_providers))
|
||||||
self.status_data["alert_providers"] = list(
|
self.status_data["alert_providers"] = list(
|
||||||
map(lambda p: {"name": p.name, "enabled": p.enabled, "status": p.status,
|
map(lambda p: {"name": p.name, "enabled": p.enabled, "status": p.status,
|
||||||
"last_updated": p.last_update_time.replace(
|
"last_updated": p.last_update_time.replace(
|
||||||
tzinfo=pytz.UTC).timestamp() if p.last_update_time else 0},
|
tzinfo=pytz.UTC).timestamp() if p.last_update_time.year > 2000 else 0},
|
||||||
self.alert_providers))
|
self.alert_providers))
|
||||||
self.status_data["cleanup"] = {"status": self.cleanup_timer.status,
|
self.status_data["cleanup"] = {"status": self.cleanup_timer.status,
|
||||||
"last_ran": self.cleanup_timer.last_cleanup_time.replace(
|
"last_ran": self.cleanup_timer.last_cleanup_time.replace(
|
||||||
|
|||||||
10
data/spot.py
10
data/spot.py
@@ -284,9 +284,13 @@ class Spot:
|
|||||||
|
|
||||||
# DX Grid to lat/lon and vice versa in case one is missing
|
# DX Grid to lat/lon and vice versa in case one is missing
|
||||||
if self.dx_grid and not self.dx_latitude:
|
if self.dx_grid and not self.dx_latitude:
|
||||||
ll = locator_to_latlong(self.dx_grid)
|
try:
|
||||||
self.dx_latitude = ll[0]
|
print(json.dumps(self))
|
||||||
self.dx_longitude = ll[1]
|
ll = locator_to_latlong(self.dx_grid)
|
||||||
|
self.dx_latitude = ll[0]
|
||||||
|
self.dx_longitude = ll[1]
|
||||||
|
except:
|
||||||
|
logging.debug("Invalid grid received for spot")
|
||||||
if self.dx_latitude and self.dx_longitude and not self.dx_grid:
|
if self.dx_latitude and self.dx_longitude and not self.dx_grid:
|
||||||
try:
|
try:
|
||||||
self.dx_grid = latlong_to_locator(self.dx_latitude, self.dx_longitude, 8)
|
self.dx_grid = latlong_to_locator(self.dx_latitude, self.dx_longitude, 8)
|
||||||
|
|||||||
@@ -1234,11 +1234,11 @@ components:
|
|||||||
example: OK
|
example: OK
|
||||||
last_updated:
|
last_updated:
|
||||||
type: number
|
type: number
|
||||||
description: The last time at which this provider received data, UTC seconds since UNIX epoch.
|
description: The last time at which this provider received data, UTC seconds since UNIX epoch. If this is zero, the spot provider has never updated.
|
||||||
example: 1759579508
|
example: 1759579508
|
||||||
last_spot:
|
last_spot:
|
||||||
type: number
|
type: number
|
||||||
description: The time of the latest spot received by this provider, UTC seconds since UNIX epoch.
|
description: The time of the latest spot received by this provider, UTC seconds since UNIX epoch. If this is zero, the spot provider has never received a spot that was accepted by the system.
|
||||||
example: 1759579508
|
example: 1759579508
|
||||||
|
|
||||||
AlertProviderStatus:
|
AlertProviderStatus:
|
||||||
@@ -1257,7 +1257,7 @@ components:
|
|||||||
example: OK
|
example: OK
|
||||||
last_updated:
|
last_updated:
|
||||||
type: number
|
type: number
|
||||||
description: The last time at which this provider received data, UTC seconds since UNIX epoch.
|
description: The last time at which this provider received data, UTC seconds since UNIX epoch. If this is zero, the alert provider has never updated.
|
||||||
example: 1759579508
|
example: 1759579508
|
||||||
|
|
||||||
Band:
|
Band:
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ function loadStatus() {
|
|||||||
jsonData["spot_providers"].forEach(p => {
|
jsonData["spot_providers"].forEach(p => {
|
||||||
$("#status-container").append(generateStatusCard("Spot Provider: " + p["name"], [
|
$("#status-container").append(generateStatusCard("Spot Provider: " + p["name"], [
|
||||||
`Status: ${p["status"]}`,
|
`Status: ${p["status"]}`,
|
||||||
`Last Updated: ${p["enabled"] ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}`,
|
`Last Updated: ${(p["enabled"] && p["last_updated"] > 0) ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}`,
|
||||||
`Latest Spot: ${p["enabled"] ? moment.unix(p["last_spot"]).utc().fromNow() : "N/A"}`
|
`Latest Spot: ${(p["enabled"] && p["last_spot"] > 0) ? moment.unix(p["last_spot"]).utc().fromNow() : "N/A"}`
|
||||||
]));
|
]));
|
||||||
});
|
});
|
||||||
jsonData["alert_providers"].forEach(p => {
|
jsonData["alert_providers"].forEach(p => {
|
||||||
$("#status-container").append(generateStatusCard("Alert Provider: " + p["name"], [
|
$("#status-container").append(generateStatusCard("Alert Provider: " + p["name"], [
|
||||||
`Status: ${p["status"]}`,
|
`Status: ${p["status"]}`,
|
||||||
`Last Updated: ${p["enabled"] ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}`
|
`Last Updated: ${(p["enabled"] && p["last_updated"] > 0) ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}`
|
||||||
]));
|
]));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user