openwebrx-clone/owrx/pocsag.py
2020-01-10 22:11:57 +01:00

11 lines
382 B
Python

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] != ""}
if "address" in meta:
meta["address"] = int(meta["address"])
self.handler.write_pocsag_data(meta)