artemy / alfred-ns-schedule

Alfred workflow for getting NS (Nederlandse Spoorwegen) train schedule.
MIT License
4 stars 1 forks source link
alfred alfred-workflow nederlandse-spoorwegen nederlandse-spoorwegen-api ns

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 an API key from https://apiportal.ns.nl/ and set it in a user configuration of the workflow. Subscribe to the product NS-App.

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

  1. Open Alfred
  2. Type ns and the name of the origin station, confirm origin station choice by pressing "Enter"
  3. Type the name of the destination station, confirm destination station choice by pressing "Enter".

Workflow will display a list of upcoming trains for the route you have specified. Pressing Enter on a schedule item will open it on NS website in your default browser, where you can get more details.

animation

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.