Kodi Community Forum
Release OzWeather - Australian Weather Addon using BOM data inc. animated radar support - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Weather Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=155)
+---- Thread: Release OzWeather - Australian Weather Addon using BOM data inc. animated radar support (/showthread.php?tid=116905)



RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - ebswift - 2016-09-23

Thanks for the addon, I was able to get it all working. I found in default.py, the HTTPSTUB variable should be set to:

HTTPSTUB = "http://ws.cdn.bom.gov.au/products/radar_transparencies/"

That will help the backup image location to work.


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - bossanova808 - 2016-09-25

@ebswift - I've never needed to change that personally but it does look like they're using a cdn for those now, so that might make sense.

I have some work to do on it to make it Krypton friendly but I am really struggling to find the time - I had a quick look but couldn't work out why some of the forecast icons weren't coming up at a quick glance. So will need to dig deeper, and make some Krypton skin files I suppose.

I'm not such a big fan of the new skin, though, so a combination of being busy and getting annoyed every time I fire up Krypton means I haven't found the right bit of time & motivation yet!


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - RB0135 - 2016-09-26

Love the add-on. Finally one that provides correct data for my location.

However, I have a question which I cant find any answers to (I've done many searches, maybe with the wrong search term), and I think it is probably more related to how Kodi (16.1)/Xonfluence skin works.

So, here goes:
What determines when it is night or day? Sounds a strange question, but my Oz Weather never shows any "night" images, only the sun, or clouds with the sun, etc.

As a programmer, I would program my add-on not to rely on other settings (such as from Kodi) and rely purely on the system time. However, I doubt OzWeather is relying on the time but a trigger from Kodi.. maybe?

Am I looking in the right direcction?

Can anyone shed any light onto this?

Thanks,
Rob


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - bossanova808 - 2016-09-27

@RB1035

Ozweather does nothing with respect to time.

Well, I am not sure how it works in that area TBH - I would presume that's simply a skin thing, swapping in night icons, but it's possible that skin needs some special labels set or something

As is typical with Kodi, I've not found a definitive list of weather labels anywhere and queries have gone unanswered for the most part. That's actually the same issue with Krypton support I think - although I tried to look at what other addons were settings and copy that, so at the moment it's a bit of an unknown why in Krypton some icons are missing in general, let along the night ones!

I will do some digging, hopefully in the not too distant future...


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - RB0135 - 2016-09-27

(2016-09-27, 01:36)bossanova808 Wrote: @RB1035

Ozweather does nothing with respect to time.

Well, I am not sure how it works in that area TBH - I would presume that's simply a skin thing, swapping in night icons, but it's possible that skin needs some special labels set or something

As is typical with Kodi, I've not found a definitive list of weather labels anywhere and queries have gone unanswered for the most part. That's actually the same issue with Krypton support I think - although I tried to look at what other addons were settings and copy that, so at the moment it's a bit of an unknown why in Krypton some icons are missing in general, let along the night ones!

I will do some digging, hopefully in the not too distant future...

Thanks.

I haven't given up on finding why either, so if I find a solution, or a simple why, then I will post back.

When you say "special labels set" are you referring to an xml file value option being set or something different?

Thanks again,
Rob


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - bossanova808 - 2016-09-27

@RB1035

Basically the addon is just some (really gross) python that scrapes weatherzone (and downloads a few images from the BOM) - and sets some skin label values that the skins then pick up on and display. The key thing is to know which labels to set. Seems easy, but they're not documented very well - either the label names to set the values for, or what the values should actually be. Basically you have to pull apart a working addon to work it out, which is a bit of a PITA, but do-able .... it's what I did way back in 2012 or whenever. But some labels have changed etc over time...and some skins define their own special labels for extra features...


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - RB0135 - 2016-09-27

Thanks for the reply and info. Much appreciated. Rob


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - RB0135 - 2016-09-30

(2016-09-27, 06:22)bossanova808 Wrote: @RB1035

Basically the addon is just some (really gross) python that scrapes weatherzone (and downloads a few images from the BOM) - and sets some skin label values that the skins then pick up on and display. The key thing is to know which labels to set. Seems easy, but they're not documented very well - either the label names to set the values for, or what the values should actually be. Basically you have to pull apart a working addon to work it out, which is a bit of a PITA, but do-able .... it's what I did way back in 2012 or whenever. But some labels have changed etc over time...and some skins define their own special labels for extra features...

Bossanova, sorry one quick question.. Where are these labels written (filename maybe)?

Thanks,
Rob


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - bossanova808 - 2016-10-01

@RB0135

They are all set in default.py - basically look for all the calls to setProperty.

To actually find new ones etc, you have to look at skins (mainly the home and myweather bits) - to work out what the labels are. Sounds simple - but sometimes setting the labels just doesn't seem to work with estuary and I can't figure out why, but I might be missing something obvious.


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - RB0135 - 2016-10-01

Thanks. I have a development background in high level languages, so I am used to "tracing" code. My goal is to try and compare files by what the Weather add-ons that do trigger night change compared to OzWeather (I only want to use OZ-Weather and I know its not the be all end all if I don't see night time transitions, but it is bugging me :-)

Thanks again, Rob


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - bossanova808 - 2016-10-01

@RB0135

Any help I can get is appreciated for sure!

Skin files are just XML so not really difficult to write.

OzWeather is python and the label setting/unsetting parts of it are simple enough. It was the first python I wrote (indeed first code I wrote after about 10 years break in coding) - so it's not exactly neat, but it's worked well for 4 yeaars+ now and II'll certainly get it working with Estuary better at some point, but I am very busy with 'real life' right now so it's hard to find the time and motivation given Estuary is....not all that great, if you ask me


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - RB0135 - 2016-10-05

(2016-10-01, 04:56)bossanova808 Wrote: @RB0135

Any help I can get is appreciated for sure!

Skin files are just XML so not really difficult to write.

OzWeather is python and the label setting/unsetting parts of it are simple enough. It was the first python I wrote (indeed first code I wrote after about 10 years break in coding) - so it's not exactly neat, but it's worked well for 4 yeaars+ now and II'll certainly get it working with Estuary better at some point, but I am very busy with 'real life' right now so it's hard to find the time and motivation given Estuary is....not all that great, if you ask me

@bossanova808

ok, I have worked it out, BUT, in a manual way.

The issue is that OzWeather sets the fanart code to the code supplied from Weatherzone. That is the problem and how Kodi Weather determines the "time of day" to show the type of weather. Weatherzone always reports as a "day" forecast and hence when it is clear at night (as it is now in Sydney) then it is reporting it as Sunny and provides the icon code of 32.

Quote:21:06:13 T:16348 DEBUG: ### Oz Weather - 0.8.1 ### Setting property - Name: [Current.OutlookIcon] - Value:[32.png]
21:06:13 T:16348 DEBUG: ### Oz Weather - 0.8.1 ### Setting property - Name: [Current.ConditionIcon] - Value:[32.png]
21:06:13 T:16348 DEBUG: ### Oz Weather - 0.8.1 ### Setting property - Name: [Current.FanartCode] - Value:[32]

What I did was to manually hardcode 33 into your default.py as the fanart code (a night scene) and the background representing the night image was shown. Even the small weather icon in the top left corner changed to a "night" icon.

So, in other words, the fanart background weather is dependant on what value the current.fanartcode is set to.

Now, unfortunately out of our hands, when using Weatherzone, we will never get any codes representing "night" codes.

Does that all make sense (you're probably going to tell me you knew all that Big Grin)?

Rob


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - joshdalt - 2016-11-05

Hi,

Pretty new to Kodi so sorry if this is something simple. Trying to get OzWeather working for my area. In the OzWeather settings, I'm trying to 'Change Suburb 1' but get an error on every postcode I enter. Log below.

15:34:18 878.488220 T:1581937568 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Starting ...
15:34:18 878.488403 T:1581937568 NOTICE: ### Oz Weather - 0.8.1 ### Called as: ['default.py', 'Location1']
15:34:39 900.413696 T:1581937568 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.NameError'>
Error Contents: name 'middle' is not defined
Traceback (most recent call last):
File "/storage/.kodi/addons/weather.ozweather/default.py", line 915, in <module>
log("Error - middle: " + str(middle) + " skimmed " + str(skimmed))
NameError: name 'middle' is not defined
-->End of Python script error report<--
15:36:57 1038.304810 T:1581937568 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Starting ...
15:36:57 1038.305054 T:1581937568 NOTICE: ### Oz Weather - 0.8.1 ### Called as: ['default.py', 'Location1']
15:37:09 1050.197998 T:1581937568 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.UnicodeDecodeError'>
Error Contents: 'ascii' codec can't decode byte 0xe2 in position 89323: ordinal not in range(128)
Traceback (most recent call last):
File "/storage/.kodi/addons/weather.ozweather/default.py", line 881, in <module>
locationName = common.parseDOM(resultPage, "h1", attrs = { "class": "local" })
File "/storage/.kodi/addons/script.module.parsedom/lib/CommonFunctions.py", line 299, in parseDOM
temp = _getDOMContent(item, name, match, ret).strip()
File "/storage/.kodi/addons/script.module.parsedom/lib/CommonFunctions.py", line 162, in _getDOMContent
end = html.find(endstr, start)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 89323: ordinal not in range(128)
-->End of Python script error report<--
15:37:21 1062.119507 T:1664205728 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Starting ...
15:37:21 1062.119995 T:1664205728 NOTICE: ### Oz Weather - 0.8.1 ### Called as: ['/storage/.kodi/addons/weather.ozweather/default.py', '1']
15:37:28 1069.182251 T:1548383136 ERROR: DoWork - Direct texture file loading failed for resource://resource.images.weathericons.default/.png
15:37:30 1071.245728 T:1664205728 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Exiting ....
15:41:52 1332.974731 T:1548383136 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Starting ...
15:41:52 1332.974976 T:1548383136 NOTICE: ### Oz Weather - 0.8.1 ### Called as: ['default.py', 'Location1']
15:41:54 1335.072510 T:1548383136 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Exiting ....
15:41:56 1336.574585 T:1548383136 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Starting ...
15:41:56 1336.574829 T:1548383136 NOTICE: ### Oz Weather - 0.8.1 ### Called as: ['default.py', 'Location1']
15:42:07 1347.737915 T:1548383136 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.NameError'>
Error Contents: name 'middle' is not defined
Traceback (most recent call last):
File "/storage/.kodi/addons/weather.ozweather/default.py", line 915, in <module>
log("Error - middle: " + str(middle) + " skimmed " + str(skimmed))
NameError: name 'middle' is not defined
-->End of Python script error report<--
15:45:19 1540.265503 T:1664205728 ERROR: Texture manager unable to load image from memory
15:50:16 1836.731079 T:1963229184 ERROR: Previous line repeats 1 times.
15:50:16 1836.731323 T:1963229184 ERROR: Unable to activate the previous window
15:50:16 1837.044922 T:1581937568 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Starting ...
15:50:16 1837.056885 T:1581937568 NOTICE: ### Oz Weather - 0.8.1 ### Called as: ['/storage/.kodi/addons/weather.ozweather/default.py', '1']
15:50:24 1844.501953 T:1581937568 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Exiting ....
15:52:52 1992.460083 T:1664205728 ERROR: Texture manager unable to load image from memory
15:57:02 2242.450195 T:1774973856 ERROR: Previous line repeats 1 times.
15:57:02 2242.450195 T:1774973856 ERROR: CCurlFile::FillBuffer - Failed: Timeout was reached(28)
15:57:02 2242.450439 T:1774973856 ERROR: CCurlFile::Open failed with code 0 for http://feeds.openelec.tv/news
16:20:24 3644.951416 T:1664205728 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Starting ...
16:20:24 3644.951660 T:1664205728 NOTICE: ### Oz Weather - 0.8.1 ### Called as: ['/storage/.kodi/addons/weather.ozweather/default.py', '1']
16:20:28 3649.261719 T:1664205728 NOTICE: ### Oz Weather - 0.8.1 ### Oz Weather (Author: Bossanova808) Exiting ....

Am I missing something?

Cheers,
Josh


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - bossanova808 - 2016-11-06

@joshdalt - no you're not missing anything, it appears as if weatherzone has changed those pages slightly - I will fix soon.

@RB1035 - Rob sorry, don't seem to be getting notifications. No I didn't know that - Is it possible that the night icons are an offset to the day ones (i.e. the same, but a set offset of 30 away or whatever) - if so I culd put in a time check and say after 6pm and before 6am I could use night codes or whatever....

If you can put a simple algorithm into words for it, I can make it happen (when I have time!)


RE: [RELEASE] OzWeather - Australian Weather Addon using BOM data - bossanova808 - 2016-11-14

Just a general update

I've decided I'm going to re-write this one more thoroughly for Krypton...it was the first programming I did after about 10 years break, and it's just awful looking at it now. It works, but it's gross. So I'm going to make it a lot more robust and maintainable, add some caching etc, and make it so that I can test/adjust the scraping side of it outside of Kodi itself, which will make maintenance a lot easier. And remove sold old dependencies so that it only uses very standard python stuff.

This might take me a little bit but I hope to have it out before the end of the year, which is when I suspect Kodi 17 will come out.

The one thing I am iffy on is Estuary support - that skin is currently a dog's breakfast currently IMO, and I am not at all sure I will bother doing any work for it - I'm planning on sticking with Confluence at this point. I just can't deal with the low information density of Estuary - all that wasted space - and the inconsistencies etc. So I'll get it to set all the standard labels etc, but no promises I'll bother with radar views etc for Estuary until someone fixes that mess (assuming they do).