X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Fwidgets.sh;h=c0c05946b1c594272d034a33081e351444873df9;hp=5fbf125b746b06fdc7c58868a2f0ffc5470abef7;hb=5b8d1b752ede7a6dc4250620ca58971447570a76;hpb=11e258b8e6cf832c96b20648aa8c9ca0288c597f diff --git a/cards/widgets.sh b/cards/widgets.sh index 5fbf125..c0c0594 100755 --- a/cards/widgets.sh +++ b/cards/widgets.sh @@ -1,4 +1,4 @@ -# Copyright 2014 - 2019 Paul Hänsch +# Copyright 2014 - 2019, 2021 Paul Hänsch # # This file is part of Confetti. # @@ -19,27 +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 |HTML)" + printf '%s %s\n' "$file" "$name" + done \ + | sort -k2 |tee "$cachefile" + fi +} + w_filter_item() { n=$3 cat <