Fixed variable error with HTML/Openbox forecast output

pull/2/head
Steven Saus 5 years ago
parent deb0443a94
commit 2f8235057c
  1. 71
      forecast.sh

@ -205,7 +205,6 @@ while true; do
let i=0 let i=0
while [ $i -lt 40 ]; do while [ $i -lt 40 ]; do
CastDate=$(date +"%s" -d @${NixDate[$i]}) CastDate=$(date +"%s" -d @${NixDate[$i]})
#CastDate=$(date +"%m%d" -d @${NixDate[$i]})
if [ $CastDate -le $TomorrowDate ]; then if [ $CastDate -le $TomorrowDate ]; then
ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]}) ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]})
if [ "$colors" = "True" ]; then if [ "$colors" = "True" ]; then
@ -226,46 +225,46 @@ while true; do
fi fi
i=$((i + 1)) i=$((i + 1))
done done
fi fi
if [ "$OpenBox" = "True" ]; then if [ "$OpenBox" = "True" ]; then
echo '<openbox_pipe_menu>' echo '<openbox_pipe_menu>'
echo '<separator label="Forecast" />' echo '<separator label="Forecast" />'
printf '<item label="Forecast for %s as of %s" />\n' "$Station" "$AsOf" printf '<item label="Forecast for %s as of %s" />\n' "$Station" "$AsOf"
let i=0 let i=0
while [ $i -lt 40 ]; do while [ $i -lt 40 ]; do
CastDate=$(date +"%m%d" -d @${NixDate[$i]}) CastDate=$(date +"%s" -d @${NixDate[$i]})
if [ $CastDate = $NowDate ]; then if [ $CastDate -le $TomorrowDate ]; then
ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]})
printf '<item label="%-12s %-2s%-20s %-15s %-14s %-14s %-14s/>\n' "$ShortDate:" "${icon[$i]} " "${LongWeather[$i]}" "Temp:${temperature[$i]}°${degreeCharacter^^}" "Wind:${WindSpeed[$i]}$windunit" "Humidity:${Humidity[$i]}%" "Cloud Cover:${CloudCover[$i]}%"
else
CastHour=$(date +"%-H" -d @${NixDate[$i]})
if [ "$CastHour" -ge "$NowHigh" ] && [ "$CastHour" -le "$NowLow" ]; then
ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]}) ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]})
printf '<item label="%-12s %-2s%-20s %-15s %-14s %-14s %-14s/>\n' "$ShortDate:" "${icon[$i]} " "${LongWeather[$i]}" "Temp:${temperature[$i]}°${degreeCharacter^^}" "Wind:${WindSpeed[$i]}$windunit" "Humidity:${Humidity[$i]}%" "Cloud Cover:${CloudCover[$i]}%" printf '<item label="%-12s %-2s%-20s %-15s %-14s %-14s %-14s/>\n' "$ShortDate:" "${icon[$i]} " "${LongWeather[$i]}" "Temp:${temperature[$i]}°${degreeCharacter^^}" "Wind:${WindSpeed[$i]}$windunit" "Humidity:${Humidity[$i]}%" "Cloud Cover:${CloudCover[$i]}%"
else
CastHour=$(date +"%-H" -d @${NixDate[$i]})
if [ "$CastHour" -ge "$NowHigh" ] && [ "$CastHour" -le "$NowLow" ]; then
ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]})
printf '<item label="%-12s %-2s%-20s %-15s %-14s %-14s %-14s/>\n' "$ShortDate:" "${icon[$i]} " "${LongWeather[$i]}" "Temp:${temperature[$i]}°${degreeCharacter^^}" "Wind:${WindSpeed[$i]}$windunit" "Humidity:${Humidity[$i]}%" "Cloud Cover:${CloudCover[$i]}%"
fi
fi fi
fi i=$((i + 1))
i=$((i + 1)) done
done echo '</openbox_pipe_menu>'
echo '</openbox_pipe_menu>' fi
fi if [ "$HTML" = "True" ];then
if [ "$HTML" = "True" ];then echo "Forecast for $Station as of: $AsOf <br />"
echo "Forecast for $Station as of: $AsOf <br />" let i=0
let i=0 while [ $i -lt 40 ]; do
while [ $i -lt 40 ]; do CastDate=$(date +"%s" -d @${NixDate[$i]})
CastDate=$(date +"%m%d" -d @${NixDate[$i]}) if [ $CastDate -le $TomorrowDate ]; then
if [ $CastDate = $NowDate ]; then
ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]})
printf "%-12s %-2s%-20s %-15s %-14s %-14s %-14s<br />\n" "$ShortDate:" "${icon[$i]} " "${LongWeather[$i]}" "Temp:${temperature[$i]}°${degreeCharacter^^}" "Wind:${WindSpeed[$i]}$windunit" "Humidity:${Humidity[$i]}%" "Cloud Cover:${CloudCover[$i]}%"
else
CastHour=$(date +"%-H" -d @${NixDate[$i]})
if [ "$CastHour" -ge "$NowHigh" ] && [ "$CastHour" -le "$NowLow" ]; then
ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]}) ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]})
printf "%-12s %-2s%-20s %-15s %-14s %-14s %-14s<br />\n" "$ShortDate:" "${icon[$i]} " "${LongWeather[$i]}" "Temp:${temperature[$i]}°${degreeCharacter^^}" "Wind:${WindSpeed[$i]}$windunit" "Humidity:${Humidity[$i]}%" "Cloud Cover:${CloudCover[$i]}%" printf "%-12s %-2s%-20s %-15s %-14s %-14s %-14s<br />\n" "$ShortDate:" "${icon[$i]} " "${LongWeather[$i]}" "Temp:${temperature[$i]}°${degreeCharacter^^}" "Wind:${WindSpeed[$i]}$windunit" "Humidity:${Humidity[$i]}%" "Cloud Cover:${CloudCover[$i]}%"
fi else
fi CastHour=$(date +"%-H" -d @${NixDate[$i]})
i=$((i + 1)) if [ $CastHour -ge $NowHigh ] && [ $CastHour -le $NowLow ]; then
done ShortDate=$(date +"%m/%d@%R" -d @${NixDate[$i]})
fi printf "%-12s %-2s%-20s %-15s %-14s %-14s %-14s<br />\n" "$ShortDate:" "${icon[$i]} " "${LongWeather[$i]}" "Temp:${temperature[$i]}°${degreeCharacter^^}" "Wind:${WindSpeed[$i]}$windunit" "Humidity:${Humidity[$i]}%" "Cloud Cover:${CloudCover[$i]}%"
fi
fi
i=$((i + 1))
done
fi
if [ $dynamicUpdates -eq 0 ];then if [ $dynamicUpdates -eq 0 ];then
break break
fi fi

Loading…
Cancel
Save