![]() |
|
[RELEASE] OzWeather - Australian Weather Addon using BOM data - Printable Version +- XBMC Community Forum (http://forum.xbmc.org) +-- Forum: Help and Support (/forumdisplay.php?fid=33) +--- Forum: Add-ons Help and Support (/forumdisplay.php?fid=27) +---- Forum: Weather Add-ons (/forumdisplay.php?fid=155) +---- Thread: [RELEASE] OzWeather - Australian Weather Addon using BOM data (/showthread.php?tid=116905) |
- scotia - 2012-02-27 05:48 Hmm I looked under "downloads", not "source" My bad. Thanks for the add-on! Scott - bossanova808 - 2012-02-27 05:49 No probs. script modification to handle www.weatherzone.com.au - scotia - 2012-02-27 06:56 Hi Bossa, I was having the same trouble as the chap before with a script error when searching a postcode. Bearing in mind in know very little about python... The returned url from weather zone has a www. at the front which is missing from the script. Also, unfortunately there are TWO HTML lists with class typ2, which breaks the script. It only checks one of the two lists, which is the one containing news. Because the list you want is in the "structure_middle" div I included a step before extracting the list to limit the html to just that div. The third thing is that the length of skimmed is 1, even though the search returns many results. So I changed it to the length of the locations array. To that end, I've created a patch to fix things. It has some log() calls which really shouldn't be there, feel free to remove them. I'm sure there are ten better ways to accomplish the same thing (like checking for (www\.)? at the start of the URL. I hope you don't mind me fiddling with your code. Regards Scott Code: --- default.py.dist 2012-02-27 15:49:06.000000000 +1100- bossanova808 - 2012-02-27 07:18 Not at all, patches welcome! But what postcode was giving you errors - I check about 7 by default and I haven't hit the issue. Um....also, I am stupid with git - not immediately sure how to apply a patch can you just post the changed function as you have it now? I'll also try and learn...
- scotia - 2012-02-27 07:19 Hi Bossa, and I have a feature request. The UV value is the forecast from the BOM. Is there any chance of displaying the current. I couldn't find any source on the BOM site, but there is a real time capital city reading in XML here: http://www.arpansa.gov.au/uvindex/realtime/xml/uvvalues.xml Is there any chance you could read that data in and display it alongside the forecast? Cheers, Scott - bossanova808 - 2012-02-27 07:25 Hi Scott - the problem with that is tying it to the user's location - it's no good to me if it is just capital cities, I really need a Weatherzone source for it and I couldn't find one. Otherwise how do I deal with Yackandanda's UV, for example? Basically, I need a BOM ID of some sort, or a weahterzone one, or it gets pretty hard.... Also, please supply postcodes with issues as I want to look at that a bit more and can't find any... New code - scotia - 2012-02-27 07:29 Bossa, I was searching 3122. 3000 was also failing however. The search page in my browser had (http://www.) at the front, which was not matching your script. Here is the new function. Changed lines are commented out with '#' with the new one below. I also added a line. I'd rather the responseurl check for both a url WITH www. and with out it. I'm too lazy to google python regex! Regards Scott Code: ##############################################- bossanova808 - 2012-02-27 07:36 What was in your browser isn't really relevant to be honest, it's what the result of the Python urlopen and it was coming back without the www hence the code. But more importantly, both those codes work here on my Windows box, and 3000 at least definitely works on my linux box, so I can't see why they are failing for you... What's your platform details? - bossanova808 - 2012-02-27 07:43 (that said I am happy to make the changes as they don't appear to break anything, it's just odd and hard for me to test as they all work fine here anyway!) - scotia - 2012-02-27 07:49 Ok, when I was debugging the script I got: Code: NOTICE: Oz Weather-0.3.5: Exception: OzWeather: got responseurl [http://www.weatherzone.com.au/search/]But my browser returns the www. as well. What the site returns is really up to it. I am using a squid proxy may alter the request. Also of some use: Code: [root]# curl -D /tmp/curl-headers "http://weatherzone.com.au/search" |