diff --git a/config b/config index 7553181..b0a2d85 100644 --- a/config +++ b/config @@ -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 @@ -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 diff --git a/flightdata.py b/flightdata.py index e2945ae..e00b19a 100755 --- a/flightdata.py +++ b/flightdata.py @@ -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"]) diff --git a/runbot.sh b/runbot.sh index c25a7b7..efc059c 100755 --- a/runbot.sh +++ b/runbot.sh @@ -1,3 +1,14 @@ -rm nohup.out -#nohup ./run_tracker.sh & -nohup ./run_tracker.sh /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 2>&1 & +fi \ No newline at end of file diff --git a/screenshot.py b/screenshot.py index 4d71a16..8388163 100755 --- a/screenshot.py +++ b/screenshot.py @@ -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 @@ -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') @@ -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() @@ -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)) @@ -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')