handle missing weather data
This commit is contained in:
parent
93364f4be7
commit
f012b3ea4a
|
@ -4,6 +4,9 @@ while true; do
|
|||
time=`date +"🕑 %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'`
|
||||
|
@ -13,7 +16,7 @@ while true; do
|
|||
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
|
||||
xsetroot -name "$weather $time "
|
||||
sleep 10
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue
Block a user