From 222af0cb114c499c57053b3a08d314900737f5e9 Mon Sep 17 00:00:00 2001 From: gtuk Date: Sun, 7 Sep 2014 15:10:23 +0200 Subject: [PATCH] Add xbmc streaming support --- bin/cmd.js | 11 +++++++++++ package.json | 1 + 2 files changed, 12 insertions(+) diff --git a/bin/cmd.js b/bin/cmd.js index 282b9461..48e73d19 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -2,6 +2,7 @@ var airplay = require('airplay-js') var chromecast = require('chromecast-js') +var xbmc = require('nodebmc') var clivas = require('clivas') var cp = require('child_process') var debug = require('debug')('webtorrent:cmd') @@ -40,6 +41,7 @@ var argv = minimist(process.argv.slice(2), { 'mpv', 'airplay', 'chromecast', + 'xbmc', 'list', 'no-quit', 'remove', @@ -77,6 +79,7 @@ if (argv.help || !torrentId) { --airplay stream to Apple TV (AirPlay) --chromecast stream to Chromecast + --xbmc stream to XBMC --vlc stream in VLC --mplayer stream in MPlayer --mpv stream in MPV @@ -234,6 +237,7 @@ function onTorrent (torrent) { var cmd, player var playerName = argv.airplay ? 'Airplay' : argv.chromecast ? 'Chromecast' + : argv.xbmc ? 'XBMC' : argv.vlc ? 'VLC' : argv.mplayer ? 'MPlayer' : argv.mpv ? 'mpv' @@ -299,6 +303,13 @@ function onTorrent (torrent) { }) } + if (argv.xbmc) { + ;(new xbmc.Browser()) + .on('deviceOn', function (device) { + device.play(href, function () {}) + }) + } + var hotswaps = 0 torrent.on('hotswap', function () { hotswaps += 1 diff --git a/package.json b/package.json index 1acb9afa..1d5e4280 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "mkdirp": "^0.5.0", "moment": "^2.8.2", "network-address": "0.0.4", + "nodebmc": "^0.0.3", "numeral": "^1.5.3", "once": "^1.3.0", "parse-torrent": "^2.1.2",