diff --git a/data/spot.py b/data/spot.py index 6da7007..3cb61a4 100644 --- a/data/spot.py +++ b/data/spot.py @@ -290,23 +290,23 @@ class Spot: if self.sig_refs and len(self.sig_refs) > 0 and not self.sig: self.sig = self.sig_refs[0].sig - # Parse "de_griddx_grid" structures from the comment, e.g. "JN61ESJM56XT" or "JO02GQ<>KN17LG". + # Parse "de_griddx_grid" structures from the comment, e.g. "JN61ES(ES)JM56XT" or "JO02GQ<>KN17LG". # These are common on cluster spots and can provide grid references in preference to e.g. QRZ lookup, as well as - # being the only source we have for propagation mode. + # being the only source we have for propagation mode. Brace for nightmare regex from hell. if self.comment: grid_mode_grid_match = re.search( - r'\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)<([^>]*)>([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b', + r'\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)(?:<([^>]*)>|\(([^)]*)\))([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b', self.comment) if grid_mode_grid_match: # regex matches, so extract grids: if not self.de_grid: self.de_grid = grid_mode_grid_match.group(1).upper() if not self.dx_grid: - self.dx_grid = grid_mode_grid_match.group(3).upper() + self.dx_grid = grid_mode_grid_match.group(4).upper() self.dx_location_source = "SPOT" - # And extract propagation mode: - mode_tag = grid_mode_grid_match.group(2).upper() + # And extract propagation mode (group 2 for <...>, group 3 for (...)): + mode_tag = (grid_mode_grid_match.group(2) or grid_mode_grid_match.group(3) or "").upper() if mode_tag and not self.propagation_mode: if mode_tag in PROPAGATION_MODES: self.propagation_mode = PROPAGATION_MODES[mode_tag] diff --git a/templates/add_spot.html b/templates/add_spot.html index 380afec..64c40c0 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -76,7 +76,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index fef1ee6..1296cbc 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -75,7 +75,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index 50fce7a..f11fdbb 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -77,8 +77,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index 36341da..b58377f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -10,10 +10,10 @@ - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index dbcdf49..05a15d2 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index ca953b5..72df066 100644 --- a/templates/map.html +++ b/templates/map.html @@ -95,8 +95,8 @@ - - + + diff --git a/templates/spots.html b/templates/spots.html index df3a546..f0b1b98 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -116,8 +116,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index 9472818..78a4136 100644 --- a/templates/status.html +++ b/templates/status.html @@ -59,7 +59,7 @@ - +