2.1.2 • Published 10 years ago

xbmc-ws v2.1.2

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
10 years ago

KODI JSON-RPC Websocket client

This module provides a simple way to communicate with an Kodi media center installation. It should not be restricted to a specific version of kodi, as it pulls all its information about the available methods from JSONRPC.Introspect.

Install via npm install xbmc-ws

Initiate

var kodi = require('xbmc-ws');

kodi('localhost', 9090).then(function(connection) {
	/* Do something with the connection */
});

Connection Object

Events

The connection object emits the following events:

error

Emitted whenever the underlying websocket throws an error.

close

Emitted if the underlying socket is closed.

Methods

.notification(method, cb)

Assigns a handler to a notfication sent by connection. The cb function will be passed a single argument containing the notifications data. method should be a string containing the notifications name.

connection.notification('Player.OnPause', function() {
	console.log('Paused');
});

Shorthand:

connection.Player.OnPause(function() {
	console.log('Paused');
})

.run(method, args...)

Runs the specified method. This function can be passed Parameters:

connection.run('Application.SetMute', true);

Shorthand:

connection.Application.SetMute(true);

The method returns a promise, which will be fulfilled as soon as the server responds. Multiple arguments can be passed either by order, or as an object by name:

var movies = connection.VideoLibrary.GetMovies(['title', 'rating', 'year'], {"start" : 0, "end": 2});

Arguments by name:

var movies = connection.VideoLibrary.GetMovies({
	properties: ['title', 'rating', 'year'],
	limits: {"start" : 0, "end": 2}
});
2.1.2

10 years ago

2.1.1

10 years ago

2.1.0

10 years ago

2.0.0

10 years ago

1.1.1

12 years ago

1.1.0

12 years ago

1.0.0

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago