summaryrefslogtreecommitdiff
path: root/import-kirchenmusik
diff options
context:
space:
mode:
Diffstat (limited to 'import-kirchenmusik')
-rwxr-xr-ximport-kirchenmusik72
1 files changed, 72 insertions, 0 deletions
diff --git a/import-kirchenmusik b/import-kirchenmusik
index 95589b3..0645665 100755
--- a/import-kirchenmusik
+++ b/import-kirchenmusik
@@ -1,5 +1,8 @@
#!/bin/bash
+tmp_file=$(mktemp)
+trap 'rm -f "${tmp_file}"' EXIT
+
printf '%s %s %s\n' \
'oratorienchor' 'Erich' '' \
'thueringer-saengerknaben' 'Familie' 'K: ' \
@@ -10,8 +13,77 @@ printf '%s %s %s\n' \
| while read -r url; do
curl -Ss "${url%/}/?ical=1" \
| sed '
+ /^BEGIN:VTIMEZONE\s*$/,/^END:VTIMEZONE\s*$/ w'"${tmp_file}"'
s@^SUMMARY:@\0'"${Extra}"'@
' \
| khal import -a "${Kalender}" --batch
done
done
+
+{
+ cat <<EOF
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:PUBLISH
+$(cat "${tmp_file}")
+EOF
+
+ curl -Ss 'https://kirchenmusik-saalfeld.de/termine-dienste/stimmbildung/' \
+ | sed -n '
+ /^<p><strong>/ {
+ s@^\(<p><strong>[^<>]\+</strong>\)\(<br>[^<>]\+\)\(<br>\)@\1\2\n\1\3@
+ P
+ D
+ p
+ }
+ ' \
+ | grep Kasimir \
+ | sed -n '
+ s@^<p><strong>\S\+, @@
+ T
+ s@</strong><br>@ @
+ T
+ s@ \&#8211; @ @
+ T
+ s@Uhr .*$@@
+ T
+ p
+ ' \
+ | sed "$(
+ for m in {01..12}; do
+ printf 's@\\b%s\\b@%s@\n' \
+ "$(date -d "2022-${m}-01" '+%B')" \
+ "${m}"
+ done
+ )"'
+ s/://g
+ ' \
+ | while read -r tag monat von bis; do
+ tag="${tag%.}"
+ jahr=$(date '+%Y')
+ while [ $(($(date '+%s')-60*60*24*100)) -gt $(date -d "${jahr}-${monat}-${tag}" '+%s') ]; do
+ jahr=$((jahr+1))
+ done
+
+ cat <<EOF
+BEGIN:VEVENT
+DTSTART;TZID=Europe/Berlin:${jahr}${monat}${tag}T${von}00
+DTEND;TZID=Europe/Berlin:${jahr}${monat}${tag}T${bis}00
+DTSTAMP:$(date '+%+4Y%m%dT%H%M%S')
+CREATED:$(date '+%+4Y%m%dT%H%M%S')
+LAST-MODIFIED:$(date '+%+4Y%m%dT%H%M%S')
+UID:$(echo "${jahr} ${monat} ${tag} ${von} ${bis}" | sha256sum | awk '{print $1}')
+SUMMARY:K: Stimmbildung
+LOCATION:Kantorat\, Kirchplatz 2\, Saalfeld\, 07318\, Deutschland
+END:VEVENT
+EOF
+
+ done
+
+ cat <<EOF
+END:VCALENDAR
+EOF
+
+} \
+| khal import -a "Familie" --batch