add nextcloud public calendar export

This commit is contained in:
Ludwig Behm 2023-10-19 23:29:05 +02:00
parent 01fcc976ba
commit 8e9e6d37fc
Signed by: l.behm
GPG key ID: D344835D63B89384
4 changed files with 27 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
events.json

View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
curl -sH "Accept: application/calendar+json" "https://cloud.kraut.space/remote.php/dav/public-calendars/2EkPGt3PF6WwYsA3?export&expand=1&start=$(date -d "" +%s)&end=$(date -d "next month" +%s)" \
| jq -r '.[2] | map({_type: .[0]} + (.[1] | map({key: .[0], value: .[3]}) | from_entries))' \
> ./events.json

View file

@ -0,0 +1,12 @@
[Unit]
Description=Dumps calendar events from nextcloud into usable json
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/bash /var/www/kraut.space/bin/calendar-events-exporter.sh
User=www-data
Group=www-data
WorkingDirectory=/var/www/kraut.space

View file

@ -0,0 +1,9 @@
[Unit]
Description=timer for automatic refresh of calendar export
[Timer]
# execute at the second minute of every hour, and repeat every 5 minutes
OnCalendar=*:2/5
[Install]
WantedBy=timers.target