Skip to main content

SAKÉ: Simple ASCII Kodi Emulator

License GitHub Workflow Status (branch) Quality Gate Status Python

alt text

SAKÉ: your favourite 'drink' for debugging and developing Kodi Python add-ons

SAKÉ can help you to debug and develop Kodi Python add-ons. It contains a set of libraries that try to mimic the functionality of the corresponding Kodi modules:

Module Purpose
xbmc General functions on Kodi
xbmcaddon Kodi’s addon class
xbmcgui GUI functions on Kodi.
xbmcplugin Plugin functions on Kodi.
xbmcvfs Virtual file system functions on Kodi.

Not all libraries are present and certainly not all methods are implemented. Currently missing are:

Module Purpose
xbmcdrm Kodi’s DRM class.

Feel free to contribute to the completion using Pull Requests for this repository.

Using SAKÉ

SAKÉ can be installed using the pip install command:

$ pip install sakee

This will install SAKÉ in the active Python installation. It will be available directly to all your Python scripts. If you choose to not use pip install and want to run it from a specific (custom) location then you will need to include its path the Python paths. Either via:

sys.path.append('<path to SAKÉ>')

Or by appending the SAKÉ path to the Python path environment variable: PYTHONPATH

Configuration

SAKÉ requires you to run with your add-on as the main working directory. Running it outside of that directory will fail.

If your add-on is in a subfolder of Kodi's addons folder, you are done. SAKÉ will try to find its own way and determine what your Kodi path is and where your profile is stored. However, if you are running it standalone, so without Kodi at all, or if SAKÉ got 'drunk' and lost its way, you can always specify some directions using environment variables as follows:

Environment Variable Description
KODI_HOME If specified, will force SAKÉ to look at that path for Kodi's home path.
KODI_PROFILE If specified, will force SAKÉ to use this folder as the Kodi 'master' profile (user_data) folder. This will disable the auto detection of the profile folder based on Kodi's home path.
KODI_ACTIVE_PROFILE SAKÉ will assume that you don't have any Kodi profiles, but in case you have, you can specify what profile to use for the add-on settings.
KODI_INTERACTIVE Normally, SAKÉ will try to interact with you: Whenever there should be a dialog shown within Kodi, SAKÉ will present you with an ASCII version and wait for a response. You can disable this by setting this environment variable to "0". SAKÉ will not disturb you and will continue. However, SAKÉ will answer those dialogs for you and that might result in unwanted actions, but it might come in handy while running unit tests.
KODI_STUB_VERBOSE If set to "1" will make SAKÉ a bit more verbose.
KODI_STUB_RPC_RESPONSES Specifies the folder from which to read JSON RPC responses. If you don't set this, you won't be able to use xbmc.executeJSONRPC
KODI_STUB_INPUT Specify the default input for the keyboard input

JSON RPC responses

In order to respond to the JSON RPC requests, issued via executeJSONRPC, a folder with response files can be configured using the KODI_STUB_RPC_RESPONSES environment variable (see above). This folder should contain response files with the following naming conversions:

<method_name>.json

So, for instance favourites.getfavourites.json. Inside the file there is:

  • A single complete JSON response. In this case, the complete content of the file will be used, as is, as the JSON RPC response.
  • A list of JSON request-response pairs with different input parameters. Using the input parameters of the JSON RPC request, the correct response is determined and returned as the JSON RPC response.

In the latter case, the content of a stub file could look like this:

[
  {
    "request": {
      "params": {
        "setting": "network.usehttpproxy"
      },
      "jsonrpc": "2.0",
      "method": "Settings.GetSettingValue",
      "id": 0
    },
    "response": {
      "id": 5,
      "jsonrpc": "2.0",
      "result": {
        "value": false
      }
    }
  },
  {
    "request": {
      "params": {
        "setting": "network.httpproxyusername"
      },
      "jsonrpc": "2.0",
      "method": "Settings.GetSettingValue",
      "id": 0
    },
    "response": {
      "id": 5,
      "jsonrpc": "2.0",
      "result": {
        "value": true
      }
    }
  }
]

This stub file contains responses for the method Settings.GetSettingValue for the setting network.usehttpproxy and network.httpproxyusername.

If no file with matching method name is found or the file does not contain the correct responses an 'OK' is returned:

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "OK"
}

Just like most of the Kodi JSON RPC calls do.

Metadata

Release files for sakee 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sakee 0.1.9
File Size Uploaded
sakee-0.1.9.tar.gz 58.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sakee 0.1.9
File Interpreter ABI Platform
sakee-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 110.8 kB

Release files / sakee-0.1.9.tar.gz

Download URL sakee-0.1.9.tar.gz
Size 58.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2d03c4557a61b535ac57ab5179b65c32cd5e6a97ab6416d027831f1dd7b0cfc8
BLAKE2b-256 checksum
How to use checksums
90e8f9ad5ef86f9d78ac7306d25c0b5051cf00a823ab653d7bfdde77db90c567
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / sakee-0.1.9-py3-none-any.whl

Download URL sakee-0.1.9-py3-none-any.whl
Size 52.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ce0edb2af6f450102369e67a0de41e00146af3b6da6193b5566e8dc9f514f30
BLAKE2b-256 checksum
How to use checksums
a780af478300bd879e24045e80c1abc99a5bf46b1fbdb1534f03b99a78f7eea8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page