A Python project to read ACARS/VDL-M2 data from a TCP JSON stream, detect drama, and share it
- Read ACARS/VDLM2 by making a socket connection to an ACARS Hub
- Use a list of keywords of interest (drama) and phrases to exclude
- Facility for computing a "Drama Quotient" value to only publish or give priority to high-drama messages (needs work)
- Output matching messages to a Webhook (currently Discord is supported)
Areas for improvement:
WebhookPoster.py- improve to support more destinations than just Discord (like Mastodon, hi Mike!)DramaDetector.py- better compute a.dqdrama value to identify items worth sharing
-
Clone the repository
-
Optional: set up a virtual environment
python3 -m venv ~/.venv/acarsparse source ~/.venv/acarsparse/bin/activate python3 -m pip install --upgrade pip setuptools wheel
-
Install required libraries:
python3 -m pip install -r requirements.txt -
cd acarsparse -
Copy
config-default.jsontoconfig.json -
Edit
config.jsonto map to your ACARS Hub ACARS and VDLM2 socket ports -
Copy
logging-default.ymltologging.yml -
python3 AcarsParse.py
Configuration of ACARS/VDLM2 sources and destination for output.
- Auto-detection of ACARS or VDLM2 source
- Reconnects when disconnected (happens when updating ACARS Hub)
- Supports Discord as an output Webhook
{
"sources": [
{
"host": "127.0.0.1",
"name": "ACARS",
"port": 15550
},
{
"host": "127.0.0.1",
"name": "VDLM2",
"port": 15555
}
],
"logconfig": "logging.yml",
"webhooks": [
{
"type": "discord",
"url": "https://discord.com/api/webhooks/..."
}
]
}- Keywords in messages which increase drama (only single words)
- List of message labels which increase drama
- Exclusions: strings that, when matched, discard the message immediately
{
"version": 1,
"keywords": ["COFFEE", "LAV"],
"labels": [],
"exclusions": [
"AIRPORT IDENTIFIERS NOT ENTERED FOR WEATHER REQUEST",
"ATIS INFO",
"DATALINK SERVICE SUSPENDED",
"NO DEPARTURE CLEARANCE"
]
}Configuration file for script logging.
If you wish to log to a Seq server, add seq to your handlers and then add a handler similar to:
seq:
class: seqlog.structured_logging.SeqLogHandler
formatter: seq
# Seq-specific settings (add any others you need, they're just kwargs for SeqLogHandler's constructor).
server_url: "http://seq.local/"
api_key: "mySECRETapiKEY"
# Use a custom JSON encoder, if you need to.
json_encoder_class: json.encoder.JSONEncoder