0.8.0 • Published 8 years ago

xbmc v0.8.0

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

Kodi/XBMC node controller

Build Status Dependency Status

NPM Badge

This module uses XBMC JSON-RPC Api V6 to provice a rich and simple API to communicate with XMBC instances.

Gitter chat

Documentation

The xbmc module contains the following classes:

  • XbmcApi : API wrapper of available actions, notifications and media handling
  • TCPConnection : 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 :

{TCPConnection, XbmcApi} = require 'xbmc'

connection = new TCPConnection
  host:    '127.0.0.1'
  port:    9090
  verbose: true
xbmc = new XbmcApi
xbmc.setConnection connection

xbmc.on 'connection:open',                        -> console.log 'Connection is open'
xbmc.on 'connection:data', (data)                 -> console.log 'Received data:',         data
xbmc.on 'connection:notification', (notification) -> console.log 'Received notification:', notification

In JavaScript :

  var Xbmc = require('xbmc');

  var connection = new Xbmc.TCPConnection({
    host: '127.0.0.1',
    port: 9000,
    verbose: false
  });
  var xbmcApi = new Xbmc.XbmcApi;

  xbmcApi.setConnection(connection);

  xbmcApi.on('connection:data', function()  { console.log('onData');  });
  xbmcApi.on('connection:open', function()  { console.log('onOpen');  });
  xbmcApi.on('connection:close', function() { console.log('onClose'); });

TCPConnection uses a deferred (promise) mechanism. Following two examples are both working:

{TCPConnection, XbmcApi} = require 'xbmc'

connection = new TCPConnection
  host:    '127.0.0.1'
  port:    9090
  verbose: true

xbmc = new XbmcApi
xbmc.setConnection connection

# run actions after received a 'connection:open' event
xbmc.on 'connection:open', ->
  xbmc.message 'Hello World'
connection = new TCPConnection
  host:    '127.0.0.1'
  port:    9090
  verbose: true

xbmc = new xbmcApi
xbmc.setConnection connection

# enqueu actions so they are called a soon as connection is opened
xbmc.message 'Hello World'

SEE ALSO

TODO

More actions, new helpers, tests, ...

0.8.0

8 years ago

0.7.0

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.0

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.3.4

10 years ago

0.3.3

10 years ago

0.0.4-b

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.1

10 years ago

0.1.4

10 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4b

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago