Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tyr2

macrumors 6502a
Original poster
May 6, 2006
832
234
Leeds, UK
I've finally completed my first Dashboard widget for public release. As it's my first one I thought I'd post it here and see if anyone has any comments?

It's displays live bus stop timetable information for bus stops in the following UK regions:

West Yorkshire
South Yorkshire
Belfast
Cardiff
Gloucestershire
Oxfordshire
Surrey
Kent

Download it here : http://widget.newswall.org.uk/yournextbus/
 

tyr2

macrumors 6502a
Original poster
May 6, 2006
832
234
Leeds, UK
All the regions above use the same system to provide the timetable information. Since I live in Leeds I started out making a widget for West Yorks after that the others were trivial to add.

It may be possible to add Dublin but I expect they use a different system, do they have a website with live bus information?
 

j26

macrumors 68000
Mar 30, 2005
1,752
684
Paddyland
All the regions above use the same system to provide the timetable information. Since I live in Leeds I started out making a widget for West Yorks after that the others were trivial to add.

It may be possible to add Dublin but I expect they use a different system, do they have a website with live bus information?
I'm not sure if they have a live website, but I know there's a text based service
Here's the website. I wouldn't know what I'm looking for. If you could find anything you can use it would be great.
 

tyr2

macrumors 6502a
Original poster
May 6, 2006
832
234
Leeds, UK
I'm not sure if they have a live website, but I know there's a text based service
Here's the website. I wouldn't know what I'm looking for. If you could find anything you can use it would be great.

I've had a look round the site and, unfortunately, I can't see anything that I could use to make this work for Dublin.
 

xUKHCx

Administrator emeritus
Jan 15, 2006
12,583
9
The Kop
Hey that is pretty cool, didnt expect it to be a UK thread let alone a one that is relevant to me, thanks from Sheffield.
 

tyr2

macrumors 6502a
Original poster
May 6, 2006
832
234
Leeds, UK
Hey that is pretty cool, didnt expect it to be a UK thread let alone a one that is relevant to me, thanks from Sheffield.

I should have put 'UK' in the thread title. Anyway, glad you like it, hope you find it useful.
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
Sounds pretty neat. Too bad it doesn't apply to Katy, Texas!!

Would you mind sharing any of your experiences writing the widget? How did you tackle it? Is there an API where you are grabbing the information, or are you just bringing up the page programmatically and parsing the info?

I want to write a widget too, but am not sure where to start. Any info you care to share would be appreciated.

Thanks, Todd
 

tyr2

macrumors 6502a
Original poster
May 6, 2006
832
234
Leeds, UK
Would you mind sharing any of your experiences writing the widget?

Sure. It's coded with the beta version of DashCode which helps a lot when it comes to doing the interface design as it has all the widget specific features that you can just drag/drop onto the interface, like the scrollable areas. DashCode is clearly still a beta application tho and some things don't work as well as they might.

After designing the widget the rest of it is just some JavaScript and some Perl code. The JavaScript manages the widget side of things, such as setting preferences and running the refresh timer. To get the timetable the JS calls a Perl script which uses 'curl' to request a web page with the details on.

Curl ships with OS X, it's a handy way to interface with webpages from the command line. The pages all come from acislive.com who provide the timetable service to the regions above. The Perl script parses this a bit then hands it back to the JS which displays it. It may have been possible to do all the things that the Perl script does in JS but it just seemed easier to do in Perl and as it's there, why not use it.

That's about it really.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.