From 307e944911654c91ac7fe88a8bd43d4c7a0881c6 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Fri, 6 Aug 2021 20:01:35 +0200 Subject: [PATCH] split metadata into lines (if more than one was received) --- owrx/meta.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/owrx/meta.py b/owrx/meta.py index 66994d4..22eaa1d 100644 --- a/owrx/meta.py +++ b/owrx/meta.py @@ -155,12 +155,13 @@ class MetaParser(Parser): "NXDN": RadioIDEnricher("nxdn", self), } - def parse(self, meta): - fields = meta.split(";") - meta = {v[0]: ":".join(v[1:]) for v in map(lambda x: x.split(":"), fields) if v[0] != ""} + def parse(self, raw: str): + for meta in raw.split("\n"): + fields = meta.split(";") + meta = {v[0]: ":".join(v[1:]) for v in map(lambda x: x.split(":"), fields) if v[0] != ""} - if "protocol" in meta: - protocol = meta["protocol"] - if protocol in self.enrichers: - meta = self.enrichers[protocol].enrich(meta) - self.handler.write_metadata(meta) + if "protocol" in meta: + protocol = meta["protocol"] + if protocol in self.enrichers: + meta = self.enrichers[protocol].enrich(meta) + self.handler.write_metadata(meta)