summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfilip <“filip.rabiega@gmail.com”>2026-01-21 13:10:55 +0100
committerfilip <“filip.rabiega@gmail.com”>2026-01-21 13:10:55 +0100
commit4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a (patch)
tree97a4a5fbbb1f8ae7a09070cd7df7927de27244a6
parent88f0243428c4cf39029c8ffc5a7e1634951158a0 (diff)
downloadchadscripts-4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a.tar.gz
chadscripts-4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a.tar.bz2
chadscripts-4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a.zip
wrocwttr rewrite
-rwxr-xr-xwrocwttr16
1 files changed, 9 insertions, 7 deletions
diff --git a/wrocwttr b/wrocwttr
index 4aa5b3a..dccb1cc 100755
--- a/wrocwttr
+++ b/wrocwttr
@@ -1,12 +1,14 @@
#!/bin/sh
+# Check the temperature in Wrocław, Poland
-# export DISPLAY=:0.0
-# export HOME=/home/filipek
+CITY="Wroc%C5%82aw"
+CACHE_DIR="$HOME/.cache/weather"
+FILE="$CACHE_DIR/wroc.txt"
-# ł is URL-encoded
-temp=$(curl "wttr.in/Wroc%C5%82aw?format=1" | awk '{print $2}')
-file="$HOME/.cache/weather/wroc.txt"
+mkdir -p "$CACHE_DIR"
+
+temp="$(curl -fsS --max-time 5 -A "wrocwttr/1.0" \
+ "https://wttr.in/$CITY?format=%t")" || exit 1
[ -z "$temp" ] && exit 1
-echo "$temp" > "$file"
-# notify-send "Temperature updated."
+echo "$temp" > "$FILE"