https://github.com/dlozeve/sncf-bot
Display the next departures at any SNCF train station.
https://github.com/dlozeve/sncf-bot
gerbil-scheme sncf sncf-api
Last synced: 3 months ago
JSON representation
Display the next departures at any SNCF train station.
- Host: GitHub
- URL: https://github.com/dlozeve/sncf-bot
- Owner: dlozeve
- License: mit
- Created: 2022-09-09T06:18:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-07T10:59:33.000Z (over 1 year ago)
- Last Synced: 2025-01-12T19:33:08.851Z (4 months ago)
- Topics: gerbil-scheme, sncf, sncf-api
- Language: Scheme
- Homepage:
- Size: 41 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
* SNCF Bot
Display the next departures at any SNCF train station.
** Usage
Get an access to the [[https://www.digital.sncf.com/startup/api][SNCF API]]. By creating an account, you should
receive an email with your authentication key.The program reads the authentication key from the =SNCF_AUTH_KEY=
environment variable.#+begin_src sh
$ export SNCF_AUTH_KEY=
$ sncf vernon
Prochains départs de Vernon - Giverny (Vernon) :
┌────────┬────────────────────────────┬───────────────┐
│ Réseau │ Direction │ Heure │
├────────┼────────────────────────────┼───────────────┤
│ TER │ Rouen Rive Droite (Rouen) │ 12:05 │
│ TER │ Paris Saint-Lazare (Paris) │ 12:53 │
│ TER │ Rouen Rive Droite (Rouen) │ 13:11 │
│ TER │ Paris Saint-Lazare (Paris) │ 13:56 │
│ TER │ Paris Saint-Lazare (Paris) │ 14:52 │
│ TER │ Rouen Rive Droite (Rouen) │ 15:11 │
│ TER │ Paris Saint-Lazare (Paris) │ 16:52 │
│ TER │ Rouen Rive Droite (Rouen) │ 17:11 │
│ TER │ Paris Saint-Lazare (Paris) │ 17:56 │
│ TER │ Rouen Rive Droite (Rouen) │ 18:04 │
└────────┴────────────────────────────┴───────────────┘
#+end_srcIf there are disruptions, the program will display the scheduled and
actual (estimated) times of departure, along with the associated
messages and explanations.You can choose the train station with the first argument. The
(optional) second argument accepts an ISO 8601-formatted date and
time: the program will show departures after this time.If you want to publish to [[https://mattermost.com/][Mattermost]], create an [[https://developers.mattermost.com/integrate/webhooks/incoming/][incoming webhook]] by
going to *Product menu* (top left) → *Integrations* → *Incoming
webhooks*.Use the ~--mattermost-url~ option to set the webhook URL and post to
Mattermost. Optionally, you can override the default channel of the
webhook with ~--channel~.#+begin_src
$ sncf -h
Usage: sncf [option ...] [] []Options:
-h --help Display this help.
--mattermost-url Mattermost incoming webhook URL. [default: #f]
--channel Mattermost channel. [default: #f]Arguments:
station: Name of the station (default Vernon-Giverny). [default: #f]
datetime: Date and time (ISO 8601 format). [default: #f]
#+end_src** Building instructions
*** Static executable using Docker
The build script will use Docker to build a fully static executable
=sncf-static= in the current directory. The Dockerfile is based on
the [[https://hub.docker.com/r/gerbil/alpine][gerbil/alpine]] image.#+begin_src sh
./build.sh
#+end_src*** With your local [[https://cons.io/][Gerbil]] installation
This project depends on [[https://github.com/dlozeve/fancy][dlozeve/fancy]]. Install it with the package
manager:
#+begin_src sh
gxpkg install github.com/dlozeve/fancy
#+end_srcThe project comes with a build script for the [[https://cons.io/guide/build.html][standard build tool]],
which installs the =sncf= executable in =$GERBIL_HOME/bin=:
#+begin_src sh
./build.ss
#+end_src