Use regex for alert content smart filter

This function is going to need the re module for more complex tasks
shortly, so go ahead and start using it for this too.
This commit is contained in:
Jeremy Stanley
2024-05-11 00:55:30 +00:00
parent af6955376b
commit c9bc48f456

View File

@@ -336,10 +336,11 @@ def get_alert(
if alert: if alert:
if verbose: return alert if verbose: return alert
else: else:
if alert.find("\nNational Weather Service") == -1: import re
muted = False if re.search(r"\nNational Weather Service", alert):
else:
muted = True muted = True
else:
muted = False
lines = alert.split("\n") lines = alert.split("\n")
import time import time
# TODO: make this offset configurable # TODO: make this offset configurable