Solved How can I read kodi setting from addon code? (guisettings.xml)
#1
Can someone point me to how to read a kodi setting from a python script? (From "guisettings.xml")
All the advice I've found is about getting/setting an addon's own settings, not the global settings.

I want to get the value of "Preferred subtitle language" from Kodi's Settings ('locale.subtitlelanguage' in guisettings.xml)

Thanks.
Reply
#2
You can use Kodi's JSONRPC

python:
import xbmc
import json

json_string = {'jsonrpc': '2.0', 'id': 1, 'method': 'Settings.GetSettingValue', 'params': {'setting': 'locale.subtitlelanguage'}}
json_call = json.dumps(json_string)
result = xbmc.executeJSONRPC(json_call)
result = json.loads(result)
result = result['result']
result = result.get('value')
Reply
#3
@roidy

Thanks!!!
It works.

All the time I was trying "GUI.GetProperties".
Reply
#4
@roidy

By the way, can I also change a setting in this way or only read data?
Reply
#5
(2023-07-18, 23:32)burekas Wrote: @roidy

By the way, can I also change a setting in this way or only read data?

Yes.  See JSON RPC page.  Change to SetSettingValue and add value of the setting.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply

Logout Mark Read Team Forum Stats Members Help
How can I read kodi setting from addon code? (guisettings.xml)0