sakee


Namesakee JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/retrospect-addon/kodi.emulator.ascii
SummarySAKÉ can help you to debug and develop Kodi Python add-ons
upload_time2023-10-21 23:28:31
maintainer
docs_urlNone
authorBas Rieter
requires_python>=2.7
licenseGPL-3.0
keywords kodi emulator ascii xbmc xbmcgui xbmcplugin xbmcaddon
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SAKÉ: Simple ASCII Kodi Emulator
[![License](https://img.shields.io/github/license/retrospect-addon/kodi.emulator.ascii?color=brightgreen)](LICENSE.md)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/retrospect-addon/kodi.emulator.ascii/unittests.yml?branch=master)](https://github.com/retrospect-addon/kodi.emulator.ascii/actions?query=workflow%3Aunit-tests)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=retrospect-addon%3Akodi.emulator.ascii&metric=alert_status)](https://sonarcloud.io/dashboard?id=retrospect-addon%3Akodi.emulator.ascii)
[![Python](https://img.shields.io/badge/python-2.7%20%7C%203.6-blue?logo=python)](https://kodi.tv/article/attention-addon-developers-migration-python-3)

![alt text](https://github.com/retrospect-addon/kodi.emulator.ascii/raw/master/sake.png "Simple ASCII Kodi Emulator")

## _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:

```Python
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:

```json
[
  {
    "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:

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

Just like most of the Kodi JSON RPC calls do.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/retrospect-addon/kodi.emulator.ascii",
    "name": "sakee",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=2.7",
    "maintainer_email": "",
    "keywords": "Kodi,emulator,ascii,xbmc,xbmcgui,xbmcplugin,xbmcaddon",
    "author": "Bas Rieter",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/10/db/fa7fabaae34dad28843e65959f9ef3329193519482b78c99b242072c8fd7/sakee-0.1.6.tar.gz",
    "platform": null,
    "description": "# SAK\u00c9: Simple ASCII Kodi Emulator\n[![License](https://img.shields.io/github/license/retrospect-addon/kodi.emulator.ascii?color=brightgreen)](LICENSE.md)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/retrospect-addon/kodi.emulator.ascii/unittests.yml?branch=master)](https://github.com/retrospect-addon/kodi.emulator.ascii/actions?query=workflow%3Aunit-tests)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=retrospect-addon%3Akodi.emulator.ascii&metric=alert_status)](https://sonarcloud.io/dashboard?id=retrospect-addon%3Akodi.emulator.ascii)\n[![Python](https://img.shields.io/badge/python-2.7%20%7C%203.6-blue?logo=python)](https://kodi.tv/article/attention-addon-developers-migration-python-3)\n\n![alt text](https://github.com/retrospect-addon/kodi.emulator.ascii/raw/master/sake.png \"Simple ASCII Kodi Emulator\")\n\n## _SAK\u00c9_: your favourite 'drink' for debugging and developing Kodi Python add-ons\nSAK\u00c9 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:\n\n| Module       | Purpose                                |\n|--------------|----------------------------------------|\n| `xbmc`       | General functions on Kodi              |\n| `xbmcaddon`  | Kodi\u2019s addon class                     |\n| `xbmcgui`    | GUI functions on Kodi.                 |\n| `xbmcplugin` | Plugin functions on Kodi.              |\n| `xbmcvfs`    | Virtual file system functions on Kodi. |\n\nNot all libraries are present and certainly not all methods are implemented. Currently missing are:\n\n| Module    | Purpose           |\n|-----------|-------------------|\n| `xbmcdrm` | Kodi\u2019s DRM class. |\n\nFeel free to contribute to the completion using Pull Requests for this repository.\n\n### Using _SAK\u00c9_\nSAK\u00c9 can be installed using the `pip install` command:\n\n    $ pip install sakee\n    \nThis will install SAK\u00c9 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:\n\n```Python\nsys.path.append('<path to SAK\u00c9>')\n```\n\nOr by appending the _SAK\u00c9_ path to the Python path environment variable: `PYTHONPATH`\n\n### Configuration\n_SAK\u00c9_ requires you to run with your add-on as the main _working directory_. Running it outside of that directory will fail. \n\nIf your add-on is in a subfolder of Kodi's `addons` folder, you are done. _SAK\u00c9_ 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\u00c9_ got 'drunk' and lost its way, you can always specify some directions using environment variables as follows:\n\n| Environment Variable | Description |\n|----------------------|-------------|\n| `KODI_HOME`          | If specified, will force _SAK\u00c9_ to look at that path for Kodi's home path. |\n| `KODI_PROFILE` | If specified, will force _SAK\u00c9_ 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. |\n| `KODI_ACTIVE_PROFILE` | _SAK\u00c9_ 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. |\n| `KODI_INTERACTIVE`   | Normally, _SAK\u00c9_ will try to interact with you: Whenever there should be a dialog shown within Kodi, _SAK\u00c9_ will present you with an ASCII version and wait for a response. You can disable this by setting this environment variable to \"0\". _SAK\u00c9_ will not disturb you and will continue. However, _SAK\u00c9_ will answer those dialogs for you and that **might result in unwanted actions**, but it might come in handy while running unit tests.|\n| `KODI_STUB_VERBOSE` | If set to \"1\" will make _SAK\u00c9_ a bit more verbose. |\n| `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` |\n| `KODI_STUB_INPUT` | Specify the default input for the keyboard input |\n\n### JSON RPC responses\nIn 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:\n\n    <method_name>.json\n    \nSo, for instance `favourites.getfavourites.json`. Inside the file there is: \n\n- A single complete JSON response. In this case, the complete content of the file will be used, as is, as the JSON RPC response.\n- 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.\n\nIn the latter case, the content of a stub file could look like this:\n\n```json\n[\n  {\n    \"request\": {\n      \"params\": {\n        \"setting\": \"network.usehttpproxy\"\n      },\n      \"jsonrpc\": \"2.0\",\n      \"method\": \"Settings.GetSettingValue\",\n      \"id\": 0\n    },\n    \"response\": {\n      \"id\": 5,\n      \"jsonrpc\": \"2.0\",\n      \"result\": {\n        \"value\": false\n      }\n    }\n  },\n  {\n    \"request\": {\n      \"params\": {\n        \"setting\": \"network.httpproxyusername\"\n      },\n      \"jsonrpc\": \"2.0\",\n      \"method\": \"Settings.GetSettingValue\",\n      \"id\": 0\n    },\n    \"response\": {\n      \"id\": 5,\n      \"jsonrpc\": \"2.0\",\n      \"result\": {\n        \"value\": true\n      }\n    }\n  }\n]\n```\n\nThis stub file contains responses for the method `Settings.GetSettingValue` for the setting `network.usehttpproxy` and `network.httpproxyusername`.\n\nIf no file with matching method name is found or the file does not contain the correct responses an 'OK' is returned:\n\n```json\n{\n  \"id\": 1,\n  \"jsonrpc\": \"2.0\",\n  \"result\": \"OK\"\n}\n``` \n\nJust like most of the Kodi JSON RPC calls do.\n",
    "bugtrack_url": null,
    "license": "GPL-3.0",
    "summary": "SAK\u00c9 can help you to debug and develop Kodi Python add-ons",
    "version": "0.1.6",
    "project_urls": {
        "Documentation": "https://github.com/retrospect-addon/kodi.emulator.ascii/blob/master/README.md",
        "Homepage": "https://github.com/retrospect-addon/kodi.emulator.ascii",
        "Source": "https://github.com/retrospect-addon/kodi.emulator.ascii/",
        "Tracker": "https://github.com/retrospect-addon/kodi.emulator.ascii/issues"
    },
    "split_keywords": [
        "kodi",
        "emulator",
        "ascii",
        "xbmc",
        "xbmcgui",
        "xbmcplugin",
        "xbmcaddon"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e1703b97131835d3f51e7c7f3899ea69241bcf106d27b0ec47730f4f4b86a5f2",
                "md5": "85dc39b5ce30106d899a2421785e8975",
                "sha256": "d6489e181545a23795d0487ca2246e0fc595f9ed8c89ba1ac50f2fd6a2528085"
            },
            "downloads": -1,
            "filename": "sakee-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "85dc39b5ce30106d899a2421785e8975",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=2.7",
            "size": 46880,
            "upload_time": "2023-10-21T23:28:30",
            "upload_time_iso_8601": "2023-10-21T23:28:30.475933Z",
            "url": "https://files.pythonhosted.org/packages/e1/70/3b97131835d3f51e7c7f3899ea69241bcf106d27b0ec47730f4f4b86a5f2/sakee-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10dbfa7fabaae34dad28843e65959f9ef3329193519482b78c99b242072c8fd7",
                "md5": "2f526c0ca16c32c64d0f19b94cc37e43",
                "sha256": "0aa9d26f456dbc09f53097246dad82f806ef13c0005f9efdd657ea965db9534b"
            },
            "downloads": -1,
            "filename": "sakee-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "2f526c0ca16c32c64d0f19b94cc37e43",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7",
            "size": 44268,
            "upload_time": "2023-10-21T23:28:31",
            "upload_time_iso_8601": "2023-10-21T23:28:31.900859Z",
            "url": "https://files.pythonhosted.org/packages/10/db/fa7fabaae34dad28843e65959f9ef3329193519482b78c99b242072c8fd7/sakee-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-21 23:28:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "retrospect-addon",
    "github_project": "kodi.emulator.ascii",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "sakee"
}
        
Elapsed time: 0.13285s