parse metadata on the server side
This commit is contained in:
parent
05f6fff8f6
commit
14f932eea8
@ -1309,13 +1309,7 @@ function on_ws_recv(evt)
|
||||
}
|
||||
}
|
||||
|
||||
function update_metadata(stringData) {
|
||||
var meta = {};
|
||||
stringData.split(";").forEach(function(s) {
|
||||
var item = s.split(":");
|
||||
meta[item[0]] = item[1];
|
||||
});
|
||||
|
||||
function update_metadata(meta) {
|
||||
var update = function(_, el) {
|
||||
el.innerHTML = "";
|
||||
};
|
||||
|
7
owrx/meta.py
Normal file
7
owrx/meta.py
Normal file
@ -0,0 +1,7 @@
|
||||
class MetaParser(object):
|
||||
def __init__(self, handler):
|
||||
self.handler = handler
|
||||
def parse(self, meta):
|
||||
fields = meta.split(";")
|
||||
dict = {v[0] : "".join(v[1:]) for v in map(lambda x: x.split(":"), fields)}
|
||||
self.handler.write_metadata(dict)
|
@ -1,6 +1,7 @@
|
||||
import subprocess
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.feature import FeatureDetector, UnknownFeatureException
|
||||
from owrx.meta import MetaParser
|
||||
import threading
|
||||
import csdr
|
||||
import time
|
||||
@ -334,6 +335,7 @@ class DspManager(csdr.output):
|
||||
def __init__(self, handler, sdrSource):
|
||||
self.handler = handler
|
||||
self.sdrSource = sdrSource
|
||||
self.metaParser = MetaParser(self.handler)
|
||||
|
||||
self.localProps = self.sdrSource.getProps().collect(
|
||||
"audio_compression", "fft_compression", "digimodes_fft_size", "csdr_dynamic_bufsize",
|
||||
@ -403,7 +405,7 @@ class DspManager(csdr.output):
|
||||
"smeter": self.handler.write_s_meter_level,
|
||||
"secondary_fft": self.handler.write_secondary_fft,
|
||||
"secondary_demod": self.handler.write_secondary_demod,
|
||||
"meta": self.handler.write_metadata
|
||||
"meta": self.metaParser.parse
|
||||
}
|
||||
write = writers[t]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user