X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Fwidgets.sh;h=463a64814cf0afaa8dd72e74fe23bbca8a9a2fa0;hp=5395a8299a326f424e4b2909700f36c9911d3011;hb=625d391932052a4d1514c754b1262b5791207474;hpb=6217c300314dd5791995c9bb7e148c3752d2d3d1 diff --git a/cards/widgets.sh b/cards/widgets.sh index 5395a82..463a648 100755 --- a/cards/widgets.sh +++ b/cards/widgets.sh @@ -19,27 +19,48 @@ 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 |HTML)" + printf '%s %s\n' "$file" "$name" + done \ + | sort -k2 |tee "$cachefile" + fi +} + w_filter_item() { n=$3 cat <