rsimac / pmacars

simple python ACARS utility for x-plane
GNU General Public License v3.0
1 stars 0 forks source link

Add vatsim data #2

Open rsimac opened 2 years ago

rsimac commented 2 years ago

Often the flights requiring logging to our virtual airline are flown under Vatsim.

It would be great if the pmacars output contains some of the data from https://data.vatsim.net/v3/vatsim-data.json

rsimac commented 2 years ago

Added vatsim pilot record parsing. When vatsim pilot id (CID) is specified, pmacars.py looks it up at vatsim data server, and returns the currently connected pilot data. If not currently connected, no data. For example:

pmacars.py 'C:\Program Files (x86)\Steam\steamapps\common\X-Plane 11\Data.txt' '904506'
Usage: pmacars.py <xplane_data_txt_full_file_path> [<vatsim_id>]
Parsing VATSIM record for vatsim ID: 904506...
{'cid': 904506, 'name': 'Robert Simac LDRI', 'callsign': 'CTN491', 'server': 'USA-EAST', 'pilot_rating': 0, 'latitude': 44.89742, 'longitude': 13.9241, 'altitude': 220, 'groundspeed': 0, 'transponder': '1000', 'heading': 26, 'qnh_i_hg': 29.92, 'qnh_mb': 1013, 'flight_plan': {'flight_rules': 'I', 'aircraft': 'A320/M-VGDW/C', 'aircraft_faa': 'A320/L', 'aircraft_short': 'A320', 'departure': 'LSZH', 'arrival': 'LDPL', 'alternate': 'LDRI', 'cruise_tas': '447', 'altitude': '33000', 'deptime': '1955', 'enroute_time': '0055', 'fuel_time': '0159', 'remarks': 'PBN/A1B1C1D1O1S1 DOF/211109 REG/9ACTK EET/LIMM0022 LDZO0046 OPR/CTN PER/C RMK/AAVIRTUAL.COM SIMBRIEF /V/', 'route': 'VEBIT4N/32 VEBIT T53 GERSA Z50 RESIA DCT LAREN/N0448F290 Z122 LABIN', 'revision_id': 6, 'assigned_transponder': '1000'}, 'logon_time': '2021-11-09T19:25:44.1284173Z', 'last_updated': '2021-11-09T22:03:26.7055045Z'}

Please exit the X-Plane and then press ENTER to parse the data.txt file...

{'startup_zulu': '07:43', 'shutdown_zulu': '09:05'}