Add motdmb.sh

This commit is contained in:
denode 2026-03-23 13:10:39 +01:00
parent 3da98411c3
commit de53dbbca8

23
motdmb.sh Normal file
View file

@ -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