mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-06 02:21:42 +00:00
Refactor of caching & data storage part 16 #118
This commit is contained in:
+6
-1
@@ -2,6 +2,7 @@ import logging
|
||||
|
||||
import simplejson
|
||||
from pyhamtools.frequency import freq_to_band
|
||||
from pyhamtools.locator import latlong_to_locator
|
||||
|
||||
from core.constants import UNKNOWN_BAND, BANDS, CW_MODES, PHONE_MODES, DATA_MODES, MODE_ALIASES, ALL_MODES
|
||||
from core.data_store import DATA_STORE
|
||||
@@ -95,6 +96,9 @@ def get_callsign_object_from_pyhamtools_callinfo(callsign, callinfo):
|
||||
itu_zone = data["ituz"] if "ituz" in data else None
|
||||
lat = float(data["latitude"]) if "latitude" in data else None
|
||||
lon = float(data["longitude"]) if "longitude" in data else None
|
||||
grid = None
|
||||
if lat and lon:
|
||||
grid = latlong_to_locator(lat, lon)
|
||||
|
||||
return Callsign(call=callsign,
|
||||
home_call=home_call,
|
||||
@@ -105,8 +109,9 @@ def get_callsign_object_from_pyhamtools_callinfo(callsign, callinfo):
|
||||
itu_zone=itu_zone,
|
||||
latitude=lat,
|
||||
longitude=lon,
|
||||
grid=grid,
|
||||
location_source="DXCC")
|
||||
|
||||
except ValueError:
|
||||
except (KeyError, ValueError):
|
||||
# Unknown callsign, can't look anything up, return a Callsign object with basic data so that gets cached
|
||||
return Callsign(call=callsign)
|
||||
|
||||
Reference in New Issue
Block a user