Browse Source

Backing up old changesfrom PC- 7

single
Jxck-S 5 years ago
parent
commit
fdb9df4bec
  1. 26
      OpenSky Bot.py

26
OpenSky Bot.py

@ -9,12 +9,12 @@ from colorama import Fore, Back, Style
#Setup PushBullet
from pushbullet import Pushbullet
pb = Pushbullet("*")
pb = Pushbullet("<pushbulletapikey>")
elon_jet_channel = pb.get_channel('<channeltaghere>')
#Setup OpenSKy
from opensky_api import OpenSkyApi
opens_api = OpenSkyApi("*", "*")
opens_api = OpenSkyApi("<openskyusername>", "<openskypass>")
#Set Plane ICAO
TRACK_PLANE = '<planeicaohere>'
@ -22,8 +22,8 @@ TRACK_PLANE = '<planeicaohere>'
geo_altitude = None
geo_alt_ft = None
last_geo_alt_ft = None
last_below_10k_ft = None
below_10k_ft = None
last_below_5k_ft = None
feeding = None
last_feeding = None
last_on_ground = None
@ -35,11 +35,13 @@ geo_alt_m = None
running_Count = 0
icao = None
callsign = None
takeoff_time = None
#Begin Looping program
while True:
running_Count += 1
print (Back.MAGENTA, "--------", running_Count, "-------------------------------------------------------------", Style.RESET_ALL)
#Reset Variables
below_5k_ft = None
geo_alt_ft = None
longitude = None
latitude = None
@ -61,8 +63,10 @@ while True:
latitude = (dataStates.latitude)
on_ground = (dataStates.on_ground)
geo_alt_m = (dataStates.geo_altitude)
if geo_alt_m != None :
if geo_alt_m != None:
geo_alt_ft = geo_alt_m * 3.281
elif geo_alt_m == None and on_ground:
geo_alt_ft = 0
print (Fore.CYAN)
print ("ICAO: ", icao)
print ("Callsign: ", callsign)
@ -130,15 +134,15 @@ while True:
#Check if below 10k ft
if geo_alt_ft is None:
below_10k_ft = False
elif geo_alt_ft < 10000:
below_10k_ft = True
below_5k_ft = False
elif geo_alt_ft < 5000:
below_5k_ft = True
#Check if tookoff
tookoff = bool(last_feeding is False and feeding and on_ground is False and invalid_Location is False and below_10k_ft)
tookoff = bool(invalid_Location is False and below_5k_ft and on_ground is False and ((last_feeding is False and feeding) or (last_on_ground)))
print ("Tookoff Just Now:", tookoff)
#Check if Landed
landed = bool((last_feeding and feeding is False and invalid_Location is False and (on_ground or last_below_10k_ft)) or (on_ground and last_on_ground is False))
landed = bool(last_below_5k_ft and invalid_Location is False and ((last_feeding and feeding is False) or (on_ground and last_on_ground is False)))
print ("Landed Just Now:", landed)
@ -159,7 +163,7 @@ while True:
last_feeding = feeding
last_geo_alt_ft = geo_alt_ft
last_on_ground = on_ground
last_below_10k_ft = below_10k_ft
last_below_5k_ft = below_5k_ft
else:
print ("Rechecking OpenSky")

Loading…
Cancel
Save