Update __main__.py
Updated print statements to f-strings.
This commit is contained in:
parent
d39b404f62
commit
a0b3f737d7
16
__main__.py
16
__main__.py
|
@ -25,7 +25,7 @@ for file in required_files:
|
||||||
file_name = file[0]
|
file_name = file[0]
|
||||||
url = file[1]
|
url = file[1]
|
||||||
if not os.path.isfile("./dependencies/" + file_name):
|
if not os.path.isfile("./dependencies/" + file_name):
|
||||||
print(file_name, "does not exist downloading now")
|
print(f'{file_name} does not exist downloading now")
|
||||||
try:
|
try:
|
||||||
import requests
|
import requests
|
||||||
file_content = requests.get(url)
|
file_content = requests.get(url)
|
||||||
|
@ -34,9 +34,9 @@ for file in required_files:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise e("Error getting", file_name, "from", url)
|
raise e("Error getting", file_name, "from", url)
|
||||||
else:
|
else:
|
||||||
print("Successfully got", file_name)
|
print(f"Successfully got {file_name}")
|
||||||
else:
|
else:
|
||||||
print("Already have", file_name, "continuing")
|
print(f"Already have {file_name} continuing")
|
||||||
if os.path.isfile("./dependencies/" + required_files[4][0]) and not os.path.isfile("./dependencies/aircrafts.json"):
|
if os.path.isfile("./dependencies/" + required_files[4][0]) and not os.path.isfile("./dependencies/aircrafts.json"):
|
||||||
print("Extracting Mictronics DB")
|
print("Extracting Mictronics DB")
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
@ -62,7 +62,7 @@ else:
|
||||||
print("Route lookup is disabled")
|
print("Route lookup is disabled")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print("Source is set to", source)
|
print(f"Source is set to {source}")
|
||||||
import sys
|
import sys
|
||||||
#Setup plane objects from plane configs
|
#Setup plane objects from plane configs
|
||||||
planes = {}
|
planes = {}
|
||||||
|
@ -83,7 +83,7 @@ try:
|
||||||
except pytz.exceptions.UnknownTimeZoneError:
|
except pytz.exceptions.UnknownTimeZoneError:
|
||||||
tz = pytz.UTC
|
tz = pytz.UTC
|
||||||
last_ra_count = None
|
last_ra_count = None
|
||||||
print(len(planes), "Planes configured")
|
print(f"{len(planes)} Planes configured")
|
||||||
while True:
|
while True:
|
||||||
datetime_tz = datetime.now(tz)
|
datetime_tz = datetime.now(tz)
|
||||||
if datetime_tz.hour == 0 and datetime_tz.minute == 0:
|
if datetime_tz.hour == 0 and datetime_tz.minute == 0:
|
||||||
|
@ -91,7 +91,7 @@ try:
|
||||||
running_Count +=1
|
running_Count +=1
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
header = ("-------- " + str(running_Count) + " -------- " + str(datetime_tz.strftime("%I:%M:%S %p")) + " ---------------------------------------------------------------------------")
|
header = ("-------- " + str(running_Count) + " -------- " + str(datetime_tz.strftime("%I:%M:%S %p")) + " ---------------------------------------------------------------------------")
|
||||||
print (Back.GREEN + Fore.BLACK + header[0:100] + Style.RESET_ALL)
|
print (f"{Back.GREEN} {Fore.BLACK} {header[0:100]} {Style.RESET_ALL}")
|
||||||
if source == "ADSBX":
|
if source == "ADSBX":
|
||||||
#ACAS data
|
#ACAS data
|
||||||
from defADSBX import pull_date_ras
|
from defADSBX import pull_date_ras
|
||||||
|
@ -121,7 +121,7 @@ try:
|
||||||
last_ra_count = ra_count
|
last_ra_count = ra_count
|
||||||
for key, obj in planes.items():
|
for key, obj in planes.items():
|
||||||
if sorted_ras != {} and key in sorted_ras.keys():
|
if sorted_ras != {} and key in sorted_ras.keys():
|
||||||
print(key, "has", len(sorted_ras[key]), "RAs")
|
print(f"{key} has {len(sorted_ras[key])} RAs")
|
||||||
obj.check_new_ras(sorted_ras[key])
|
obj.check_new_ras(sorted_ras[key])
|
||||||
obj.expire_ra_types()
|
obj.expire_ra_types()
|
||||||
#Normal API data
|
#Normal API data
|
||||||
|
@ -214,4 +214,4 @@ except Exception as e:
|
||||||
logging.error(str(traceback.format_exc()))
|
logging.error(str(traceback.format_exc()))
|
||||||
from defDiscord import sendDis
|
from defDiscord import sendDis
|
||||||
sendDis(str("Error Exiting: " + str(e) + " Failed on " + "https://globe.adsbexchange.com/?icao=" + key), main_config, main_config.get('DISCORD', 'ROLE_ID'), "crash_latest.log")
|
sendDis(str("Error Exiting: " + str(e) + " Failed on " + "https://globe.adsbexchange.com/?icao=" + key), main_config, main_config.get('DISCORD', 'ROLE_ID'), "crash_latest.log")
|
||||||
raise e
|
raise e
|
||||||
|
|
Loading…
Reference in New Issue