Release - openweathermap

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Bitboy Offline
Junior Member
Posts: 26
Joined: Dec 2013
Reputation: 2
Location: Germany
Rainbow  openweathermap
Post: #1
Hi Community Big Grin

So this is my first script i ever did in python, my first addon, and my first contribution to open source software, so please be gentle Wink
The code from this addon is mainly based on yahoo weather and wunderground, additionally it supports (more or less) openweathermap maps api.

Weather descripions are translated by the OWM API. See here http://openweathermap.org/API#weather for a list of currently supported languages.

I'm not sure which versions of XBMC are working with it, i only tested with a recent nightly build. So please give feedback including a full debug log if something isn't working.

There are still some ToDo's:
- current versions shows no own window to see the weathermaps. I would leave this point to experienced skinners.
- use more than one map tile because its only 256x256px, a bit small maybe
- addon setting translations
- map explanations: for maps, there should be explanation pictures, showing the relationship between color and value. For now i couldn't find a documentation on openweathermap. A gimp file to start with is included in the ressource folder.
- i wanted to show the 'working...' notification during loading, but i couldn't find how to do it. Sometimes the data download does not work at once so the user has a feedback to be patient while the addon is trying to recieve the data.
- mapping weathercode to xbmc conditions icons. A list of weathercodes can be found here http://openweathermap.org/wiki/API/Weath...tion_Codes. I tried my best to match it to the default icons, but maybe a bit improvement is required.

Unfixable 'issues'
- Location search api does not provide a state information, only city and country are given. Thus it may be a bit difficult finding the right location.
- I'm not able to support Frodo. Its working by default but if you refresh the informations Frodo crashes (on XP). It seems related to line 18 "from PIL import Image" and i couldn't find a workaround.

Feature Requests
- None so far

Things you may notice
- Location Map is only downloaded once for each location and zoom level and background provider. The reason is simple: I don't think cities start moving around Wink
- weather maps will only allow updating each six hours. This is done to prevent too much server load on their side

Changelog:
v1.0.0
- added polish translation (thx to sebf)
- added 3-hourly data, up to 12 entries
- log level set to debug
- skin fixes for gotham Beta 2

v0.0.6
- added french translation (thx to allophos)

see included file for full change log.

For Skinners
The following properties are set by the addon, in bold those which are currently not used by Confluence ( i didn't check other skins)

Current.Condition
Current.Temperature
Current.Wind
Current.WindDirection
Current.WindGust -> maximum wind speed in kmh
Current.Humidity
Current.FeelsLike
Current.DewPoint
Current.OutlookIcon
Current.FanartCode
Current.CloudCover -> CloudCover in %
Current.PrecipitationSnow -> Snow precipitation in mm (millimeter) / x hour where x can be 1 or 3
Current.PrecipitationRain -> Rain precipitation in mm (millimeter) / x hour where x can be 1 or 3
Today.Sunrise (in confluence only displayed if wunderground is used)
Today.Sunset (in confluence only displayed if wunderground is used)
Today.AvgHighTemperature -> Todays maximum temperature in C
Today.AvgLowTemperature -> Todays minimum temperature in C
Map.Location -> Full path to an image, showing a map tile from selected location
Map.Rain -> Full path to an image, showing a RAIN map tile from selected location
Map.Temperature -> Full path to an image, showing a TEMPERATURE map tile from selected location
Map.Clouds -> Full path to an image, showing a CLOUD map tile from selected location
Map.Wind -> Full path to an image, showing a WIND map tile from selected location
Map.Snow -> Full path to an image, showing a SNOW map tile from selected location
Map.Pressure -> Full path to an image, showing a PRESSURE map tile from selected location
Map.Precipitation -> Full path to an image, showing a PRECIPITATION map tile from selected location
Map.ColorDiffuse -> value in 0x$$FFFFFF, setting the transparency from the weathermap so you can see the underlying location map too
Day%i.Title
Day%i.HighTemp
Day%i.LowTemp
Day%i.Outlook
Day%i.OutlookIcon
Day%i.FanartCode
Day%i.CloudCover -> CloudCover in %
Day%i.Wind -> wind speed in kmh
Day%i.Winddirection -> as string


Finally, the addon can be found here:weather.openweathermap-1.0.0.zip


Older Versions:
http://www.file-upload.net/download-8429...4.zip.html

Any comments, improvements, feature requests, bugreports and fixes are welcome.
(This post was last modified: 2014-03-31 11:50 by Bitboy.)
find quote
ronie Offline
Team-Kodi Member
Posts: 9,330
Joined: Jan 2009
Reputation: 164
Post: #2
great, finally an open weather provider ! :-)
i'd say this has a lot of potential.



bug reports...
Code:
if int(zoom) > 11 && __addon__.getSetting('BackgroundProvider') == '3':
that's not a valid python expression. use 'and' instead of '&&'

Code:
blankfile = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'images\\blank.png' ).encode("utf-8") ).decode("utf-8")
markerfile = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'images\marker.png' ).encode("utf-8") ).decode("utf-8")

don't hardcode backslashes in paths. this will fail on any non-windows os.
proper way to do it:
Code:
blankfile = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'images', 'blank.png' ).encode("utf-8") ).decode("utf-8")
markerfile = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'images', 'marker.png' ).encode("utf-8") ).decode("utf-8")



feature request...
openweathermap recommends any app that uses their service to register for, and use, an api key.
i guess it wouldn't hurt to honour their request. :-)


keep up the good work and just ping me if/whenever you need a hand ;-)

Always read the Kodi online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
Bitboy Offline
Junior Member
Posts: 26
Joined: Dec 2013
Reputation: 2
Location: Germany
Post: #3
Hi ronie,

thx for your compliments, nice to hear from an experienced user.

To the bug: i thougt i fixed it, but it seems that i uploaded the wrong zip :/

Thx for showing how to uses pathes the right way i'll update this and upload a new zip in a few minutes.

You're right, i'll get an API Key and update the addon in the near future.

I could need some help to make sure its compatible with older versions of xbmc. I just don't know which functions i used are new and which are not. For now i can only think of xbmc.getLanguage(xbmc.ISO_639_1, False) as a new function which may crash on older versions.
find quote
ronie Offline
Team-Kodi Member
Posts: 9,330
Joined: Jan 2009
Reputation: 164
Post: #4
yup, tested it on xbmc frodo, and it's indeed the only part of the script that fails.

the lazy/easy way out to get around it would be:
Code:
def get_api_lang():
    try:
        lang = xbmc.getLanguage(xbmc.ISO_639_1, False)
    except:
        lang = 'en'
(limiting frodo users to english only forecasts)

else, you'll have to fetch to full language name and create your own mapping table to iso codes
(somewhat similar to what i do in wunderground)

in case you're still looking for an icon for your addon:
http://en.wikipedia.org/wiki/File:OpenWe...p_logo.png

Always read the Kodi online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
Bitboy Offline
Junior Member
Posts: 26
Joined: Dec 2013
Reputation: 2
Location: Germany
Post: #5
thx for trying this. i've written a mapping table for languages and changed the icon to the original one.
it also uses an API key now.

download link is updated for version 0.0.4 now.
find quote
Bitboy Offline
Junior Member
Posts: 26
Joined: Dec 2013
Reputation: 2
Location: Germany
Post: #6
First, merry christmas to all of you, i hope you have a nice time.

Addon is updated to Version 0.0.5.

Important: To see and fully use the new features, you need to apply the confluence mod included in the zip package by putting the files into the 720p folder. Users of other skins or those who are not willing to manually patch their skin will have NO advantage from this update. Modding shouldn't break other weather addons but you should backup the skin files before overwriting them.

Changelog:
v0.0.5
- NOTE: zip contains confluence modification which is required for new features
- feature: properties daily.%i are set (like wunderground does)
- feature: freely configurable units
- feature: clicking on side menu button allows cycling through available maps

Available Units (if unset it falls back to regional settings):
Temp: Celsius, Fahrenheit, Kelvin
Speed: m/s, km/h, mph, knots, beaufort scale

Available Maps: Temperature, Rain, Snow, Pressure, Clouds, Wind, Precipitation

Screenshots:
[Image: qfxeb74e.png]

[Image: cg5nmuvx.png]

Download:
http://www.file-upload.net/download-8442...5.zip.html
Mirror: http://www.sendspace.com/file/kmk0eb


Because all possible new feature will require additional skin modifications, i stop implementing new features at this point, waiting for feedback to get an idea in which direction development should go further on.
(This post was last modified: 2013-12-25 18:24 by Bitboy.)
find quote
schumi2004 Online
Posting Freak
Posts: 1,445
Joined: Aug 2011
Reputation: 14
Post: #7
Can't seem to download it, Chrome browser.
find quote
Bitboy Offline
Junior Member
Posts: 26
Joined: Dec 2013
Reputation: 2
Location: Germany
Post: #8
mhh its working with firefox. I added a mirror so you can try again.
find quote
schumi2004 Online
Posting Freak
Posts: 1,445
Joined: Aug 2011
Reputation: 14
Post: #9
(2013-12-25 18:27)Bitboy Wrote:  mhh its working with firefox. I added a mirror so you can try again.

Works, thanks Wink
find quote
allophos Offline
Junior Member
Posts: 2
Joined: Jan 2014
Reputation: 0
Post: #10
Hello,

This addon is exactly what i was looking for! well done!

But i'm using openelec and i don't fin the 720p folder! Someone can help me?

i'll do a french translation file and post it here saturday

see you
find quote
Bitboy Offline
Junior Member
Posts: 26
Joined: Dec 2013
Reputation: 2
Location: Germany
Post: #11
Hi,

thx for feedback. I don't have an openelec installation right now, but according to this post http://openelec.tv/forum/67-display/4830...nce-folder
the folder should be here /usr/share/xbmc/addons/skin.confluence

An additional translation would be nice Smile
find quote
allophos Offline
Junior Member
Posts: 2
Joined: Jan 2014
Reputation: 0
Post: #12
hello,

you'll find the french translation file at http://www.partage-fichiers.com/upload/bq1upn1x/ (the link will be disabled on 29/01/14)

thanks for the folder where put the files, but i can't add file here (i think i've no permission). I have to find how to change it.

see you
find quote
Bitboy Offline
Junior Member
Posts: 26
Joined: Dec 2013
Reputation: 2
Location: Germany
Post: #13
Thx for your translation.

There is a small mistake in it.
msgid is always the english version while msgstr is the translation. but thats no problem. i correct that for you and it will be included within the next version.
find quote
falafael Offline
Fan
Posts: 504
Joined: Aug 2006
Reputation: 1
Location: Nottinghamshire, united kingdom
Post: #14
gonna give iy a go, do you get 10 day forecasts?

[Image: widget]
find quote
Bitboy Offline
Junior Member
Posts: 26
Joined: Dec 2013
Reputation: 2
Location: Germany
Post: #15
yes 10day forecast is available but you need to apply the skin changes
find quote
Post Reply