Mirror of https://github.com/Jxck-S/plane-notify
This is the backend to ElonsJet and other bots
acasads-badsbadsbexchangeadsbxairportemergency-squawklandopenskyopensky-apiopensky-networkplaneresolutionadviosrysquawktakeofftcas
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
726 B
26 lines
726 B
4 years ago
|
import json
|
||
|
import os
|
||
|
folder = os.getcwd() + "/dependencies"
|
||
|
def get_aircraft_by_icao(icao):
|
||
|
with open(folder + '/aircrafts.json') as aircrafts_json:
|
||
|
aircraft = json.load(aircrafts_json)
|
||
|
try:
|
||
|
reg = aircraft[icao.upper()]
|
||
|
except KeyError:
|
||
|
reg = None
|
||
|
return reg
|
||
|
|
||
|
def get_type_desc(t):
|
||
|
with open(folder + '/types.json') as types_json:
|
||
|
types = json.load(types_json)
|
||
|
return types[t.upper()]
|
||
|
|
||
|
def get_db_ver():
|
||
|
with open(folder + '/dbversion.json') as dbver_json:
|
||
|
dbver = json.load(dbver_json)
|
||
|
return dbver["version"]
|
||
|
def test():
|
||
|
print(get_aircraft_by_icao("A835AF"))
|
||
|
print(get_type_desc("GLF6"))
|
||
|
print(get_db_ver())
|
||
|
#test()
|