Skip to content

Commit

Permalink
FLEX fixes.
Browse files Browse the repository at this point in the history
This should partially fix crashes around FLEX; it needs improvement to better handle FLEX fragments, and will just currently output everything that it sees from multimon-ng.

Some detail at #3

Changelog: fixed
  • Loading branch information
lingfish committed Dec 9, 2024
1 parent da2c8ee commit 77242a8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/mmng_ui/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def parse(self, line: str) -> tuple[PocsagMessage, bool]:
elif re.search(r'FLEX[:|]', line):
address_match = re.search(r'FLEX[:|] ?.*?[\[|](\d*?)[\]| ]', line)
if address_match:
address = address_match.group(1).trim()
address = address_match.group(1).strip()

# Handle timestamps within FLEX
if self.use_timestamp:
Expand Down Expand Up @@ -155,8 +155,12 @@ def parse(self, line: str) -> tuple[PocsagMessage, bool]:
frag[address] = message
trim_message = ''
elif re.search(r'[ |][0-9]{4}\/[0-9]\/C\/.[ |]', line):
trim_message = frag[address] + message
del frag[address]
try:
trim_message = frag[address] + message
del frag[address]
except KeyError:
# We've seen a fragment without the starting frag, treat as final
trim_message = message
else:
trim_message = message

Expand Down

0 comments on commit 77242a8

Please sign in to comment.