1
0
Fork 0

Enabled target lookup with DMRIds.dat

main
Kim Huebel 4 years ago
parent 8067ae7d4d
commit a6f35b294e

@ -67,10 +67,22 @@ def view_log(websocket, path):
content = conv.convert(content, full=False) content = conv.convert(content, full=False)
lines = content.split("\n") lines = content.split("\n")
for line in lines: for line in lines:
if line.find("from ") > 0 and line.find("to ") > 0: if line.find("received") > 0 or line.find("network watchdog") > 0:
source = line[line.index("from ") + 5:line.index("to ")].strip() if line.find("from ") > 0 and line.find("to ") > 0:
if source in dmrids: source = line[line.index("from ") + 5:line.index("to ")].strip()
line = line.replace(source, dmrids[source]) if source in dmrids:
line = line.replace(source, dmrids[source])
if line.find("to ") > 0:
if line.find("at ") > 0 and line.find("late entry") < 0:
target = line[line.index("to ") + 3:line.rindex("at ")]
if target in dmrids:
line = line.replace(target, dmrids[target])
else:
target = line[line.index("to") + 3:]
if target.find(",") > 0:
target = target[0:target.index(",")]
if target in dmrids:
line = line.replace(target, dmrids[target])
yield from websocket.send(line) yield from websocket.send(line)
while True: while True:
@ -79,10 +91,22 @@ def view_log(websocket, path):
content = conv.convert(content, full=False) content = conv.convert(content, full=False)
lines = content.split("\n") lines = content.split("\n")
for line in lines: for line in lines:
if line.find("from ") > 0 and line.find("to ") > 0: if line.find("received") > 0 or line.find("network watchdog") > 0:
source = line[line.index("from ") + 5:line.index("to ")].strip() if line.find("from ") > 0 and line.find("to ") > 0:
if source in dmrids: source = line[line.index("from ") + 5:line.index("to ")].strip()
line = line.replace(source, dmrids[source]) if source in dmrids:
line = line.replace(source, dmrids[source])
if line.find("to ") > 0:
if line.find("at ") > 0 and line.find("late entry") < 0:
target = line[line.index("to ") + 3:line.rindex("at ")]
if target in dmrids:
line = line.replace(target, dmrids[target])
else:
target = line[line.index("to") + 3:]
if target.find(",") > 0:
target = target[0:target.index(",")]
if target in dmrids:
line = line.replace(target, dmrids[target])
yield from websocket.send(line) yield from websocket.send(line)
else: else:
yield from asyncio.sleep(0.2) yield from asyncio.sleep(0.2)
@ -153,6 +177,7 @@ def main():
for line in lines: for line in lines:
tokens = line.split("\t") tokens = line.split("\t")
dmrids[tokens[0]] = tokens[1] dmrids[tokens[0]] = tokens[1]
logging.info("Starting Websocketserver") logging.info("Starting Websocketserver")
websocketserver() websocketserver()

Loading…
Cancel
Save