#!/bin/bash tmp_file=$(mktemp) trap 'rm -f "${tmp_file}"' EXIT printf '%s %s %s.\n' \ 'oratorienchor' 'Erich' '' \ 'thueringer-saengerknaben' 'Familie' 'K\&F: ' \ | while read -r Chor Kalender Extra; do curl -Ss 'https://kirchenmusik-saalfeld.de/termine-dienste/'"${Chor}"'/' \ | grep '^\[{"@context":"http://schema\.org"' \ | jq -cr '.[].url' \ | 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 </ { s@^\(

[^<>]\+\)\(
[^<>]\+\)\(
\)@\1\2\n\1\3@ P D p } ' \ | sed ' s@\bGerolf\b@Kasimir@g ' \ | sed -n ' s@^

\S\+, @@ T s/^.* \(Kasimir\|Friedrich\)/\1 \0/ T s@
@ @ T s@ \– @ @g 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 wer tag monat von bis; do tag="${tag%.}" jahr=$(($(date '+%Y')-1)) while [ $(($(date '+%s')-60*60*24*100)) -gt $(date -d "${jahr}-${monat}-${tag}" '+%s') ]; do jahr=$((jahr+1)) done while [ ${#tag} -lt 2 ]; do tag="0${tag}" done while [ ${#monat} -lt 2 ]; do monat="0${monat}" done cat <