[download]
local/bin/weather
1
2
3 f=~/.cache/weather
4
5 (( $(date +%s) - $(date -r $f +%s) < 60 * 5 )) && cat $f && exit
6
7 IFS=, read icon weather desc < <(curl -s 'https://wttr.in/spb?lang=ru&format=%c,%t,%C')
8 [[ ! $icon || $icon == Unknown* ]] && cat $f && exit
9
10 echo $icon > $f.ico
11 echo "$weather ${desc,,}" | tee $f
12 printf '<svg><text font-family="Emoji"
13 y="30" font-size="32">%s</text></svg>' $icon > $f.svg
|