menu: new "Add Fake Airplay" and "Add Fake Chromecast" items

Fixes #21
This commit is contained in:
Feross Aboukhadijeh
2016-03-05 14:04:33 -08:00
parent ff1d5a6bb0
commit fc68a08de7
2 changed files with 41 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ var chromecasts = require('chromecasts')()
var createTorrent = require('create-torrent')
var dragDrop = require('drag-drop')
var electron = require('electron')
var EventEmitter = require('events')
var networkAddress = require('network-address')
var path = require('path')
var throttle = require('throttleit')
@@ -191,6 +192,13 @@ electron.ipcRenderer.on('fullscreenChanged', function (e, isFullScreen) {
update()
})
electron.ipcRenderer.on('addFakeDevice', function (e, device) {
var player = new EventEmitter()
player.play = (networkURL) => console.log(networkURL)
state.view.devices[device] = player
update()
})
function onFiles (files) {
// .torrent file = start downloading the torrent
files.filter(isTorrentFile).forEach(function (torrentFile) {
@@ -248,6 +256,8 @@ function torrentReady (torrent) {
}
function startServer (torrent, cb) {
if (state.server) return cb()
// use largest file
state.view.torrentPlaying = torrent.files.reduce(function (a, b) {
return a.length > b.length ? a : b