summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xwetter10
1 files changed, 6 insertions, 4 deletions
diff --git a/wetter b/wetter
index 0114305..6f5ac19 100755
--- a/wetter
+++ b/wetter
@@ -5,7 +5,7 @@
# wetter - client for api.weather.mg
#
# SYNOPSIS
-# wetter [LONGITUDE,LATITUDE]
+# wetter [LATITUDE,LONGITUDE]
#
# ENVIRONMENT
# WETTER_CACHE_DIR (default: $XDG_CACHE_HOME/wetter or nothing)
@@ -23,12 +23,12 @@
set -efu
-# main [LONGITUDE,LATITUDE]
+# main [LATITUDE,LONGITUDE]
main() {
- locatedAt=${WETTER_LOCATION-13.42013,52.51297} # default: c-base
+ location_spec=${WETTER_DEFAULT_LOCATION-52.51297,13.42013} # default: c-base
if test $# = 1; then
- locatedAt=$1
+ location_spec=$1
fi
token_url=${WETTER_TOKEN_URL-https://api.weatherpro.com/v1/token/weather}
@@ -62,6 +62,8 @@ main() {
join(",")
')
+ locatedAt=$(echo "$location_spec" | awk -F, '{print$2","$1}')
+
validFrom=$(date -d 'TZ="Europe/Berlin" - 48 hours' --utc +'%Y-%m-%dT%H:%M:%S.%3NZ')
validUntil=$(date -d "TZ=\"Europe/Berlin\" + $(( 5 * 24 )) hours" --utc +'%Y-%m-%dT%H:%M:%S.%3NZ')