changed weather info from wttr.in to wetter.upb.de, since wttr.in was absolutely off and useless

This commit is contained in:
gutmet 2021-03-31 10:29:15 +02:00
parent cec41fd490
commit a9a8c789a9
2 changed files with 8 additions and 11 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
while true; do
curl "wttr.in/Paderborn?m&format=j1" > weatherdump 2>/dev/null
curl "http://wetter.upb.de/handy.html" 2>/dev/null | iconv -f "iso8859-1" -t utf-8 | sed -e 's/<[^>]*>//g' > weatherdump
sleep 600
done

View File

@ -1,21 +1,18 @@
#!/bin/sh
while true; do
time=`date +"🕑 %d.%m. %H:%M"`
time=`date +"🕑 %a %d.%m. %H:%M"`
weatherdata=`cat weatherdump`
if [ -z "$weatherdata" ]; then
weather="No weather data..."
else
current=`echo "$weatherdata" | jq -r '.current_condition | .[0]'`
temp=`echo "$current" | jq -r '.temp_C'`
weatherDesc=`echo "$current" | jq -r '.weatherDesc | .[0].value'`
wind=`echo "$current" | jq -r '.windspeedKmph'`
astronomy=`echo "$weatherdata" | jq -r '.weather | .[0] .astronomy | .[0]'`
moonphase=`echo "$astronomy" | jq -r '.moon_phase'`
sunrise=`echo "$astronomy" | jq -r '.sunrise'`
sunset=`echo "$astronomy" | jq -r '.sunset'`
weather="🌡 $temp°C $weatherDesc $wind""km/h Daylight $sunrise-$sunset, Moon $moonphase"
temp=`echo "$weatherdata" | grep "Temp:" | awk '{print $2}'`
humidity=`echo "$weatherdata" | grep "Luftfeuchte:" | awk '{print $2}'`
wind=`echo "$weatherdata" | grep "Windst&auml;rke:" | awk '{print $(NF-1)}'`
sunrise=`echo "$weatherdata" | grep "Sonnenaufgang:" | awk '{print $2}'`
sunset=`echo "$weatherdata" | grep "Sonnenuntergang:" | awk '{print $2}'`
weather="🌡 $temp°C ☔ $humidity% ↗ $wind""km/h ☀ $sunrise-$sunset"
fi
xsetroot -name "$weather $time "
sleep 10