show place name in the weather bar
This commit is contained in:
parent
372536d398
commit
d116b12827
1 changed files with 4 additions and 10 deletions
|
@ -71,6 +71,9 @@ else
|
||||||
|
|
||||||
current=$($CURL "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
|
current=$($CURL "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
|
||||||
forecast=$($CURL "$API/forecast?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS&cnt=1")
|
forecast=$($CURL "$API/forecast?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS&cnt=1")
|
||||||
|
place=$($CURL "https://nominatim.openstreetmap.org/reverse?lat=$location_lat&lon=$location_lon&format=jsonv2")
|
||||||
|
suburb=$(echo "$place" | $JQ -r ".address.suburb")
|
||||||
|
city=$(echo "$place" | $JQ -r ".address.city")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -84,15 +87,6 @@ if [ -n "$current" ] && [ -n "$forecast" ]; then
|
||||||
forecast_feels=$(echo "$forecast" | $JQ ".list[].main.feels_like" | $CUT -d "." -f 1)
|
forecast_feels=$(echo "$forecast" | $JQ ".list[].main.feels_like" | $CUT -d "." -f 1)
|
||||||
forecast_icon=$(echo "$forecast" | $JQ -r ".list[].weather[0].icon")
|
forecast_icon=$(echo "$forecast" | $JQ -r ".list[].weather[0].icon")
|
||||||
|
|
||||||
if [ "$current_temp" -gt "$forecast_temp" ]; then
|
echo "$suburb, $city: $current_text $(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL => $(get_icon "$forecast_icon") $forecast_temp($forecast_feels)$SYMBOL"
|
||||||
trend="getting colder"
|
|
||||||
echo "[$location_lat, $location_lon]: $current_text $(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL => $(get_icon "$forecast_icon") $forecast_temp($forecast_feels)$SYMBOL"
|
|
||||||
elif [ "$forecast_temp" -gt "$current_temp" ]; then
|
|
||||||
trend="getting warmer"
|
|
||||||
echo "[$location_lat, $location_lon]: $current_text $(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL => $(get_icon "$forecast_icon") $forecast_temp($forecast_feels)$SYMBOL"
|
|
||||||
else
|
|
||||||
trend="stable weather"
|
|
||||||
echo "[$location_lat, $location_lon]: $current_text $(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue