diff --git a/ogn/parser/aprs_comment/spot_parser.py b/ogn/parser/aprs_comment/spot_parser.py index 04d4685..7a7a012 100644 --- a/ogn/parser/aprs_comment/spot_parser.py +++ b/ogn/parser/aprs_comment/spot_parser.py @@ -13,5 +13,5 @@ class SpotParser(BaseParser): def parse_position(aprs_comment): ac_match = re.search(PATTERN_SPOT_POSITION_COMMENT, aprs_comment) return {'address': ac_match.group('id'), - 'model': int(ac_match.group('model')) if ac_match.group('model') else None, + 'model': ac_match.group('model') if ac_match.group('model') else None, 'status': ac_match.group('status') if ac_match.group('status') else None} diff --git a/ogn/parser/pattern.py b/ogn/parser/pattern.py index 68f00f5..47a37ca 100644 --- a/ogn/parser/pattern.py +++ b/ogn/parser/pattern.py @@ -51,7 +51,7 @@ PATTERN_SPIDER_POSITION_COMMENT = re.compile(""" PATTERN_SPOT_POSITION_COMMENT = re.compile(""" id(?P[\d-]+)\s - SPOT(?P\d)\s + (?PSPOT[A-Z\d]+)\s (?P[A-Z]+) """, re.VERBOSE | re.MULTILINE) @@ -69,15 +69,15 @@ PATTERN_TRACKER_POSITION_COMMENT = re.compile(""" PATTERN_TRACKER_STATUS_COMMENT = re.compile(""" h(?P[\d]{2})\s - v(?P[\d]{2})\s - (?P[\d]+)sat/(?P\d)\s - (?P\d+)m\s - (?P[\d.]+)hPa\s - (?P[+-][\d.]+)degC\s - (?P\d+)%\s - (?P[\d.]+)V\s - (?P\d+)/(?P[+-][\d.]+)dBm\s - (?P\d+)/min + v(?P[\d]{2})\s? + (?:(?P[\d]+)sat/(?P\d)\s?)? + (?:(?P\d+)m\s?)? + (?:(?P[\d.]+)hPa\s?)? + (?:(?P[+-][\d.]+)degC\s?)? + (?:(?P\d+)%\s?)? + (?:(?P[\d.]+)V\s?)? + (?:(?P\d+)/(?P[+-][\d.]+)dBm\s?)? + (?:(?P\d+)/min)? """, re.VERBOSE | re.MULTILINE) PATTERN_RECEIVER_POSITION_COMMENT = re.compile(r""" diff --git a/tests/parser/test_parse_spot.py b/tests/parser/test_parse_spot.py index ff12382..a5d4af3 100644 --- a/tests/parser/test_parse_spot.py +++ b/tests/parser/test_parse_spot.py @@ -8,7 +8,7 @@ class TestStringMethods(unittest.TestCase): message = SpotParser.parse_position("id0-2860357 SPOT3 GOOD") self.assertEqual(message['address'], "0-2860357") - self.assertEqual(message['model'], 3) + self.assertEqual(message['model'], 'SPOT3') self.assertEqual(message['status'], "GOOD") diff --git a/tests/parser/valid_beacon_data/spot.txt b/tests/parser/valid_beacon_data/spot.txt index 473e463..6502919 100644 --- a/tests/parser/valid_beacon_data/spot.txt +++ b/tests/parser/valid_beacon_data/spot.txt @@ -8,3 +8,4 @@ ICA3E7540>OGSPOT,qAS,SPOT:/161427h1448.35S/04610.86W'000/000/A=008677 id0-2860357 SPOT3 GOOD ICA3E7540>OGSPOT,qAS,SPOT:/162923h1431.99S/04604.33W'000/000/A=006797 id0-2860357 SPOT3 GOOD ICA3E7540>OGSPOT,qAS,SPOT:/163421h1430.38S/04604.43W'000/000/A=007693 id0-2860357 SPOT3 GOOD +FLRDF0CBA>OGSPOT,qAS,SPOT:/145808h3317.84S/07021.04W'000/000/A=010085 id0-2120121 SPOTCONNECT GOOD \ No newline at end of file diff --git a/tests/parser/valid_beacon_data/tracker.txt b/tests/parser/valid_beacon_data/tracker.txt index 908e401..fe6ea09 100644 --- a/tests/parser/valid_beacon_data/tracker.txt +++ b/tests/parser/valid_beacon_data/tracker.txt @@ -7,3 +7,4 @@ FLRDD9C70>OGNTRK,OGN2FD00F*,qAS,LZHL:/093021h4848.77N/01708.33E'000/000/A=000518 OGN03AF2A>OGNTRK,qAS,LZHL:/092912h4848.77N/01708.33E'000/000/A=000535 !W53! id0703AF2A +000fpm +0.0rot FL003.15 4.5dB 1e -0.1kHz gps4x5 -11.2dBm OGN2FD00F>OGNTRK,qAS,LZHL:>092840h h00 v00 11sat/2 165m 1001.9hPa +27.1degC 0% 3.28V 14/-111.5dBm 127/min FLRDD9C70>OGNTRK,RELAY*,qAS,LZHL:/094124h4848.78N/01708.33E'000/000/A=000397 !W15! id06DD9C70 +099fpm +0.0rot 24.5dB 0e -1.4kHz gps10x15 +OGN7402C8>OGNTRK,qAS,OxfBarton:>055357h h02 v01 \ No newline at end of file