Tuluttut – blog o niczym

Tuluttut – blog about nothing, mostly in Polish.

hafa.sh – shell script that fetches train connections

hafa.sh is a small shell script for Unix-based systems that fetches train connections between two stations. It has both command-line and basic graphic interface (using GTK+/Zenity – zenity is required to use it). cURL is also required, as the script uses it to fetch connection data.

All connections that are included in HAFAS system and, specifically, one of its Polish implementations are available – that means the script can find railway connections within much of Europe.

Available connections

Connections window

To run it, start your terminal, navigate to the folder where it is downloaded, give it the execution permission (chmod +x hafa.sh) and input one of the following commands:

./hafa.sh -w //window mode
./hafa.sh -i //command-line ‚interactive’ mode
./hafa.sh -a Departure_station -b Arrival_station -d Date -t Time //direct input
./hafa.sh -h //help with description of above and even more arguments

You don’t have to input date and time – if you don’t do it, your system time will be used.

The script can be downloaded from its Sourceforge.net project page. It was written as a university assignment, but as I like the result I decided to release it online.

Current version has some minor bugs and lacks some features that might be useful (ie. information about the exact time and place of a layover), but is quite usable for a basic script. Of course, any improvement suggestions are welcome.

Reklamy

4 responses to “hafa.sh – shell script that fetches train connections

  1. Walker 10 grudnia 2011 o 12:13

    Tried it and it worked. :)

  2. mmkay 10 grudnia 2011 o 14:35

    Thanks for checking!

  3. calixto 19 lipca 2013 o 15:45

    Fajny skrypt ale na chwię obecną wymaga poprawek:
    – w linii 119 – w wyniku działania nie podaje pełnego adresu URL przez co nie działa curl z kolejnej linii

  4. mmkay 19 lipca 2013 o 15:52

    Dziękuję za informację, postaram się w najbliższym czasie go zaktualizować.

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Wyloguj / Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj / Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj / Zmień )

Zdjęcie na Google+

Komentujesz korzystając z konta Google+. Wyloguj / Zmień )

Connecting to %s