ccchh-website/fetch-calendar.sh

10 lines
392 B
Bash
Raw Normal View History

2023-10-20 23:36:39 +02:00
#!/bin/sh
set -eu
ICAL_URL=https://cloud.hamburg.ccc.de/remote.php/dav/public-calendars/6CJcM7XDfoYire5d
START_TIME=$(date -v-1d +%s) # yesterday
END_TIME=$(date -v+1m +%s) # now + 1 month
OUTFILE=data/calendar.json
curl -s $ICAL_URL\?export\&accept=jcal\&expand\=1\&start\=$START_TIME\&end\=$END_TIME | jq '.[2]|map({_type:.[0]}+(.[1]|map({key:.[0],value:.[3]})|from_entries))' > $OUTFILE