Due to addition of dump1090-fa was forced bacdk to gettting JSON using http.

pull/269/head
Joe Prochazka 2016-09-27 12:53:35 -04:00
rodzic 19370ce520
commit 14baab36cd
1 zmienionych plików z 9 dodań i 6 usunięć

Wyświetl plik

@ -39,7 +39,7 @@ import datetime
import json
import time
import os
#import urllib2
import urllib2
def log(string):
#print(string) # uncomment to enable debug logging
@ -187,11 +187,14 @@ if __name__ == "__main__":
# Main run loop
while True:
# Read dump1090-mutability's aircraft.json.
with open('/run/dump1090-mutability/aircraft.json') as data_file:
data = json.load(data_file)
# For testing using a remote JSON feed.
#response = urllib2.urlopen('http://192.168.254.2/dump1090/data/aircraft.json')
#data = json.load(response)
#with open('/run/dump1090-mutability/aircraft.json') as data_file:
# data = json.load(data_file)
# Switch from physical file location to using urllib2 after the addition of the dump1090-fa option.
# dump1090-fa and dump1090-mutability store aircraft.json in difrent locations.
# However Lighttpd is set up to serve this file using the same URL no matter which version is installed.
response = urllib2.urlopen('http://192.168.254.2/dump1090/data/aircraft.json')
data = json.load(response)
processor.processAircraftList(data["aircraft"])