more descriptive weather

This commit is contained in:
Cyryl Płotnicki 2022-04-07 22:33:40 +01:00
parent 36fd84f2f2
commit c34c07fa91

View file

@ -78,6 +78,7 @@ if [ -n "$current" ] && [ -n "$forecast" ]; then
current_temp=$(echo "$current" | $JQ ".main.temp" | $CUT -d "." -f 1)
current_feels=$(echo "$current" | $JQ ".main.feels_like" | $CUT -d "." -f 1)
current_icon=$(echo "$current" | $JQ -r ".weather[0].icon")
current_text=$(echo "$current" | $JQ -r ".weather[0].description")
forecast_temp=$(echo "$forecast" | $JQ ".list[].main.temp" | $CUT -d "." -f 1)
forecast_feels=$(echo "$forecast" | $JQ ".list[].main.feels_like" | $CUT -d "." -f 1)
@ -85,12 +86,12 @@ if [ -n "$current" ] && [ -n "$forecast" ]; then
if [ "$current_temp" -gt "$forecast_temp" ]; then
trend=""
trend="getting colder"
elif [ "$forecast_temp" -gt "$current_temp" ]; then
trend=""
trend="getting warmer"
else
trend=""
trend="stable weather"
fi
echo "$(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL $trend $(get_icon "$forecast_icon") $forecast_temp($forecast_feels)$SYMBOL"
echo "now $(get_icon "$current_icon") $current_text $current_temp($current_feels)$SYMBOL, $trend, later $(get_icon "$forecast_icon") $forecast_temp($forecast_feels)$SYMBOL"
fi