Add motdmb.sh
This commit is contained in:
parent
3da98411c3
commit
de53dbbca8
1 changed files with 23 additions and 0 deletions
23
motdmb.sh
Normal file
23
motdmb.sh
Normal 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
|
||||||
Loading…
Reference in a new issue