projects
/
weather.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
af69553
)
Use regex for alert content smart filter
author
Jeremy Stanley
<fungi@yuggoth.org>
Sat, 11 May 2024 00:55:30 +0000
(
00:55
+0000)
committer
Jeremy Stanley
<fungi@yuggoth.org>
Sat, 11 May 2024 00:55:30 +0000
(
00:55
+0000)
This function is going to need the re module for more complex tasks
shortly, so go ahead and start using it for this too.
weather.py
patch
|
blob
|
history
diff --git
a/weather.py
b/weather.py
index
8df769e
..
62f73da
100644
(file)
--- a/
weather.py
+++ b/
weather.py
@@
-336,10
+336,11
@@
def get_alert(
if alert:
if verbose: return alert
else:
- if alert.find("\nNational Weather Service") == -1:
- muted = False
- else:
+ import re
+ if re.search(r"\nNational Weather Service", alert):
muted = True
+ else:
+ muted = False
lines = alert.split("\n")
import time
# TODO: make this offset configurable