openwebrx-clone/owrx/pocsag.py

11 lines
382 B
Python
Raw Permalink Normal View History

from owrx.parser import Parser
class PocsagParser(Parser):
def parse(self, raw):
fields = raw.decode("ascii", "replace").rstrip("\n").split(";")
meta = {v[0]: "".join(v[1:]) for v in map(lambda x: x.split(":"), fields) if v[0] != ""}
2020-01-10 21:11:57 +00:00
if "address" in meta:
meta["address"] = int(meta["address"])
self.handler.write_pocsag_data(meta)