NS Commute Tracker

Plasma 4 Widgets

Source (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
Score 50.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:

6 years ago

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

rbos

7 years ago

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?

Report

C

VincentVandalon

7 years ago

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?

Report

rbos

7 years ago

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

Report

C

VincentVandalon

7 years ago

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.

Report

C

VincentVandalon

7 years ago

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

Report

rbos

7 years ago

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.

Report

oOSplashOo

7 years ago

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

Report

rbos

7 years ago

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.

Report

C

VincentVandalon

7 years ago

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!

Report

rbos

7 years ago

The new button works simple and nice :)

Report

rbos

7 years ago

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

Report

Hmpf

7 years ago

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.

Report

C

VincentVandalon

7 years ago

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.

Report

Mikage

7 years ago

let me just remind everyone that NS sucks! ;)

Report

Mikage

7 years ago

let me just remember everyone that NS sucks! ;)

Report

rbos

7 years ago

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

Report

C

VincentVandalon

7 years ago

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

Report

6 years ago

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

12345678910
product-maker Count: 4 Rating: 5.0
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs ocs-url or ocs-store to install things
Pling
Details
license
version
1.4
updated Jan 03 2013
added Feb 13 2012
downloads 24h
0
page views 24h 3