From 12d05c5a545ecd286d4d7b61a0fcf0d68ddf519e Mon Sep 17 00:00:00 2001 From: Mason10198 <31994327+Mason10198@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:18:38 -0500 Subject: [PATCH] Fix Supermon compatibility --- SkywarnPlus.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/SkywarnPlus.py b/SkywarnPlus.py index 9fa6106..f22781d 100644 --- a/SkywarnPlus.py +++ b/SkywarnPlus.py @@ -381,7 +381,12 @@ def getAlerts(countyCodes): # if end is null, use effective time if not end: end = feature["properties"].get("expires") - logger.debug("getAlerts: %s has no \"%s\" time, using \"expires\" time instead: %s", feature["properties"]["event"], time_type_end, end) + logger.debug( + 'getAlerts: %s has no "%s" time, using "expires" time instead: %s', + feature["properties"]["event"], + time_type_end, + end, + ) if start and end: start_time = parser.isoparse(start) end_time = parser.isoparse(end) @@ -1008,7 +1013,7 @@ def supermon_back_compat(alerts): os.makedirs("/tmp/AUTOSKY", exist_ok=True) # Get alert titles (without severity levels) - alert_titles = [alert[0] for alert in alerts.keys()] + alert_titles = list(alerts.keys()) # Write alert titles to a file, with each title on a new line with open("/tmp/AUTOSKY/warnings.txt", "w") as file: @@ -1071,9 +1076,7 @@ def main(): # Initialize pushover message pushover_message = ( - "Alerts Cleared\n" - if not alerts - else "\n".join(alerts.keys()) + "\n" + "Alerts Cleared\n" if not alerts else "\n".join(alerts.keys()) + "\n" ) # Check if Courtesy Tones (CT) or ID needs to be changed