Skip to content

Latest commit

History

136 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Kodi/XBMC node controller

Build StatusDependency 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=newTCPConnectionhost:'127.0.0.1'port:9090verbose:truexbmc=newXbmcApixbmc.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 :

varXbmc=require('xbmc');varconnection=newXbmc.TCPConnection({host: '127.0.0.1',port: 9000,verbose: false});varxbmcApi=newXbmc.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=newTCPConnectionhost:'127.0.0.1'port:9090verbose:truexbmc=newXbmcApixbmc.setConnection connection
# run actions after received a 'connection:open' eventxbmc.on'connection:open', ->xbmc.message'Hello World'
connection=newTCPConnectionhost:'127.0.0.1'port:9090verbose:truexbmc=newxbmcApixbmc.setConnection connection
# enqueu actions so they are called a soon as connection is openedxbmc.message'Hello World'

SEE ALSO

TODO

More actions, new helpers, tests, ...

About

📹 XBMC/Kodi api nodejs library (javascript, coffee)

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages