Kodi Community Forum
Get Timezone properties? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Get Timezone properties? (/showthread.php?tid=191098)



Get Timezone properties? - powlo - 2014-04-02

I can see that the timezone can be set under Appearance > Settings > International, but how can I access this setting in my script?

There doesn't seem to be any documentation.

Efforts such as xbmc.getInfoLabel('System.Timezone') don't work. (String 'System.Timezone' is echoed back)

I need something that can be dropped into pytz and works in Frodo, so I need 'Europe/London' etc.

Ta.


RE: Get Timezone properties? - powlo - 2014-04-07

Any help with this?


RE: Get Timezone properties? - Carb0 - 2014-04-07

I used the python-dateutil library to do this. You need to download the library and copy it to your add-on folder.

Here's an example on how to convert datetime strings with the dateutil library (not specific to XBMC):
http://stackoverflow.com/questions/4770297/python-convert-utc-datetime-string-to-local-datetime


Re: RE: Get Timezone properties? - Martijn - 2014-04-07

(2014-04-07, 18:41)Carb0 Wrote: I used the python-dateutil library to do this. You need to download the library and copy it to your add-on folder.

Here's an example on how to convert datetime strings with the dateutil library (not specific to XBMC):
http://stackoverflow.com/questions/4770297/python-convert-utc-datetime-string-to-local-datetime

Pointless because you still don't get what xbmc has set in the settings


RE: Get Timezone properties? - powlo - 2014-04-07

Does that respect XBMC settings?

[Edit: Martijn got there before me]


RE: Get Timezone properties? - Razze - 2015-01-31

Any news on this?


RE: Get Timezone properties? - ronie - 2015-01-31

Code:
timezone = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Settings.GetSettingValue", "params": {"setting": "locale.timezone"}, "id": 1}')



RE: Get Timezone properties? - Razze - 2015-01-31

Just returning {"id":1,"jsonrpc":"2.0","result":{"value":"default"}} for me on win 8.1. The setting is missing from the menu so I thought it would be set internally.


RE: Get Timezone properties? - ronie - 2015-02-01

returns {"id":1,"jsonrpc":"2.0","result":{"value":"Europe/Amsterdam"}} for me.

the settings is located here:
settings > appearance > international > timezone.
and make sure the 'settings level' is at least 'standard'.


RE: Get Timezone properties? - Razze - 2015-02-01

(2015-02-01, 17:02)ronie Wrote: returns {"id":1,"jsonrpc":"2.0","result":{"value":"Europe/Amsterdam"}} for me.

the settings is located here:
settings > appearance > international > timezone.
and make sure the 'settings level' is at least 'standard'.

Tried again my, level was standard even with expert it's not showing up. I'm suspecting it's hidden, becaus its auto set? And maybe not passed correctly to this field?
And yes it does work for some users, but for some it just shows "default" like in my case.

Quote:Allows to select Timezone you country is located in.
Note: For some OSes XBMC will take this information from the OS instead of having a setting.
http://kodi.wiki/view/Settings/Appearance


RE: Get Timezone properties? - ronie - 2015-02-01

ah, didn't know that. apparently it's indeed os dependend.


RE: Get Timezone properties? - Razze - 2015-02-01

https://github.com/xbmc/xbmc/blob/8d8946df2e3b833073c3adc2de32af9c1abc971c/xbmc/settings/Settings.cpp#L514

But whats with that default? Thats not usable in any way? You probably have the right one set somewhere, just need a valid one for my plugin (default doesn't work Wink )


RE: Get Timezone properties? - Razze - 2015-02-02

For reference I'm now ignoring the kodi setting and get the local timezone from dateutil. Should do the trick.