Browse Source

Fix for #53

-Possible fix for #53
-Whitespace trimmed
pull/59/head
Jxck-S 3 years ago
parent
commit
ee06b4da5f
  1. 17
      planeClass.py

17
planeClass.py

@ -88,7 +88,8 @@ class Plane:
from mictronics_parse import get_aircraft_reg_by_icao, get_type_code_by_icao
self.reg = get_aircraft_reg_by_icao(self.icao)
self.type = get_type_code_by_icao(self.icao)
self.last_pos_datetime = datetime.fromtimestamp(ac_dict.time_position)
if ac_dict.time_position is not None:
self.last_pos_datetime = datetime.fromtimestamp(ac_dict.time_position)
except ValueError as e:
print("Got data but some data is invalid!")
print(e)
@ -436,7 +437,7 @@ class Plane:
getMap((municipality + ", " + state + ", " + country_code), self.map_file_name)
elif Plane.main_config.get('MAP', 'OPTION') == "ADSBX":
from defSS import get_adsbx_screenshot
url_params = f"largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao={self.icao}&overlays={self.get_adsbx_map_overlays()}"
url_params = f"largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao={self.icao}&overlays={self.get_adsbx_map_overlays()}"
get_adsbx_screenshot(self.map_file_name, url_params, overrides=self.overrides)
from modify_image import append_airport
text_credit = self.config.get('MAP', 'TEXT_CREDIT') if self.config.has_option('MAP', 'TEXT_CREDIT') else None
@ -558,7 +559,7 @@ class Plane:
getMap((municipality + ", " + state + ", " + country_code), self.map_file_name)
if Plane.main_config.get('MAP', 'OPTION') == "ADSBX":
from defSS import get_adsbx_screenshot
url_params = f"largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao={self.icao}&overlays={self.get_adsbx_map_overlays()}"
url_params = f"largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao={self.icao}&overlays={self.get_adsbx_map_overlays()}"
get_adsbx_screenshot(self.map_file_name, url_params, overrides=self.overrides)
if self.config.getboolean('DISCORD', 'ENABLE'):
dis_message = (self.dis_title + " " + squawk_message)
@ -581,7 +582,7 @@ class Plane:
dis_message = (self.dis_title + " " + mode + " mode enabled.")
if mode == "Approach":
from defSS import get_adsbx_screenshot
url_params = f"largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao={self.icao}&overlays={self.get_adsbx_map_overlays()}"
url_params = f"largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao={self.icao}&overlays={self.get_adsbx_map_overlays()}"
get_adsbx_screenshot(self.map_file_name, url_params, overrides=self.overrides)
sendDis(dis_message, self.config, None, self.map_file_name)
#elif mode in ["Althold", "VNAV", "LNAV"] and self.sel_nav_alt != None:
@ -648,7 +649,7 @@ class Plane:
in_tfr = None
if Plane.main_config.getboolean("TFRS", "ENABLE"):
tfr_url = Plane.main_config.get("TFRS", "URL")
response = requests.get(tfr_url, timeout=30)
response = requests.get(tfr_url, timeout=60)
tfrs = json.loads(response.text)
for tfr in tfrs:
if in_tfr is not None:
@ -764,8 +765,8 @@ class Plane:
return tfr_map_filename
from defSS import get_adsbx_screenshot
url_params = f"largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao={self.icao}&overlays={self.get_adsbx_map_overlays()}"
url_params = f"largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao={self.icao}&overlays={self.get_adsbx_map_overlays()}"
get_adsbx_screenshot(self.map_file_name, url_params, overrides=self.overrides)
if nearest_airport_dict['distance_mi'] < 3:
if "touchngo" in self.circle_history.keys():
@ -794,7 +795,7 @@ class Plane:
sendTeleg(photo, message, self.config)
if self.config.getboolean('DISCORD', 'ENABLE'):
role_id = self.config.get('DISCORD', 'ROLE_ID') if self.config.has_option('DISCORD', 'ROLE_ID') else None
if tfr_map_filename is not None:
if tfr_map_filename is not None:
sendDis(message, self.config, role_id, self.map_file_name, tfr_map_filename)
elif tfr_map_filename is None:
sendDis(message, self.config, role_id, self.map_file_name)

Loading…
Cancel
Save