Kodi Community Forum

Full Version: OzWeather - Australian Weather Addon using BOM data inc. animated radar support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2020-04-14, 13:02)Cinephile Wrote: [ -> ]
(2020-04-14, 13:01)bossanova808 Wrote: [ -> ]I'll have A look tomorrow but it's almost always just a temp glitch with weatherzone and fixes itself...

Fair enough, let's give it some time. Thanks for the quick reply!  
Came here to report the same.

Took me a little while to find the thread. The forum link at the bottom of the Wiki page is broken and I think it needs to be updated to point to this thread
Dupe
Fixed the wiki link.  Looks like Weatherzone have tweaked their code, and the relevant table that OzWeather scrapes is no longer referred to in the way that the script is looking for. It's looking for "forecast-table", but that doesn't appear in the source for the Weatherzone page anymore.
(2020-04-14, 15:26)mbriody Wrote: [ -> ]
(2020-04-14, 13:02)Cinephile Wrote: [ -> ]
(2020-04-14, 13:01)bossanova808 Wrote: [ -> ]I'll have A look tomorrow but it's almost always just a temp glitch with weatherzone and fixes itself...

Fair enough, let's give it some time. Thanks for the quick reply!   
Came here to report the same.

Took me a little while to find the thread. The forum link at the bottom of the Wiki page is broken and I think it needs to be updated to point to this thread 
same.
Error:
2020-04-15 10:04:00.089 T:3383726816   DEBUG: Exception processing forecast rows data from https://www.weatherzone.com.au/nsw/hunter/kariong
                                              File "/home/osmc/.kodi/addons/weather.ozweather/default.py", line 327, in <module>
                                              File "/home/osmc/.kodi/addons/weather.ozweather/default.py", line 309, in getForecast
                                              File "/home/osmc/.kodi/addons/weather.ozweather/default.py", line 231, in forecast
                                                weatherData = getWeatherData(urlPath, extendedFeatures, VERSION_NUMBER)
                                              File "/home/osmc/.kodi/addons/weather.ozweather/resources/lib/weatherzone.py", line 478, in getWeatherData
Yeah...it's a bit of a bugger from what I can see.

Looks like WeatherZone have moved to loading in that table via AJAX.  Which is a bugger, because python scrapers can't see the results of that, obviously...

I've seen them, in the past, make changes like this then back-pedal furiously, so we might get lucky...but it's quite possible we won't.

So...might need a re-think here....
In the meantime, to keep the other bits of the addon working, you want to comment out a (rather stupid) raise line I seem to have left in..

Around line 669 - add a hash before the word raise...

python:

except Exception as inst: log("Exception processing forecast rows data from " + SCHEMA + WEATHERZONE_URL + urlPath + "\n" + str(inst))
# raise

This will mean it rather than just stop, it should just skip over the forecast bit at fill in the rest of the data.

The one around line 461 can probably go too...

python:

except Exception as inst: log("Exception processing current conditions data from " + SCHEMA + WEATHERZONE_URL + urlPath + "\n" + str( inst))
# raise

(...being python, do not f*ck up the indenting while doing this)
In a nutshell, it might be solveable by writing Python to do the first few lines equivalent of this:

javascript:

            //forecast AJAX
            var
                forecast_data = { lt: "twcid", lc: "112091", fs: "TWC" },
                forecast_load = function() {
                    $("#forecast").load("/local/ajax/forecastlocal.jsp", forecast_data);
                    $("#forecast_options li a").removeClass("selected");
                    $("#forecast_options li a." + forecast_data.fs.toLowerCase()).addClass("selected");
                };
       ...
            forecast_load();
What a mess. By far the best weather add-on for Kodi and now they decide to pull this on us.

So for now we wait and see if perhaps they re-think their decision?
I might hack away at it a bit today, depends if I have time.... hard to tell if it is possible without trying, but in theory I can hit the request URL in the same way they are doing, to get the data...they are just filling an empty div with some html, presumably the same html as before...
Yep so I think I have fixed it...have to use a regular expression to find the location ID out of the js code, then can basically just post the same data as they do and get back the missing wad of text.

I am pretty sure that Kodi is not taking any non Python 3 submissions at this point, though...and I have been meaning to do that work, so now is as good a time as any I guess...

In the meantime, to get things working (would be good if some others test it!) - replace your resources/lib/weatherzone.py with the one found here: https://pastebin.com/43rrVgqc - be good to get a few positive reports...
(2020-04-15, 04:33)bossanova808 Wrote: [ -> ]Yep so I think I have fixed it...have to use a regular expression to find the location ID out of the js code, then can basically just post the same data as they do and get back the missing wad of text.

I am pretty sure that Kodi is not taking any non Python 3 submissions at this point, though...and I have been meaning to do that work, so now is as good a time as any I guess...

In the meantime, to get things working (would be good if some others test it!) - replace your resources/lib/weatherzone.py with the one found here: https://pastebin.com/43rrVgqc - be good to get a few positive reports...

Working for me. Well done!
Mate, you're on the ball. That fix works beautifully.
I'll try and submit the fix to the overlords....it seems that the idea of python 2/3 compatibility has changed, so I can just make a new Python 3 version later....

We'll see how it goes.  Of all the code projects I have ever contributed to, Kodi addons submission process is BY FAR the most convoluted and painful Sad
Works Well!

Win64 Kodi 18.6

Thanks for your efforts on this great tool
(2020-04-15, 05:12)bossanova808 Wrote: [ -> ]I'll try and submit the fix to the overlords....it seems that the idea of python 2/3 compatibility has changed, so I can just make a new Python 3 version later....

We'll see how it goes.  Of all the code projects I have ever contributed to, Kodi addons submission process is BY FAR the most convoluted and painful Sad
Cheers knackers! Looking forward to the update via the repo!