Mat!
"What's for lunch" script for restaurants around Grönsakstorget, Gothenburg
Usage
./mat.py -p <plugin directory>
If no plugin directory is specified, $HOME/.mat
is used if it exists.
If it doesn't, ./plugins
is used instead.
Dependencies
- For everything:
algebraic-data-types
- For restaurants with PDF menus (Bee):
PyMuPDF
- For restaurants with JSON "menus" (Jinx):
json
- For all other restaurants:
bs4
- To build website: Pandoc
Troubleshooting
- Not all restaurants show up!
- Make sure you have installed all the above dependencies
(using
pip install <dependency>
or similar). - Some plugins don't support menus for other dates than today.
- Make sure you have installed all the above dependencies
(using
Supported restaurants
Generating an HTML menu
To generate a styled and somewhat interactive HTML menu, use mat.py
and Pandoc
with the provided wrapper script:
./build-site.sh
Contributing
Is your favourite restaurant missing? File a bug report or submit a pull request!
Plugin API
Plugins need to export two functions:
name()
, returning the name of the restaurant as a string, andfood(api, date)
, returning a list ofFood
objects representing the restaurants offerings on the given date.
Food
objects are created using the function
api.food(dish, dish_description)
.
Description may be None
.
For convenience, api
also contains the following:
soup
: reexport ofbs4.BeautifulSoup
if available, otherwiseNone
pdf
: reexport offitz
fromPyMuPDF
if available, otherwiseNone
json
: reexport ofjson
fromjson
if available, otherwiseNone
requests
: reexport ofrequests
is_today(date)
: returnsTrue
ifdate
is today's dateis_current_week(date)
: returnsTrue
ifdate
is in the current weekis_weekday(date)
: returnsTrue
ifdate
is a weekday (ignoring holidays)