diff --git a/motdmb.sh b/motdmb.sh new file mode 100644 index 0000000..d61d945 --- /dev/null +++ b/motdmb.sh @@ -0,0 +1,23 @@ +## (install chafa) +function motd() { + mensen=(32) + for mensa in "${mensen[@]}"; do + curl -s https://api.studentenwerk-dresden.de/openmensa/v2/canteens/$mensa | jq -r .name + while read meal; do + name=$(echo "$meal" | awk -F '$' '{print $1}') + price=$(echo "$meal" | awk -F '$' '{print $2}') + image=$(echo "$meal" | awk -F '$' '{print $3}') + + echo "$price € $name" + + if [[ -n "$image" && "$image" != "null" ]]; then + curl -s "https:$image" | chafa --size=60x15 + fi + + done < <(curl -s https://api.studentenwerk-dresden.de/openmensa/v2/canteens/$mensa/days/$(date "+%Y-%m-%d")/meals \ + | jq -r '.[] | "\(.name)$\(.prices.Studierende)$\(.image)$\(.notes)"' \ + | grep -E "vegan|vegetarisch" \ + | grep -v suppe) + done +} +motd \ No newline at end of file