diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2024-04-28 19:25:12 -0700 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2024-04-28 19:25:12 -0700 |
commit | 7b0570e094944d86fe44660452f551813f151c92 (patch) | |
tree | 1094335488bb7415debb64d59938c24e3f65a41c /sh/wtr | |
parent | 61e1aae0aa39061169ca265ca171ec66b48a5fcc (diff) |
wtr no need query sunrise sunset, use new sun alias instead
Diffstat (limited to 'sh/wtr')
-rwxr-xr-x | sh/wtr | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -1,8 +1,7 @@ #!/bin/sh # https://github.com/open-meteo/open-meteo -i=0 -curl -s -G -d "latitude=${1:-37.34}" -d "longitude=${2:--121.89}" -d 'daily=weathercode,temperature_2m_max,temperature_2m_min,sunrise,sunset' -d 'timezone=auto' 'https://api.open-meteo.com/v1/forecast' | jq -r '[.daily|.time, .weathercode, .temperature_2m_max, .temperature_2m_min, .sunrise, .sunset]|transpose|.[]|@tsv' | while read -r time code max min sunrise sunset; do +curl -s -G -d "latitude=${1:-37.34}" -d "longitude=${2:--121.89}" -d 'daily=weathercode,temperature_2m_max,temperature_2m_min' -d 'timezone=auto' 'https://api.open-meteo.com/v1/forecast' | jq -r '[.daily|.time, .weathercode, .temperature_2m_max, .temperature_2m_min]|transpose|.[]|@tsv' | while read -r time code max min; do # https://open-meteo.com/en/docs case "$code" in 0) code='clear sky';; @@ -35,9 +34,5 @@ curl -s -G -d "latitude=${1:-37.34}" -d "longitude=${2:--121.89}" -d 'daily=weat 99) code='thunderstorm with heavy hail';; *) exit 1;; esac - if [ "$i" -ne 1 ]; then - printf 'sunrise: %s | sunset: %s\n' "${sunrise#*T}" "${sunset#*T}" - i=1 - fi printf '%s\t%s\t%s\t%s\n' "${time#*-}" "$max" "$min" "$code" done |