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.
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/47702...l-datetime
(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/47702...l-datetime
Pointless because you still don't get what xbmc has set in the settings
Does that respect XBMC settings?
[Edit: Martijn got there before me]
Code:
timezone = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Settings.GetSettingValue", "params": {"setting": "locale.timezone"}, "id": 1}')
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.
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'.
(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
ah, didn't know that. apparently it's indeed os dependend.
For reference I'm now ignoring the kodi setting and get the local timezone from dateutil. Should do the trick.