diff options
Diffstat (limited to 'readme_en.md')
-rw-r--r-- | readme_en.md | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/readme_en.md b/readme_en.md new file mode 100644 index 0000000..90d31ca --- /dev/null +++ b/readme_en.md @@ -0,0 +1,53 @@ +# trein + +janky python scripts for putting dutch public-transit stuff in your calendar +using python, fcgiwrap and nginx + +`storingen.py` creates an ical file with current service disriptions affecting +certain route sections + +`autoplanner.py` takes an ical schedule as input, and uses the NS API to get +trip advice for the first event of each day in the input schedule + +## setup + +### service disriptions + +`storingen.py` requires an NS API key, which is stored as plain-text in +`storingen.key`. + +station names are on seperate lines in `storingen.cfg`. an example file is +included in this repo. + +### autoplanner + +this one uses the public trip planner on the NS website to request trip advice +from the API. because this is not an officially supported way to use the API, +this script might break in the future. + +`autoplanner.py` expects a file `autoplanner.json`, containing to/from location +coordinates, and reads the input ical schedule from stdin. an example format of +`autoplanner.json` file is included in `autoplanner.def.json`. + +script call example (edit `autoplanner.fcgi` for server use): + +```bash +./autoplanner.py < schedule.ics +# or +curl https://schedule.provider/schedule.ics | ./autoplanner.py +``` + +### nginx + +here's an example nginx config snippet (valid in server block) for calling +these scripts on certain endpoints: + +```nginx +location /ical/trein.ics { + gzip off; + autoindex on; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME /var/trein/storingen.fcgi; +} +``` |