NS Commute Tracker

Plasma 4 Extensions

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

0
Become a Fan
5.0

Description:
Small plasmoid to keep you informed about the departure time of your NS train (Dutch railways). The number of global disruptions on the track is also shown. Any feedback, including improvements on the code, is appreciated.

Note: the NS api allows us a total 50.000 parses a day. Please leave the update setting to 60 seconds or more, otherwise we will get blocked.

On the todo list are:
* Upgrade the layout of the text
* Include translation(s)
Last changelog:

Version 1.4:
- Fixed bug in connection code

Version 1.3:
- Fixed bug in parsing code w.r.t. time

Version 1.2.1:
- Fixed bug in layout of label position
- Fixed bug in exception handling causing "Script Initialization Failed" messages

Version 1.2:
- Added button that opens travel advice and disruptions (if any).

Version 1.1:
- Added code for NS API with fallback on HTML parsing code
- Implemented patch of rbos


Ratings & Comments

17 Comments

rbos

Since yesterday (24 feb) I get: "object can't made be due to the following reason": script initialisatie mislukt. Is this a general problem, or a problem on my site?

VincentVandalon

The plasmoid runs fine on my 3 computers. I just deleted and reinstalled the kde-apps version and it still works. Unfortunately, this makes it harder to diagnose the problem. Since you have tried the script before, I assume that you still have a "python-kde4" package installed? What changed between when the plasmoid worked and now?

rbos

nothing changed. Wednesday it worked, next day it stopped working. Is there a way to run the script from the command line?

VincentVandalon

You can run this (www.nijf.nl/getNSInfo_API.py) and see if it produces output. If it does yield a string with information, then it is likely an issue or bug in the GUI code. If the aforementioned script fails, then the parsing code is faulty.

rbos

The output I get is: /var/tmp> python ./getNSInfo_API.py ('Journey from Eindhoven ==> Vleuten\nDeparture: 16:02, arrival: 17:13, with 1 transfer.', []) Which looks fine to me.

VincentVandalon

I found the bug and I will upload the new version later today. The exception handling routine I wrote was missing an exception class...

oOSplashOo

Tsscht why isn't it also for french transports... Ha this is quiet simple and quick to use!

rbos

Hi, is it possible to make the "possible disruption" link clickable, and have it refer to http://www.ns.nl/storingen/index.form. That would make it convenient to determine the actual disruption.

VincentVandalon

Good idea, I actually get specific information about the disruption, so I can link to that. I guess implementing that will be part of my commute tomorrow!

rbos

The new button works simple and nice :)

rbos

Can you this patch: --- NSSummary/contents/code/getNSInfo.py.org 2012-02-14 18:11:42.781711000 +0100 +++ NSSummary/contents/code/getNSInfo.py 2012-02-14 20:33:50.358883001 +0100 @@ -71,7 +71,10 @@ summaryText+=' and has a transfer at %s'%(t) summaryText+=' and will arrive at %s.'%(self.arrivalTime) if self.nrDisruptions != 0: - summaryText+='\nThere is(are) %s disruption(s).'%self.nrDisruptions + if self.nrDisruptions == "(1)": + summaryText+='\nThere is 1 disruption.' + else: + summaryText+='\nThere are %s disruptions.'%self.nrDisruptions return summaryText def parseNS(fromStation='Eindhoven',toStation='Vleuten'): It makes the disruption text nicer formatted

Hmpf

So there is actually a ns.nl url which has departure in its string. Is there any chance to integrate this into the public transport plasmoid? http://kde-apps.org/content/show.php/PublicTransport?content=106175 Searched a bit further and by now there is an API available http://www.ns.nl/api/api but access is limited.

VincentVandalon

I have no current plans to integrate it with the public transport plugin. The goal was to make a very minimal interface, so that I can have a quick glance at when/if I need to leave for the train. The public transport project is free to "use" my code of course. The parsing code is separated (somewhat) from the GUI. Thanks for pointing me to the API, that does look nice, and more convenient then parsing HTML code. Why I did not look for this, I do not know :) . I will actually get this in asap.

Mikage

let me just remind everyone that NS sucks! ;)

Mikage

let me just remember everyone that NS sucks! ;)

rbos

Finally a plasmoid for the Dutch railways :) Is there a Dutch translation for it?

VincentVandalon

Offering different translations is a good point/suggestion. I will have a look at the KDE mechanism for adding translations and implement this.

Pling
0 Affiliates
Details
license
version 1.4
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 1

Other Plasma 4 Extensions:

Icon Tasks deb build
N00bun2
last update date: 13 years ago

Score 4.3

Prayer Times Plasmoid
riyad
last update date: 13 years ago

Score 5.2

KPrayertime4 Islamic Prayer Times
ahaq
last update date: 15 years ago

Score 4.4

Hostinfo
mgraesslin
last update date: 13 years ago

Score 4.7

Monitor QuadCore Russian
kuchumovn
last update date: 16 years ago

Score 5.0

blaKjaK
werevire
last update date: 15 years ago

Score 5.0