From 4c7fb4bb167669d028f2ef1ef0beff581f3ed45e Mon Sep 17 00:00:00 2001 From: Mason10198 <31994327+Mason10198@users.noreply.github.com> Date: Mon, 7 Aug 2023 10:30:37 -0500 Subject: [PATCH] Revert "v0.4.3 update" This reverts commit f0e39b7272e52f733612d6d7725d5f486fd4c5a0. --- SkyControl.py | 2 +- SkyDescribe.py | 17 +++++------------ SkywarnPlus.py | 46 +++++++--------------------------------------- UpdateSWP.py | 2 +- config.yaml | 2 +- 5 files changed, 15 insertions(+), 54 deletions(-) diff --git a/SkyControl.py b/SkyControl.py index dd5d644..a5bdc5f 100644 --- a/SkyControl.py +++ b/SkyControl.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 """ -SkyControl v0.4.3 by Mason Nelson +SkyControl v0.4.2 by Mason Nelson ================================== A Control Script for SkywarnPlus diff --git a/SkyDescribe.py b/SkyDescribe.py index 49c5442..5c12684 100644 --- a/SkyDescribe.py +++ b/SkyDescribe.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 """ -SkyDescribe v0.4.3 by Mason Nelson +SkyDescribe v0.4.2 by Mason Nelson ================================================== Text to Speech conversion for Weather Descriptions @@ -267,13 +267,6 @@ def convert_to_audio(api_key, text): return audio_file_path -def pluralize(word): - if word.endswith('s') or word.endswith('sh') or word.endswith('ch') or word.endswith('x'): - return word + 'es' - else: - return word + 's' - - def main(index_or_title): state = load_state() alerts = list(state["last_alerts"].items()) @@ -303,9 +296,9 @@ def main(index_or_title): if unique_instances == 1: description = alert_data[0]["description"] else: - description = "There are {} unique {} in the area. Describing the first one. {}".format( + description = "There are {} unique instances of {}. Describing the first one. {}".format( unique_instances, - pluralize(alert), + alert, alert_data[0]["description"] ) @@ -326,9 +319,9 @@ def main(index_or_title): if unique_instances == 1: description = alert_data[0]["description"] else: - description = "There are {} unique {} in the area. Describing the first one. {}".format( + description = "There are {} unique instances of {}. Describing the first one. {}".format( unique_instances, - pluralize(alert), + alert, alert_data[0]["description"] ) break diff --git a/SkywarnPlus.py b/SkywarnPlus.py index 539dd44..c420603 100644 --- a/SkywarnPlus.py +++ b/SkywarnPlus.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 """ -SkywarnPlus v0.4.3 by Mason Nelson +SkywarnPlus v0.4.2 by Mason Nelson =============================================================================== SkywarnPlus is a utility that retrieves severe weather alerts from the National Weather Service and integrates these alerts with an Asterisk/app_rpt based @@ -1345,34 +1345,6 @@ def supermon_back_compat(alerts): file.write("
".join(alert_titles)) -def detect_new_counties(old_alerts, new_alerts): - """ - Detect if any new counties have been added to an alert. - """ - is_new_counties = False - alerts_with_new_counties = {} - - for alert_name, alert_info in new_alerts.items(): - old_alert_info = old_alerts.get(alert_name, []) - old_county_codes = {info['county_code'] for info in old_alert_info} - new_county_codes = {info['county_code'] for info in alert_info} - added_counties = new_county_codes - old_county_codes - old_county_codes = {code.replace("{", "").replace("}", "").replace('"', "") for code in old_county_codes} - added_counties = {code.replace("{", "").replace("}", "").replace('"', "") for code in added_counties} - - if added_counties: - alerts_with_new_counties[alert_name] = new_alerts[alert_name] - LOGGER.info('{} for {} is now also affecting: {}'.format(alert_name, ", ".join(old_county_codes), ", ".join(added_counties))) - is_new_counties = True - - if COUNTY_WAVS and alerts_with_new_counties: - say_alerts(alerts_with_new_counties) - if config.get("Tailmessage", {}).get("TailmessageCounties", False): - build_tailmessage(alerts_with_new_counties) - - return is_new_counties - - def main(): """ The main function that orchestrates the entire process of fetching and @@ -1485,17 +1457,13 @@ def main(): LOGGER.debug("Sending pushover notification: %s", pushover_message) send_pushover(pushover_message, title="Alerts Changed") else: - if not detect_new_counties(last_alerts, alerts): - if sys.stdin.isatty(): - # list of current alerts, unless there arent any, then current_alerts = "None" - current_alerts = "None" if len(alerts) == 0 else ", ".join(alerts.keys()) - LOGGER.info("No change in alerts.") - LOGGER.info("Current alerts: %s.", current_alerts) - else: - LOGGER.debug("No change in alerts.") + if sys.stdin.isatty(): + # list of current alerts, unless there arent any, then current_alerts = "None" + current_alerts = "None" if len(alerts) == 0 else ", ".join(alerts.keys()) + LOGGER.info("No change in alerts.") + LOGGER.info("Current alerts: %s.", current_alerts) else: - state["last_alerts"] = alerts - save_state(state) + LOGGER.debug("No change in alerts.") if __name__ == "__main__": diff --git a/UpdateSWP.py b/UpdateSWP.py index 55fdc62..ca2db2a 100644 --- a/UpdateSWP.py +++ b/UpdateSWP.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 """ -SkywarnPlus Updater v0.4.3 by Mason Nelson +SkywarnPlus Updater v0.4.2 by Mason Nelson =============================================================================== Script to update SkywarnPlus to the latest version. This script will download the latest version of SkywarnPlus from GitHub, and then merge the existing diff --git a/config.yaml b/config.yaml index afe120a..098c7ef 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,4 @@ -# SkywarnPlus v0.4.3 Configuration File +# SkywarnPlus v0.4.2 Configuration File # Author: Mason Nelson (N5LSN/WRKF394) # Please edit this file according to your specific requirements.