Jasper Bok 287ebdcea4 | ||
---|---|---|
assets | ||
static | ||
.gitignore | ||
README.md | ||
TODO | ||
bus.go | ||
config.go | ||
config.toml.example | ||
go.mod | ||
go.sum | ||
index.html | ||
main.go | ||
quay.go | ||
route.go | ||
server.go | ||
utils.go |
README.md
Bus Departures
Display bus departures for specific routes on specific stops.
Usage:
./busdepartures -c=CONFIGFILE [ -p=PORT]
Configuration
The configuration file describes the list of quays (or stops) and the routes for each quay that you're interested in. Each quay in your configuration should look something like this:
[[quays]]
id = "NL:Q:40004001"
name = "Centraal Station"
town = "Arnhem"
routes_of_interest = [
{"short_name" = "51", "long_name" = "Wageningen"},
{"short_name" = "352", "long_name" = "Wageningen"},
]
Note that the [[quay]]
syntax is TOML's way of describing a list, meaning you
can keep repeating the example above in your configuration to add multiple
quays. If you would like an example, see the config.toml.example
file. It
lists multiple quays.
Finding the information required for configuration
- Open the Connexxion halte-informatie page.
- Open your browser's developer tooling and go to the 'network' tab.
- Search for your stop on the website and open it.
- In the network tab, there should be a request labeled 'departures'. Open it.
The response is in JSON format and contains all the information you need.
- The quay ID is almost exactly the
stopid
, just replace the:S:
with:Q:
. - The
name
andtown
are just below the quay ID. - All the route information you'll need is available in the
departures
key.departures.X.tripdata.route.route_short_name
is what you'll enter as theshort_name
.departures.stop_headsign
is what you'll enter as thelong_name
.
And that's it. Add the information you found to your config.toml
, as described
above and start the application.