Browse Source

Formatting

-Remark
-Docustrings
pull/2/head
Jack Sweeney 4 years ago committed by GitHub
parent
commit
90e143191a
  1. 4
      README.md
  2. 6
      defAirport.py
  3. 8
      planeClass.py

4
README.md

@ -105,8 +105,8 @@ cd plane-notify
### 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.
- each plane should have its own config
- 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
### Enter and create new Screen Session

6
defAirport.py

@ -8,12 +8,12 @@ def download_airports():
import requests
url = 'https://ourairports.com/data/airports.csv'
airports = requests.get(url)
open('airports.csv', 'wb').write(airports.content)
except:
except:
raise("Error getting airports.dat or storing")
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
date = datetime.datetime.now()
with open('airports.csv', 'a') as airports:

8
planeClass.py

@ -1,5 +1,6 @@
class Plane:
def __init__(self, icao, conf_file):
'''Initializes a plane object from its config file and given icao'''
self.icao = icao.upper()
self.conf_file = conf_file
self.geo_alt_ft = None
@ -14,7 +15,6 @@ class Plane:
self.latitude = None
self.callsign = None
self.takeoff_time = None
self.map_file_name = icao.upper() + "_map.png"
self.last_latitude = None
self.last_longitude = None
@ -25,7 +25,7 @@ class Plane:
def getICAO(self):
return self.icao
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
#Clear Terminal
#print("\033[H\033[J")
@ -198,7 +198,7 @@ class Plane:
self.trigger_type = "now on ground"
self.landed_header = "Landed in "
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:
self.last_feed_data = {}
self.last_feed_data.update(self.__dict__)
@ -353,7 +353,7 @@ class Plane:
elif self.config.get('MAP', 'OPTION') == "ADSBX":
getSS(self.icao)
append_airport(self.map_file_name, nearest_airport_dict['icao'], nearest_airport_dict['name'], nearest_airport_dict['distance'])
else:
raise Exception("Map option not set correctly in this planes conf")
#Discord

Loading…
Cancel
Save