X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Fwidgets.sh;h=61a6938d9d96ec0f2e712c80a2be734140b5c763;hp=376199efe24397931c22c921de5b2f271d32678c;hb=0419aadded163a6d4e00b700cab7794e3bd81ee4;hpb=79a7bb3560f305a48ecd2b2f2b9957c206fa6792 diff --git a/cards/widgets.sh b/cards/widgets.sh index 376199e..61a6938 100755 --- a/cards/widgets.sh +++ b/cards/widgets.sh @@ -19,6 +19,19 @@ list_categories() { grep -vxE '^[ ]*$' "${_DATA}/mappings/categories" } +list_courses() { + local file name cachefile="${_DATA}/cache/courses.ui.cache" + if [ $cachefile -nt "${_DATA}/ical" ]; then + cat "$cachefile" + else + for file in "$_DATA/ical"/*.ics; do + name="$(pdi_value "$(pdi_load "$file")" SUMMARY || l10n "(unnamed course)" |unescape |HTML)" + printf '%s/%s\n' "${file##*/}" "$name" + done \ + | sort -t/ -k2 |tee "$cachefile" + fi +} + w_filter_item() { n=$3 cat <