Skip to content

Alfred workflow for getting NS (Nederlandse Spoorwegen) train schedule.

License

Notifications You must be signed in to change notification settings

artemy/alfred-ns-schedule

Repository files navigation

NS (Nederlandse Spoorwegen) Train schedule for Alfred 5

test & release MIT License

Alfred workflow for getting NS Train schedule.

image

Getting started

⚠️ This workflow requires Alfred 5. Alfred 4 users can use version 2.0 of the workflow.

Prerequisites

Project requires Python 3.8+ to run, which is not included by default with macOS. You can install Python 3 using this guide.

⚠️ Make sure to get API key from https://apiportal.ns.nl/ and set it in a user configuration of the workflow.

Installing

Download NS_Schedule.alfred5workflow file from the latest release at Releases page and open it with Alfred. Change the value of NS_APIKEY variable to the value you've received from NS at the Prerequisites step.

How to Use

Open Alfred and type ns and names of two train stations you want to see schedule for. Workflow will display list of upcoming trains for the route you have specified. Pressing Enter on a displayed item will open it on NS website, so you can get more details.

animation

⚠️ For places with names consisting of multiple words, use _ (underscore) instead of space inside the name, e.g. for trains between Den Haag Centraal and Amsterdam Bijlmer Arena type den_haag_centraal amsterdam_bijlmer_arena

Running the tests

Make sure to first install test dependencies:

pip3 install -r requirements.txt

To run tests, execute

python3 -m ns_schedule_test

If you want to get coverage figures through coverage tool:

coverage run -m unittest ns_schedule_test # gather test data
coverage report -m # display coverage figures

Built With

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

See Contributors for the list of contributors.