My regular commute train quite frequently has a delay of somewhere between 3 and 8 minutes, which is annoying when you really hurry up in the morning to be sure to catch it - it's only a 6min walk or so - and then you notice that all the rush was in vain, because the train wont be there for the next 5 minutes. But then again, you can't rely on it being late...
Wouldn't it be nice to already know this at home?
Well luckily on the website of our Austrian Federal Railways (Ă–BB) and in their mobile apps you can watch the "
Station monitor" as they call it. That is, you get almost the same screen display as the have in the station, with the delays showing - if any.
However, that would require 2 taps on my mobile .... way too cumbersome for me.
So I put together a quick Perl hack, just to stay in shape.
First analyze the
webpage and the actual Ajax call in the background.
Then so some lenient JSON parsing, fix three stupid perl mistakes I managed to make within 1 hours. Filter on the train that I actually want, and send a
PushBullet notification to my mobile and schedule this through
cron on my QNAP for 8am every morning. Just in time to let me know whether I would need to speed up or not.
That was yesterday.
This morning, though, I of course did not get any notification, because I forgot the proper
use lib ... in my perl script, so it would pick up my personal PushBullet library. Which of coursed worked during testing yesterday, because I was in another working directory. Will I ever learn?!
And at the same time I learned from my wife, that she is taking an earlier train this summer, so while I was at it, I updated the script to monitor 2 trains (with only 1 notification).
Should work fine now... But let's see tomorrow morning.