New backup 2024-04-24 14:30:03
This commit is contained in:
parent
55ecd1fc03
commit
8561a3726d
1 changed files with 17 additions and 3 deletions
|
@ -7,13 +7,27 @@ current_f=$( jq -r '.current_condition.[].FeelsLikeF' <<< ${jweather} )
|
||||||
high_f=$( jq -r '.weather.[0].maxtempF' <<< ${jweather} )
|
high_f=$( jq -r '.weather.[0].maxtempF' <<< ${jweather} )
|
||||||
low_f=$( jq -r '.weather.[0].mintempF' <<< ${jweather} )
|
low_f=$( jq -r '.weather.[0].mintempF' <<< ${jweather} )
|
||||||
weather_desc=$( jq -r '.current_condition.[].weatherDesc.[].value' <<< ${jweather} )
|
weather_desc=$( jq -r '.current_condition.[].weatherDesc.[].value' <<< ${jweather} )
|
||||||
forecast=""
|
hourly_forecast=""
|
||||||
|
daily_forecast=""
|
||||||
|
|
||||||
|
current_hour=$( date +'%H' )
|
||||||
|
echo $current_hour
|
||||||
|
|
||||||
|
for h in {0..7};do
|
||||||
|
check_hour=$( date -d $( jq -r --argjson h ${h} '.weather.[0].hourly.[$h].time' <<< ${jweather} ) +'%H' )
|
||||||
|
if [[ ${check_hour#0} -ge ${current_hour#0} ]];then
|
||||||
|
echo "future"
|
||||||
|
hourly_forecast="${hourly_forecast}\n${check_hour}"$( jq -r --argjson h ${h} '.weather.[0].hourly.[$h]..FeelsLikeF' <<< ${jweather} )
|
||||||
|
fi
|
||||||
|
# hourly_forecast="${forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": High "$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F, Low"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F"
|
||||||
|
done
|
||||||
|
exit
|
||||||
for d in {1..2};do
|
for d in {1..2};do
|
||||||
forecast="${forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": High "$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F, Low"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F"
|
daily_forecast="${forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": High "$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F, Low"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F"
|
||||||
done
|
done
|
||||||
|
|
||||||
forecast=$( echo -e $forecast ) # | sed '/^[[:space:]]*$/d' )
|
forecast=$( echo -e $forecast ) # | sed '/^[[:space:]]*$/d' )
|
||||||
|
|
||||||
notify-send "${weather_desc}, ${current_f}°F
|
notify-send "${weather_desc}, ${current_f}°F
|
||||||
High: ${high_f}°F | Low: ${low_f}°F
|
High: ${high_f}°F | Low: ${low_f}°F
|
||||||
${forecast}"
|
${daily_forecast}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue