Kodi/XBMC node controller
This module uses XBMC JSON-RPC Api V6 to provice a rich and simple API to communicate with XMBC instances.
Documentation
The xbmc
module contains the following classes:
XbmcApi
: API wrapper of available actions, notifications and media handlingTCPConnection
: TCP Client to communicate with XBMC
Basics
All classes are created asynchronously.
All classes are sharing an EventEmitter
instance.
XbmcApi.on
and XbmcApi.emit
are wrappers to the shared PubSub. For instance:
In CoffeeScript :
require 'xbmc' connection = host: '127.0.0.1' port: 9090 verbose: truexbmc = xbmcsetConnection connection xbmcon 'connection:open'-> consolelog 'Connection is open'xbmcon 'connection:data' consolelog 'Received data:'dataxbmcon 'connection:notification' consolelog 'Received notification:'notification
In JavaScript :
var Xbmc = ; var connection = host: '127.0.0.1' port: 9000 verbose: false ; var xbmcApi = ; xbmcApi; xbmcApi; xbmcApi; xbmcApi;
TCPConnection uses a deferred (promise) mechanism. Following two examples are both working:
require 'xbmc' connection = host: '127.0.0.1' port: 9090 verbose: true xbmc = xbmcsetConnection connection # run actions after received a 'connection:open' event xbmcon 'connection:open'-> xbmcmessage 'Hello World'
connection = host: '127.0.0.1' port: 9090 verbose: true xbmc = xbmcsetConnection connection # enqueu actions so they are called a soon as connection is opened xbmcmessage 'Hello World'
SEE ALSO
TODO
More actions, new helpers, tests, ...