summaryrefslogtreecommitdiffstats
path: root/.local/bin/status/sb-forecast
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-08-18 16:45:33 +0200
committerJoe <bousset.rudy@gmail.com>2022-08-18 16:45:33 +0200
commit6a5ad1ee5b4c08a3c2847f898b0486848df17add (patch)
treecd963d6b0101c83ea346936139c768cfb32ab4b0 /.local/bin/status/sb-forecast
parentfix (diff)
downloaddotfiles-bsd-6a5ad1ee5b4c08a3c2847f898b0486848df17add.tar.gz
dotfiles-bsd-6a5ad1ee5b4c08a3c2847f898b0486848df17add.tar.bz2
dotfiles-bsd-6a5ad1ee5b4c08a3c2847f898b0486848df17add.tar.xz
dotfiles-bsd-6a5ad1ee5b4c08a3c2847f898b0486848df17add.tar.zst
dotfiles-bsd-6a5ad1ee5b4c08a3c2847f898b0486848df17add.zip
Updates
Diffstat (limited to '.local/bin/status/sb-forecast')
-rwxr-xr-x.local/bin/status/sb-forecast16
1 files changed, 10 insertions, 6 deletions
diff --git a/.local/bin/status/sb-forecast b/.local/bin/status/sb-forecast
index 0f7aa52..0ac1a40 100755
--- a/.local/bin/status/sb-forecast
+++ b/.local/bin/status/sb-forecast
@@ -1,18 +1,22 @@
#!/bin/sh
weatherreport="/tmp/weatherreport"
+weatherglyph="/tmp/weatherglyph"
+moonreport="/tmp/moonglyph"
getweather() {
- curl -sf "wttr.in/lyon" >$weatherreport || exit 1
+ curl -sf "wttr.in/Lyon" >$weatherreport || exit 1
+ curl -sf "wttr.in/Lyon?format=%c" >$weatherglyph || exit 1
+ curl -sf "wttr.in/Lyon?format=%m" >$moonglyph || exit 1
}
[ -f $weatherreport ] && [ "$(gnustat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || getweather
-printf "%s" "$(sed '16q;d' "$weatherreport" |
-grep -wo "[0-9]*%" | sort -rn | sed "s/^/ /g;1q" | tr -d '\n')"
+printf "%s %s" \
+ "$(cat $weatherglyph)" \
+ "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/ /g;1q" | tr -d '\n')"
+moon=$(cat $moonreport)
sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' |
sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' |
- awk '{print " ﰕ " $1 "°C"," " $2 "°C"}'
-
-# weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
+ awk -v moon=$moon '{print " ﰕ " $1 "°C"," " $2 "°C " moon}'