From 3e0528090e108bd62659c487d3072381f6496bdc Mon Sep 17 00:00:00 2001 From: DC Date: Thu, 17 Mar 2016 01:49:31 -0700 Subject: [PATCH] Torrent list: fix button alignment --- renderer/lib/cast.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/renderer/lib/cast.js b/renderer/lib/cast.js index df638cda..ccb213cf 100644 --- a/renderer/lib/cast.js +++ b/renderer/lib/cast.js @@ -40,8 +40,8 @@ function init (callback) { function addChromecastEvents () { state.devices.chromecast.on('error', function (err) { - err.message = 'Chromecast: ' + err.message - onError(err) + state.devices.chromecast.errorMessage = err.message + update() }) state.devices.chromecast.on('disconnect', function () { state.playing.location = 'local' @@ -53,18 +53,15 @@ function addChromecastEvents () { function addAirplayEvents () {} // Update our state from the remote TV -function pollCastStatus(state) { +function pollCastStatus (state) { var device if (state.playing.location === 'chromecast') device = state.devices.chromecast else if (state.playing.location === 'airplay') device = state.devices.airplay else return device.status(function (err, status) { - if (err) { - return console.log('Error retrieving %s status: %o', state.playing.location, err) - } - console.log('GOT CAST STATUS: %o', status) - handleStatus (status) + if (err) return console.log('Error getting %s status: %o', state.playing.location, err) + handleStatus(status) }) } @@ -79,7 +76,7 @@ function openChromecast () { } state.playing.location = 'chromecast-pending' - var torrentSummary = getTorrentSummary(state.playing.infoHash) + var torrentSummary = state.saved.torrents.find((x) => x.infoHash === state.playing.infoHash) state.devices.chromecast.play(state.server.networkURL, { type: 'video/mp4', title: config.APP_NAME + ' — ' + torrentSummary.name @@ -146,6 +143,6 @@ function getActiveDevice () { else throw new Error('getActiveDevice() called, but we\'re not casting') } -function castCallback (err) { - console.log('CAST CALLBACK: %o', arguments) +function castCallback () { + console.log('Cast callback: %o', arguments) }