Kodi Community Forum

Full Version: Can add-on code read the value of a XBMC/Kodi setting?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I need to read values of two XBMC/Kodi options controlled by the user via the Settings / Video / Subtitles GUI:

- Custom subtitle download destination toggle status (as opposed to simply saving it next to the video file)
- Custom subtitle download destination path in case the above option is active.

from the Python code of a subltitles service add-on.

Question is: Is there any Python API that allows me to do that?

My (Google, Wiki) searchs didn't find anything useful.

I only need to read, not modify these settings values.

TIA for any pointer.
dude no one helps people here soz hope someone does but i never got any
you can using JSON-RPC
Thanks Martijn.

Went with somethiong like this:

Code:
from json import loads

import xbmc


def _subtitles_setting(name):
    """
    Uses XBMC/Kodi JSON-RPC API to retrieve subtitles location settings values.
    """
    command = '''{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "Settings.GetSettingValue",
    "params": {
        "setting": "subtitles.%s"
    }
}'''
    result = xbmc.executeJSONRPC(command % name)
    py = loads(result)
    if 'result' in py and 'value' in py['result']:
        return py['result']['value']
    else:
        raise ValueError
(2014-11-23, 21:06)Martijn Wrote: [ -> ]you can using JSON-RPC

Is there any documentation for this? The Wiki docs regarding Kodi JSON-RPC seem outdated.
yes, it needs to be updated. But it's always a good idea to use the introspect function which gives the the most recent documentation: http://kodi.wiki/view/JSON-RPC_API/v3#JS...Introspect