Webserver that queries bus departure times for different preconfigured stops and displays them on a single page.
 
 
 
Go to file
Jasper Bok 4a4ee88c72 Add 'live departures' task 2023-08-24 22:21:49 +02:00
assets Add the bus icon in aseprite format 2023-08-13 16:13:59 +02:00
static Replace the <dl> with a <table> 2023-08-18 11:26:33 +02:00
.gitignore Add `config.toml` to git ignore patterns 2023-08-24 22:20:48 +02:00
README.md Add documentation about configuring the app 2023-08-24 22:21:11 +02:00
TODO Add 'live departures' task 2023-08-24 22:21:49 +02:00
bus.go Add 'interesting routes' to quays 2023-08-06 23:18:47 +02:00
config.go Add code for reading TOML config files 2023-08-24 21:18:25 +02:00
config.toml.example Add example configuration file 2023-08-24 22:20:36 +02:00
go.mod Add code for reading TOML config files 2023-08-24 21:18:25 +02:00
go.sum Add code for reading TOML config files 2023-08-24 21:18:25 +02:00
index.html Add 'robots' meta tag 2023-08-18 18:05:53 +02:00
main.go Add flag for passing config file 2023-08-24 21:21:52 +02:00
quay.go Add code for reading TOML config files 2023-08-24 21:18:25 +02:00
route.go Add code for reading TOML config files 2023-08-24 21:18:25 +02:00
server.go Make the port configurable via CLI flag 2023-08-18 17:18:07 +02:00
utils.go Initial try to parse UNIX time with timezone info 2023-08-13 15:41:54 +02:00

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

  1. Open the Connexxion halte-informatie page.
  2. Open your browser's developer tooling and go to the 'network' tab.
  3. Search for your stop on the website and open it.
  4. 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 and town 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 the short_name.
    • departures.stop_headsign is what you'll enter as the long_name.

And that's it. Add the information you found to your config.toml, as described above and start the application.