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 #!/bin/sh
while true; do 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 sleep 600
done done

View File

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