
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
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 kodi-ws
var kodi = require('kodi-ws');
kodi('localhost', 9090).then(function(connection) {
/* Do something with the connection */
});
The connection object emits the following events:
Emitted whenever the underlying websocket throws an error or a server response cannot be parsed.
Emitted if the underlying socket is closed.
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');
})
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}
});
You can send batch requests like so:
var batch = connection.batch();
var movies = batch.VideoLibrary.GetMovies({properties: ['title']});
var shows = batch.VideoLibrary.GetTVShows({properties: ['title']});
batch.send();
Promise.all([movies, shows]).then(function(data) {
/* Movies */
console.log(data[0]);
/* TVShows */
console.log(data[1]);
});
Notice the Promise.all() is optional and used here to have simpler sample code.
And just for good measure an example which uses ES7 async functions.
let kodi = require('kodi-ws')('localhost', 9090);
async function doStuff() {
let con = await kodi;
console.log(await con.VideoLibrary.GetMovies({properties: ['title']}));
console.log(await con.VideoLibrary.GetTVShows({properties: ['title']}));
}
doStuff().catch(e => console.error(e));
Look for more examples in the examples directory.
You can find kodi's official documentation of the JSON-RCP API here and the full list of available commands (for protocol version 6) here.
FAQs
A wrapper for the kodi jsonrpc interface
We found that kodi-ws demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.