From 7b0570e094944d86fe44660452f551813f151c92 Mon Sep 17 00:00:00 2001
From: Xiao Pan <gky44px1999@gmail.com>
Date: Sun, 28 Apr 2024 19:25:12 -0700
Subject: wtr no need query sunrise sunset, use new sun alias instead

---
 sh/wtr | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

(limited to 'sh/wtr')

diff --git a/sh/wtr b/sh/wtr
index c9907d9..5b385d6 100755
--- a/sh/wtr
+++ b/sh/wtr
@@ -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
-- 
cgit v1.2.3-70-g09d2