parse address as a numeric field

This commit is contained in:
Jakob Ketterl 2020-01-10 22:11:57 +01:00
parent ba9a9096bf
commit 976c15d29a

View File

@ -5,4 +5,6 @@ class PocsagParser(Parser):
def parse(self, raw): def parse(self, raw):
fields = raw.decode("ascii", "replace").rstrip("\n").split(";") 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] != ""} 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) self.handler.write_pocsag_data(meta)