01234567890123456789012345678901234567890123456789012345678901234567890123456789
15261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554 15551556155715581559156015611562156315641565156615671568156915701571157215731574 |
<----SKIPPED LINES---->
are a sequential list of the location-attributes in the json file; allows
for tracking the flight path over time.
log_jsons: boolean indicating whether we should pickle the JSONs.
flights: list of flight dictionaries; if no json is returned, used to
find a recent flight with same flight number to augment this flight with
origin / destination / airline.
Returns:
A tuple:
- updated persistent_nearby_aircraft
- (possibly empty) dictionary of flight attributes of the new flight upon
its first observation.
- the time of the radio observation if present; None if no radio dump
- a dictionary of attributes about the dump itself (i.e.: # of flights;
furthest observed flight, etc.)
- persistent_path, a data structure containing past details of a flight's
location as described in ParseDumpJson
- a text message indicating any errors in querying FlightAware or
populating flight details
- timestamp indicating exact time at which FlightAware was queried (or
attempted to be queried)
"""
flight_details = {}
error_message = ''
now = time.time()
if SIMULATION:
(dump_json, json_time) = DUMP_JSONS[SIMULATION_COUNTER]
else:
dump_json = ReadFile(DUMP_JSON_FILE, log_exception=True)
json_desc_dict = {}
current_nearby_aircraft = {}
if dump_json:
(current_nearby_aircraft, now,
json_desc_dict, persistent_path) = ParseDumpJson(
dump_json, persistent_path)
if not SIMULATION and log_jsons:
PickleObjectToFile((dump_json, now), PICKLE_DUMP_JSON_FILE, True)
newly_nearby_flight_identifiers = UpdateAircraftList(
persistent_nearby_aircraft, current_nearby_aircraft, now)
if newly_nearby_flight_identifiers:
if len(newly_nearby_flight_identifiers) > 1:
# newly_nearby_flight_identifiers is a list of 2-tuples, where each
# tuple is (flight_number, squawk)
newly_nearby_flight_identifiers_str = ', '.join(
<----SKIPPED LINES---->
|
01234567890123456789012345678901234567890123456789012345678901234567890123456789
152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576 |
<----SKIPPED LINES---->
are a sequential list of the location-attributes in the json file; allows
for tracking the flight path over time.
log_jsons: boolean indicating whether we should pickle the JSONs.
flights: list of flight dictionaries; if no json is returned, used to
find a recent flight with same flight number to augment this flight with
origin / destination / airline.
Returns:
A tuple:
- updated persistent_nearby_aircraft
- (possibly empty) dictionary of flight attributes of the new flight upon
its first observation.
- the time of the radio observation if present; None if no radio dump
- a dictionary of attributes about the dump itself (i.e.: # of flights;
furthest observed flight, etc.)
- persistent_path, a data structure containing past details of a flight's
location as described in ParseDumpJson
- a text message indicating any errors in querying FlightAware or
populating flight details
- timestamp indicating exact time at which FlightAware was queried (or
attempted to be queried), if a query was made in this pass
"""
flight_details = {}
error_message = ''
now = time.time()
if SIMULATION:
(dump_json, json_time) = DUMP_JSONS[SIMULATION_COUNTER]
else:
dump_json = ReadFile(DUMP_JSON_FILE, log_exception=True)
# Often there is no flight aware query, so we need to give a default value
flight_aware_timestamp = 0
json_desc_dict = {}
current_nearby_aircraft = {}
if dump_json:
(current_nearby_aircraft, now,
json_desc_dict, persistent_path) = ParseDumpJson(
dump_json, persistent_path)
if not SIMULATION and log_jsons:
PickleObjectToFile((dump_json, now), PICKLE_DUMP_JSON_FILE, True)
newly_nearby_flight_identifiers = UpdateAircraftList(
persistent_nearby_aircraft, current_nearby_aircraft, now)
if newly_nearby_flight_identifiers:
if len(newly_nearby_flight_identifiers) > 1:
# newly_nearby_flight_identifiers is a list of 2-tuples, where each
# tuple is (flight_number, squawk)
newly_nearby_flight_identifiers_str = ', '.join(
<----SKIPPED LINES---->
|