Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
driver = dump1090
data_url = http://localhost/tar1090/data/aircraft.json
map_url = http://localhost/tar1090/
map_parameters = None
request_timeout = 60

; An airplane is only tracked and tweeted when it enters the "alarm area" the alarm area
Expand Down Expand Up @@ -76,9 +77,9 @@ access_token = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
access_token_secret = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[flightaware]
; FlightAware API allows to get more information on the flights. Basic API access is now free
; and if you are FA feeder, your request limit is doubled. For more details check:
; https://flightaware.com/commercial/flightxml/pricing_class.rvt
; FlightAware API provides additional information about flights. The personal tier is free, and
; if you are a FlightAware feeder, you receive $10 of Per-Query fees free each month. For more
; details: https://flightaware.com/commercial/aeroapi/#compare-plans-section
fa_enable = False
fa_username = XXXXXXXX
fa_api_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Expand Down
2 changes: 2 additions & 0 deletions flightdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ def aircraft_data(self, json_data, time):
speed = 0
if "speed" in a:
speed = geomath.knot2mph(a["speed"])
if "gs" in a:
speed = geomath.knot2mph(a["gs"])
if "mach" in a:
speed = geomath.mach2mph(a["mach"])

Expand Down
17 changes: 14 additions & 3 deletions runbot.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
rm nohup.out
#nohup ./run_tracker.sh &
nohup ./run_tracker.sh </dev/null >/dev/null 2>&1 &
# Set nohup to 1 to write to nohup
nohup=0

if [[ -f nohup.out ]]
then
rm nohup.out
fi

if [ $nohup == 1 ]
then
nohup ./run_tracker.sh &
else
nohup ./run_tracker.sh </dev/null >/dev/null 2>&1 &
fi
37 changes: 32 additions & 5 deletions screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# kevinabrandon@gmail.com
#
# edit by simon@sandm.co.uk to use Chromedriver
# edit by scott@ladewig.com to work for either Selenium 4.3.0+ or older version originally used

import sys
import time
Expand Down Expand Up @@ -37,6 +38,17 @@
# options = webdriver.FirefoxOptions()
# options.add_argument("--headless")

# Checking to see if we need to use Selenium 4.3.0+ commands or pre4.3.0.
webdriverversion = (webdriver.__version__).split(".")
webdriverversionmajor = int(webdriverversion[0])
webdriverversionminor = int(webdriverversion[1])

if (webdriverversionmajor == 4 and webdriverversionminor >= 3) or webdriverversionmajor > 4:
usedeprecated = False
else:
usedeprecated = True


# Check for Crop settings
if parser.has_section('crop'):
do_crop = parser.getboolean('crop', 'do_crop')
Expand Down Expand Up @@ -130,18 +142,27 @@ def loadmap(self):
raise

print("reset map:")
resetbutton = browser.find_elements_by_xpath('//*[contains(@title,"Reset Map")]')
if usedeprecated:
resetbutton = browser.find_elements_by_xpath('//*[contains(@title,"Reset Map")]')
else:
resetbutton = browser.find_elements(By.XPATH, '//*[contains(@title,"Reset Map")]')
resetbutton[0].click()

print("zoom in 3 times:")
try:
# First look for the Open Layers map zoom button.
zoomin = browser.find_element_by_class_name('ol-zoom-in')
if usedeprecated:
zoomin = browser.find_element_by_class_name('ol-zoom-in')
else:
zoomin = browser.find_element(By.CLASS_NAME, 'ol-zoom-in')
print("Zoom: ",zoomin)
except seleniumexceptions.NoSuchElementException as e:
# Doesn't seem to be Open Layers, so look for the Google
# maps zoom button.
zoomin = browser.find_elements_by_xpath('//*[@title="Zoom in"]')
if usedeprecated:
zoomin = browser.find_elements_by_xpath('//*[@title="Zoom in"]')
else:
zoomin = browser.find_elements(By.XPATH, '//*[@title="Zoom in"]')
if zoomin:
zoomin = zoomin[0]
zoomin.click()
Expand All @@ -156,7 +177,10 @@ def clickOnAirplane(self, text):
'''
print(text)
try:
element = self.browser.find_elements_by_xpath("//td[text()='%s']" % text.lower())
if usedeprecated:
element = self.browser.find_elements_by_xpath("//tr[@id='%s']" % text.lower())
else:
element = self.browser.find_elements(By.XPATH, "//tr[@id='%s']" % text.lower())
print("number of elements found: %i" % len(element))
if len(element) > 0:
print("clicking on {}!".format(text))
Expand Down Expand Up @@ -199,7 +223,10 @@ def clickOnAirplane(self, text):
Clicks on the airplane with the name text, and then takes a screenshot
'''
try:
aircraft = self.browser.find_element_by_xpath("//td[text()='%s']" % text)
if usedeprecated:
aircraft = self.browser.find_element_by_xpath("//tr[@id=='%s']" % text)
else:
aircraft = self.browser.find_element(By.XPATH, "//tr[@id='%s']" % text)
aircraft.click()
time.sleep(0.5) # if we don't wait a little bit the airplane icon isn't drawn.
show_on_map = self.browser.find_element_by_link_text('Show on map')
Expand Down