Kodi
Kodi/XBMC class exposes JSON-RPC API and notifications
Example:
let kodi = new Kodi({ host, port, connectImmediately: true })
kodi.api.Player.PlayPause();
kodi.api.VideoLibrary.GetMovies().then(movies => ... );
Static Method Summary
Static Public Methods | ||
public static |
createKodiUrl(host: *, port: *): * |
Constructor Summary
Public Constructor | ||
public |
constructor(config: Object) Constructor takes an configuration object where you specify the host and TCP port for your Kodi/XBMC instance. |
Member Summary
Public Members | ||
public |
api: * |
|
public get |
|
|
public |
host: * |
|
public |
lastError: * |
|
public |
listeners: * |
|
public |
|
|
public |
port: * |
|
public |
socket: * |
|
public |
url: * |
|
public |
waiting: * |
Method Summary
Public Methods | ||
public |
connect(): * Establish web socket connection and clear any existing API. |
|
public |
Execute an arbitrary Kodi/XBMC JSON-RPC method over web socket. |
|
public |
Unsubscribe for notifications from Kodi/XBMC connection. |
|
public |
Subscribe for notifications from Kodi/XBMC connection. |
|
public |
Subscribe to a notification from Kodi/XBMC connection one time |
|
public |
Set the host and port |
Static Public Methods
public static createKodiUrl(host: *, port: *): * source
Params:
Name | Type | Attribute | Description |
host | * | ||
port | * |
Return:
* |
Public Constructors
public constructor(config: Object) source
Constructor takes an configuration object where you specify the host and TCP port for your Kodi/XBMC instance.
Params:
Name | Type | Attribute | Description |
config | Object | Configuration object |
|
config.host | String |
|
Kodi/XBMC Hos |
config.port | String |
|
Kodi/XBMC TCP Port |
config.connectImmediately | boolean |
|
Automatically establish connection or not. If false will wait for manual Kodi#connect call. |
Public Members
public api: * source
public host: * source
public lastError: * source
public listeners: * source
public port: * source
public socket: * source
public url: * source
public waiting: * source
Public Methods
public execute(method: string, params: Object): Promise<object, error> source
Execute an arbitrary Kodi/XBMC JSON-RPC method over web socket.
public off(method: string, fn: function): * source
Unsubscribe for notifications from Kodi/XBMC connection. Also applies for three websocket events 'open', 'error', and 'close'.
Return:
* | this |
public on(method: string, fn: function): * source
Subscribe for notifications from Kodi/XBMC connection. Can also subscribe to three websocket events 'open', 'error', and 'close'.
Return:
* | this |