diff --git a/alertproviders/http_alert_provider.py b/alertproviders/http_alert_provider.py index c3e0515..afc3225 100644 --- a/alertproviders/http_alert_provider.py +++ b/alertproviders/http_alert_provider.py @@ -30,7 +30,8 @@ class HTTPAlertProvider(AlertProvider): thread.start() def stop(self): - self.poll_timer.cancel() + if self.poll_timer: + self.poll_timer.cancel() def poll(self): try: diff --git a/core/lookup_helper.py b/core/lookup_helper.py index 552b87d..d4779d3 100644 --- a/core/lookup_helper.py +++ b/core/lookup_helper.py @@ -96,10 +96,10 @@ class LookupHelper: try: logging.info("Downloading Clublog cty.xml...") response = self.CLUBLOG_CTY_XML_CACHE.get("https://cdn.clublog.org/cty.php?api=" + self.CLUBLOG_API_KEY, - headers=HTTP_HEADERS).raw - with gzip.GzipFile(fileobj=response) as uncompressed: + headers=HTTP_HEADERS) + open(self.CLUBLOG_XML_DOWNLOAD_LOCATION + ".gz", 'wb').write(response.content) + with gzip.open(self.CLUBLOG_XML_DOWNLOAD_LOCATION + ".gz", "rb") as uncompressed: file_content = uncompressed.read() - with open(self.CLUBLOG_XML_DOWNLOAD_LOCATION, "wb") as f: f.write(file_content) f.flush() diff --git a/data/alert.py b/data/alert.py index 8a7f474..b578137 100644 --- a/data/alert.py +++ b/data/alert.py @@ -96,7 +96,7 @@ class Alert: self.dx_itu_zone = lookup_helper.infer_itu_zone_from_callsign(self.dx_calls[0]) if self.dx_calls and self.dx_calls[0] and not self.dx_dxcc_id: self.dx_dxcc_id = lookup_helper.infer_dxcc_id_from_callsign(self.dx_calls[0]) - if self.dx_dxcc_id and not self.dx_flag: + if self.dx_dxcc_id and self.dx_dxcc_id in DXCC_FLAGS and not self.dx_flag: self.dx_flag = DXCC_FLAGS[self.dx_dxcc_id] # DX operator details lookup, using QRZ.com. This should be the last resort compared to taking the data from diff --git a/data/spot.py b/data/spot.py index 07dae61..0cf8b34 100644 --- a/data/spot.py +++ b/data/spot.py @@ -124,7 +124,7 @@ class Spot: self.dx_itu_zone = lookup_helper.infer_itu_zone_from_callsign(self.dx_call) if self.dx_call and not self.dx_dxcc_id: self.dx_dxcc_id = lookup_helper.infer_dxcc_id_from_callsign(self.dx_call) - if self.dx_dxcc_id and DXCC_FLAGS[self.dx_dxcc_id] and not self.dx_flag: + if self.dx_dxcc_id and self.dx_dxcc_id in DXCC_FLAGS and not self.dx_flag: self.dx_flag = DXCC_FLAGS[self.dx_dxcc_id] # Clean up spotter call if it has an SSID or -# from RBN @@ -138,7 +138,7 @@ class Spot: self.de_continent = lookup_helper.infer_continent_from_callsign(self.de_call) if self.de_call and not self.de_dxcc_id: self.de_dxcc_id = lookup_helper.infer_dxcc_id_from_callsign(self.de_call) - if self.de_dxcc_id and not self.de_flag: + if self.de_dxcc_id and self.de_dxcc_id in DXCC_FLAGS and not self.de_flag: self.de_flag = DXCC_FLAGS[self.de_dxcc_id] # Band from frequency diff --git a/spotproviders/http_spot_provider.py b/spotproviders/http_spot_provider.py index 3b40293..1a3b704 100644 --- a/spotproviders/http_spot_provider.py +++ b/spotproviders/http_spot_provider.py @@ -30,7 +30,8 @@ class HTTPSpotProvider(SpotProvider): thread.start() def stop(self): - self.poll_timer.cancel() + if self.poll_timer: + self.poll_timer.cancel() def poll(self): try: diff --git a/views/webpage_spots.tpl b/views/webpage_spots.tpl index 2fb2dc3..c12e669 100644 --- a/views/webpage_spots.tpl +++ b/views/webpage_spots.tpl @@ -1,13 +1,5 @@ % rebase('webpage_base.tpl') - -
- +
@@ -193,7 +185,7 @@Coming soon!
+ + + + +