From ac94486c8055ba34bafbcce7f49acbad82588ae6 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 28 Jun 2020 11:42:33 -0400 Subject: [PATCH] show date diff on schedule command --- bot.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot.sh b/bot.sh index 51a8378..1290084 100644 --- a/bot.sh +++ b/bot.sh @@ -182,7 +182,8 @@ do json=$(curl -s "https://radio.tildeverse.org/api/station/1/schedule?rows=1" | jq ".[]") nextdj=$(jq -r .name <<< "$json") nexttime=$(LANG=C TZ=UTC date -d "$(jq -r .start <<< "$json")") - msg "$from" "$schedule - $nextdj will be on at $nexttime" + timediff=$(TZ=UTC awk -v d="$nexttime" 'BEGIN { then=mktime(d); now=systime(); print strftime("%Hh %Mm", then - now); }') + msg "$from" "$schedule - $nextdj will be on at $nexttime (in $timediff)" ;; help)