From 7e024cb110fedb07978ae4b3e0723b9cbe9b8c07 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 30 Nov 2022 21:46:47 +0100 Subject: import-kirchenmusik: also import Stimmbildung, too --- import-kirchenmusik | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'import-kirchenmusik') 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 </ { + s@^\(

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

\S\+, @@ + T + s@
@ @ + T + s@ \– @ @ + 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 <