Add some oneoff tools for comm-b decoding testing

This commit is contained in:
Oliver Jowett 2019-05-02 17:29:46 +08:00
parent d33b1160f2
commit 564f033087
3 changed files with 192 additions and 0 deletions

17
oneoff/extract-comm-b.py Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python3
# Run me like this:
# view1090 --no-interactive | ./extract-comm-b.py
import re, sys, time
from contextlib import closing
commb_match = re.compile(r'^DF:\d+ addr:([a-zA-Z0-9]{6}) FS:\d+ DR:\d+ UM:\d+ (?:ID|AC):\d+ MB:([a-zA-Z0-9]{14})$')
for line in sys.stdin:
match = commb_match.match(line)
if match:
addr, mb = match.groups()
with closing(open('commb/' + addr.upper() + '.txt', 'a')) as f:
print('%.3f %s' % (time.time(), mb), file=f)