coding/motdmb.sh
denode 377b92f89e Update motdmb.sh
Filter the default "lieber-mensen-gehen" picture, so you just see the food pictures :=)
2026-05-25 11:50:38 +02:00

23 lines
No EOL
965 B
Bash

## (install chafa) (Mensa of the Day mit Bildern)
function motd() {
mensen=(32) #(6 matrix, 25 zelt, 32 johanna)
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" && "$image" != *"lieber-mensen-gehen"*]]; 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