The other week (month!) I mentioned how I'd love to get a weather pixie working on my blog again. Last night I had a harebrained idea to have a go at it. At least text for now.
I first tried it with PowerShell to see if I could at least grab the file. Easy enough (I've had a bit of practise at work over the past month) but will only run on my computer, not my web host. So it was onto hacking Perl. Had to do lots of Googling to get code that would work. By bed time I could grab the contents of the JSON file from BOM, but couldn't quite parse the last hash (the JSON file there is a hash (observations), with an array (data), with a hash (each chunk)).
It may have contributed a little to me not getting to sleep for ages.
This morning over breakfast I got it working, and was able to get it to save the data into fields and spit them out into useful infos, including a CSV file for histerical data.
I didn't spent tooo much time on it during the day - I'm wayyyy too busy to waste time on coding!
But I was able to get my script to output results into a html file that I could load in an iframe on my blog.
It's rough as guts - there's no styles at all, it's just raw html, in a table no less. But the bones are there for it, so will tweak it as I find the time. There's a cron job that runs every half hour to update the html file, as well as the CSV file.
Very exciting!! ;)
Comments