X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Fwidgets.sh;h=eb9d0fde95cb88f6bba42282e4b7738467f74047;hp=52fca4e25e9b9e52e8fd9df0cb526fd1e5f896e6;hb=07454834f9d0291be5e652eef5f62c889331d695;hpb=3a37ee43475797d728772ccb0633eb87979cd218 diff --git a/cards/widgets.sh b/cards/widgets.sh index 52fca4e..eb9d0fd 100755 --- a/cards/widgets.sh +++ b/cards/widgets.sh @@ -19,26 +19,47 @@ 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 <