parent
42a86e1f4e
commit
045e6ac0d6
|
|
@ -105,8 +105,8 @@ cd plane-notify
|
||||||
|
|
||||||
### Configure individual planes
|
### Configure individual planes
|
||||||
|
|
||||||
- an example file is given (plane1.ini) plane config files should be in the configs directory, the program looks for any file in that folder with a .ini exstenstion.
|
- an example file is given (plane1.ini) plane config files should be in the configs directory, the program looks for any file in that folder with a .ini exstenstion.
|
||||||
- each plane should have its own config
|
- each plane should have its own config
|
||||||
|
|
||||||
### Enter and create new Screen Session
|
### Enter and create new Screen Session
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@ def download_airports():
|
||||||
import requests
|
import requests
|
||||||
url = 'https://ourairports.com/data/airports.csv'
|
url = 'https://ourairports.com/data/airports.csv'
|
||||||
airports = requests.get(url)
|
airports = requests.get(url)
|
||||||
|
|
||||||
open('airports.csv', 'wb').write(airports.content)
|
open('airports.csv', 'wb').write(airports.content)
|
||||||
except:
|
except:
|
||||||
raise("Error getting airports.dat or storing")
|
raise("Error getting airports.dat or storing")
|
||||||
else:
|
else:
|
||||||
#Writes current date to airports.dat to show when it was aqquired
|
#Writes current date to airports.dat to show when it was aqquired
|
||||||
import datetime
|
import datetime
|
||||||
date = datetime.datetime.now()
|
date = datetime.datetime.now()
|
||||||
with open('airports.csv', 'a') as airports:
|
with open('airports.csv', 'a') as airports:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
class Plane:
|
class Plane:
|
||||||
def __init__(self, icao, conf_file):
|
def __init__(self, icao, conf_file):
|
||||||
|
'''Initializes a plane object from its config file and given icao'''
|
||||||
self.icao = icao.upper()
|
self.icao = icao.upper()
|
||||||
self.conf_file = conf_file
|
self.conf_file = conf_file
|
||||||
self.geo_alt_ft = None
|
self.geo_alt_ft = None
|
||||||
|
|
@ -14,7 +15,6 @@ class Plane:
|
||||||
self.latitude = None
|
self.latitude = None
|
||||||
self.callsign = None
|
self.callsign = None
|
||||||
self.takeoff_time = None
|
self.takeoff_time = None
|
||||||
|
|
||||||
self.map_file_name = icao.upper() + "_map.png"
|
self.map_file_name = icao.upper() + "_map.png"
|
||||||
self.last_latitude = None
|
self.last_latitude = None
|
||||||
self.last_longitude = None
|
self.last_longitude = None
|
||||||
|
|
@ -25,7 +25,7 @@ class Plane:
|
||||||
def getICAO(self):
|
def getICAO(self):
|
||||||
return self.icao
|
return self.icao
|
||||||
def run(self, ac_dict, source):
|
def run(self, ac_dict, source):
|
||||||
|
'''Runs a check of a plane module to see if its landed or takenoff using plane data, and takes action if so'''
|
||||||
#Import Modules
|
#Import Modules
|
||||||
#Clear Terminal
|
#Clear Terminal
|
||||||
#print("\033[H\033[J")
|
#print("\033[H\033[J")
|
||||||
|
|
@ -198,7 +198,7 @@ class Plane:
|
||||||
self.trigger_type = "now on ground"
|
self.trigger_type = "now on ground"
|
||||||
self.landed_header = "Landed in "
|
self.landed_header = "Landed in "
|
||||||
self.last_feed_data = None
|
self.last_feed_data = None
|
||||||
#Store a dictionary when data is lost near landing conditions,
|
#Store a dictionary when data is lost near landing conditions,
|
||||||
elif self.last_below_desired_ft and self.last_feeding and self.feeding is False and self.last_on_ground is False:
|
elif self.last_below_desired_ft and self.last_feeding and self.feeding is False and self.last_on_ground is False:
|
||||||
self.last_feed_data = {}
|
self.last_feed_data = {}
|
||||||
self.last_feed_data.update(self.__dict__)
|
self.last_feed_data.update(self.__dict__)
|
||||||
|
|
@ -353,7 +353,7 @@ class Plane:
|
||||||
elif self.config.get('MAP', 'OPTION') == "ADSBX":
|
elif self.config.get('MAP', 'OPTION') == "ADSBX":
|
||||||
getSS(self.icao)
|
getSS(self.icao)
|
||||||
append_airport(self.map_file_name, nearest_airport_dict['icao'], nearest_airport_dict['name'], nearest_airport_dict['distance'])
|
append_airport(self.map_file_name, nearest_airport_dict['icao'], nearest_airport_dict['name'], nearest_airport_dict['distance'])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise Exception("Map option not set correctly in this planes conf")
|
raise Exception("Map option not set correctly in this planes conf")
|
||||||
#Discord
|
#Discord
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue