iobroker.chromecast
Advanced tools
Comparing version 1.3.0 to 1.3.3
@@ -9,3 +9,3 @@ /** | ||
/*jslint node: true */ | ||
"use strict"; | ||
'use strict'; | ||
@@ -25,3 +25,3 @@ //For profiling: comment out the following block and connect to | ||
// you have to require the utils module and call adapter function | ||
var utils = require(__dirname + '/lib/utils'); // Get common adapter utils | ||
const utils = require(__dirname + '/lib/utils'); // Get common adapter utils | ||
@@ -31,3 +31,3 @@ // you have to call the adapter function and pass a options object | ||
// adapter will be restarted automatically every time as the configuration changed, e.g system.adapter.template.0 | ||
var adapter = utils.adapter('chromecast'); | ||
const adapter = new utils.Adapter('chromecast'); | ||
@@ -52,4 +52,4 @@ // is called when adapter shuts down - callback has to be called under any circumstances! | ||
adapter.on('message', function (obj) { | ||
if (typeof obj == 'object' && obj.message) { | ||
if (obj.command == 'send') { | ||
if (typeof obj === 'object' && obj.message) { | ||
if (obj.command === 'send') { | ||
// e.g. send email or pushover or whatever | ||
@@ -70,10 +70,10 @@ console.log('send command'); | ||
var SCAN_INTERVAL = 10000; | ||
// const SCAN_INTERVAL = 10000; | ||
function main() { | ||
//Own libraries | ||
var LogWrapper = require('castv2-player').LogWrapper; | ||
var Scanner = require('castv2-player').Scanner(new LogWrapper(adapter.log)); | ||
const LogWrapper = require('castv2-player').LogWrapper; | ||
const Scanner = require('castv2-player').Scanner(new LogWrapper(adapter.log)); | ||
var ChromecastDevice = require('./lib/chromecastDevice')(adapter); | ||
const ChromecastDevice = require('./lib/chromecastDevice')(adapter); | ||
@@ -88,14 +88,2 @@ // The adapters config (in the instance object everything under the attribute "native") is accessible via | ||
/** | ||
* | ||
* For every state in the system there has to be also an object of type state | ||
* | ||
* Here a simple template for a boolean variable named "testVariable" | ||
* | ||
* Because every adapter instance uses its own unique namespace variable names can't collide with other adapters variables | ||
* | ||
*/ | ||
// in this template all states changes inside the adapters namespace are subscribed | ||
@@ -102,0 +90,0 @@ adapter.subscribeStates('*'); |
@@ -5,3 +5,3 @@ { | ||
"title": "Chromecast Adapter", | ||
"version": "1.3.0", | ||
"version": "1.3.3", | ||
"license": "MIT", | ||
@@ -12,3 +12,3 @@ "authors": ["Vegetto <iobroker@angelnu.com>"], | ||
"de": "ioBroker Chromecast Adapter", | ||
"ru": "Позволяет находить и проигрывть файлы с ioBroker Chromecast" | ||
"ru": "Позволяет находить и проигрывть файлы в Chromecast" | ||
}, | ||
@@ -23,3 +23,3 @@ "platform": "Javascript/Node.js", | ||
"loglevel": "info", | ||
"type": "media", | ||
"type": "multimedia", | ||
"dependencies": [{"vis": ">=0.10.0"}], | ||
@@ -35,2 +35,2 @@ "restartAdapters": ["vis"] | ||
] | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
/*jshint esversion: 6 */ | ||
@@ -11,5 +11,5 @@ /*jslint node: true */ | ||
var fs = require('fs'); | ||
var LogWrapper = require('castv2-player').LogWrapper; | ||
var MediaPlayer = require('castv2-player').MediaPlayer(new LogWrapper(adapter.log)); | ||
const fs = require('fs'); | ||
const LogWrapper = require('castv2-player').LogWrapper; | ||
const MediaPlayer = require('castv2-player').MediaPlayer(new LogWrapper(adapter.log)); | ||
//if (process.env.NODE_ENV !== 'production'){ | ||
@@ -30,3 +30,3 @@ // require('longjohn'); | ||
//Some constants | ||
that._NAMESPACE = adapter.namespace + "." + that._name; | ||
that._NAMESPACE = adapter.namespace + '.' + that._name; | ||
@@ -76,4 +76,4 @@ //MEDIA PLAYER | ||
var CHANNEL_STATUS = name + '.status'; | ||
var channels = { | ||
//var CHANNEL_STATUS = name + '.status'; | ||
const channels = { | ||
'status': { | ||
@@ -286,2 +286,11 @@ name: name + '.status', | ||
}, | ||
'currentItemId': { | ||
name: channels.playlist.name + '.currentItemId', | ||
def: [], | ||
type: 'number', | ||
read: true, | ||
write: false, | ||
role: 'status', | ||
desc: 'ItemId of element being played' | ||
}, | ||
'jump': { | ||
@@ -442,3 +451,3 @@ name: channels.playlist.name + '.jump', | ||
if (!state) { | ||
adapter.setState(states.url2play.name, {val: "http:/example.org/playme.mp3", ack: true}); | ||
adapter.setState(states.url2play.name, {val: 'http:/example.org/playme.mp3', ack: true}); | ||
} | ||
@@ -518,11 +527,11 @@ }); | ||
//Video Chromecast-only | ||
adapter.setState(that._states.isActiveInput.name, {val: ("isActiveInput" in status ? status.isActiveInput: true), ack: true}); | ||
adapter.setState(that._states.isStandBy.name, {val: ("isStandBy" in status ? status.isStandBy : false), ack: true}); | ||
adapter.setState(that._states.isActiveInput.name, {val: ('isActiveInput' in status ? status.isActiveInput: true), ack: true}); | ||
adapter.setState(that._states.isStandBy.name, {val: ('isStandBy' in status ? status.isStandBy : false), ack: true}); | ||
if ("applications" in status) | ||
if ('applications' in status) | ||
{ | ||
let currentApplicationObject = status.applications[0]; | ||
adapter.setState(that._states.displayName.name, {val: ("displayName" in currentApplicationObject ? currentApplicationObject.displayName: ""), ack: true}); | ||
adapter.setState(that._states.statusText.name, {val: ("statusText" in currentApplicationObject ? currentApplicationObject.statusText: ""), ack: true}); | ||
adapter.setState(that._states.displayName.name, {val: ('displayName' in currentApplicationObject ? currentApplicationObject.displayName: ""), ack: true}); | ||
adapter.setState(that._states.statusText.name, {val: ('statusText' in currentApplicationObject ? currentApplicationObject.statusText: ""), ack: true}); | ||
} | ||
@@ -602,4 +611,4 @@ } | ||
//playerState | ||
let playerState = status.playerState ? status.playerState : "STOP"; | ||
let cachedPlayerState = cachedStatus.playerState ? cachedStatus.playerState : "STOP"; | ||
let playerState = status.playerState ? status.playerState : 'STOP'; | ||
let cachedPlayerState = cachedStatus.playerState ? cachedStatus.playerState : 'STOP'; | ||
that.setStateIfChanged (that._states.playerState.name, | ||
@@ -616,9 +625,22 @@ {val: playerState, ack: true}, | ||
that.setStateIfChanged(that._states.paused.name, | ||
{val: (status.playerState == "PAUSED"), ack: true}, | ||
(cachedStatus.playerState == "PAUSED")); | ||
{val: (status.playerState === 'PAUSED'), ack: true}, | ||
(cachedStatus.playerState === 'PAUSED')); | ||
//Playlist | ||
that.setStateIfChanged(that._states.playlist.name, | ||
{val: JSON.stringify(status.items), ack: true}, | ||
cachedStatus.items); | ||
if (status.items && | ||
status.items.length > 0 && | ||
status.items[0].media) { | ||
that.setStateIfChanged(that._states.playlist.name, | ||
{val: JSON.stringify(status.items), ack: true}, | ||
JSON.stringify(cachedStatus.items)); | ||
} else { | ||
//Uncompleted status - trigger a new one - this happens after the playlist starts again | ||
that._mediaPlayer.getStatusPromise(); | ||
} | ||
//Current Item Id | ||
that.setStateIfChanged(that._states.currentItemId.name, | ||
{val: status.currentItemId, ack: true}, | ||
cachedStatus.currentItemId); | ||
@@ -630,13 +652,13 @@ //repeatMode | ||
that.setStateIfChanged(that._states.repeatOff.name, | ||
{val: (status.repeatMode == "REPEAT_OFF"), ack: true}, | ||
(cachedStatus.repeatMode == "REPEAT_OFF")); | ||
{val: (status.repeatMode === 'REPEAT_OFF'), ack: true}, | ||
(cachedStatus.repeatMode === 'REPEAT_OFF')); | ||
that.setStateIfChanged(that._states.repeatAll.name, | ||
{val: (status.repeatMode == "REPEAT_ALL"), ack: true}, | ||
(cachedStatus.repeatMode == "REPEAT_ALL")); | ||
{val: (status.repeatMode === 'REPEAT_ALL'), ack: true}, | ||
(cachedStatus.repeatMode === 'REPEAT_ALL')); | ||
that.setStateIfChanged(that._states.repeatAllShuffle.name, | ||
{val: (status.repeatMode == "REPEAT_ALL_AND_SHUFFLE"), ack: true}, | ||
(cachedStatus.repeatMode == "REPEAT_ALL_AND_SHUFFLE")); | ||
{val: (status.repeatMode === 'REPEAT_ALL_AND_SHUFFLE'), ack: true}, | ||
(cachedStatus.repeatMode === 'REPEAT_ALL_AND_SHUFFLE')); | ||
that.setStateIfChanged(that._states.repeatSingle.name, | ||
{val: (status.repeatMode == "REPEAT_SINGLE"), ack: true}, | ||
(cachedStatus.repeatMode == "REPEAT_SINGLE")); | ||
{val: (status.repeatMode === 'REPEAT_SINGLE'), ack: true}, | ||
(cachedStatus.repeatMode === 'REPEAT_SINGLE')); | ||
@@ -646,9 +668,9 @@ | ||
that.setStateIfChanged(that._states.playerVolume.name, | ||
{val: Math.round(("volume" in status ? status.volume.level : 1) * 100), ack: true}, | ||
Math.round(("volume" in cachedStatus ? cachedStatus.volume.level : 1) * 100)); | ||
{val: Math.round(('volume' in status ? status.volume.level : 1) * 100), ack: true}, | ||
Math.round(('volume' in cachedStatus ? cachedStatus.volume.level : 1) * 100)); | ||
//muted | ||
that.setStateIfChanged(that._states.playerMuted.name, | ||
{val: ("volume" in status ? status.volume.muted : false), ack: true}, | ||
("volume" in cachedStatus ? cachedStatus.volume.muted : false)); | ||
{val: ('volume' in status ? status.volume.muted : false), ack: true}, | ||
('volume' in cachedStatus ? cachedStatus.volume.muted : false)); | ||
@@ -661,18 +683,18 @@ //Media channel status | ||
that.setStateIfChanged(that._states.streamType.name, | ||
{val: (media.streamType ? media.streamType : "Unknown"), ack: true}, | ||
(cachedMedia.streamType ? cachedMedia.streamType : "Unknown")); | ||
{val: (media.streamType ? media.streamType : 'Unknown'), ack: true}, | ||
(cachedMedia.streamType ? cachedMedia.streamType : 'Unknown')); | ||
//duration | ||
that.setStateIfChanged(that._states.duration.name, | ||
{val: (media.duration ? media.duration : "Unknown"), ack: true}, | ||
(cachedMedia.duration ? cachedMedia.duration : "Unknown")); | ||
{val: (media.duration ? media.duration : 'Unknown'), ack: true}, | ||
(cachedMedia.duration ? cachedMedia.duration : 'Unknown')); | ||
//contentType | ||
that.setStateIfChanged(that._states.contentType.name, | ||
{val: (media.contentType ? media.contentType : "Unknown"), ack: true}, | ||
(cachedMedia.contentType ? media.contentType : "Unknown")); | ||
{val: (media.contentType ? media.contentType : 'Unknown'), ack: true}, | ||
(cachedMedia.contentType ? media.contentType : 'Unknown')); | ||
//contentId | ||
let contentId = media.contentId ? media.contentId : "Unknown"; | ||
let cachedContentId = cachedMedia.contentId ? media.contentId : "Unknown"; | ||
let contentId = media.contentId ? media.contentId : 'Unknown'; | ||
let cachedContentId = cachedMedia.contentId ? media.contentId : 'Unknown'; | ||
that.setStateIfChanged(that._states.contentId.name, | ||
@@ -688,14 +710,14 @@ {val: contentId, ack: true}, | ||
that.setStateIfChanged(that._states.title.name, | ||
{val: (metadata.title ? metadata.title : "Unknown"), ack: true}, | ||
(cachedMetadata.title ? cachedMetadata.title : "Unknown")); | ||
{val: (metadata.title ? metadata.title : 'Unknown'), ack: true}, | ||
(cachedMetadata.title ? cachedMetadata.title : 'Unknown')); | ||
//album | ||
that.setStateIfChanged(that._states.album.name, | ||
{val: (metadata.albumName ? metadata.albumName : "Unknown"), ack: true}, | ||
(cachedMetadata.albumName ? cachedMetadata.albumName : "Unknown")); | ||
{val: (metadata.albumName ? metadata.albumName : 'Unknown'), ack: true}, | ||
(cachedMetadata.albumName ? cachedMetadata.albumName : 'Unknown')); | ||
//artist | ||
that.setStateIfChanged(that._states.artist.name, | ||
{val: (metadata.artist ? metadata.artist : "Unknown"), ack: true}, | ||
(cachedMetadata.artist ? cachedMetadata.artist : "Unknown")); | ||
{val: (metadata.artist ? metadata.artist : 'Unknown'), ack: true}, | ||
(cachedMetadata.artist ? cachedMetadata.artist : 'Unknown')); | ||
} | ||
@@ -715,9 +737,9 @@ | ||
if (url2play.indexOf("http") !== 0) { | ||
if (url2play.indexOf('http') !== 0) { | ||
//Not an http(s) URL -> assume local file | ||
adapter.log.info("%s - Not a http(s) URL -> asume local file for %s", that._name, url2play); | ||
adapter.log.info('%s - Not a http(s) URL -> asume local file for %s', that._name, url2play); | ||
//Check that the webserver has been configured | ||
if (adapter.config.webServer === "") { | ||
adapter.log.error(that._name + '- Sorry, cannot play file "' + url2play + '"'); | ||
adapter.log.error(that._name + '- Sorry, cannot play file "' + url2play + '"'); | ||
adapter.log.error(that._name + '- Please configure webserver settings first!'); | ||
@@ -727,3 +749,3 @@ return; | ||
let exported_file_state = adapter.namespace + "." + that._states.exportedMedia.name; | ||
let exported_file_state = adapter.namespace + '.' + that._states.exportedMedia.name; | ||
//Try to load in a local state | ||
@@ -739,7 +761,7 @@ try { | ||
url2play = 'http://' + adapter.config.webServer + ':8082/state/' + exported_file_state; | ||
adapter.log.info("Exported as " + url2play); | ||
adapter.log.info('Exported as ' + url2play); | ||
that._playURL(url2play, org_url2play, 'BUFFERED'); | ||
}); | ||
} catch (err) { | ||
adapter.log.error(that._name + ' - Cannot play file "' + url2play + '": ' + err.toString()); | ||
adapter.log.error(that._name + ' - Cannot play file "' + url2play + '": ' + err.toString()); | ||
} | ||
@@ -770,7 +792,10 @@ return; | ||
(id.indexOf(that._NAMESPACE) !== 0) || | ||
(state === undefined) || | ||
!state || | ||
// you can use the ack flag to detect if it is status (true) or command (false) | ||
state.ack || | ||
(state.from.indexOf(adapter.namespace) >= 0) | ||
) | ||
return; | ||
) { | ||
return; | ||
} | ||
@@ -780,17 +805,12 @@ // Warning, state can be null if it was deleted | ||
// you can use the ack flag to detect if it is status (true) or command (false) | ||
if (state.ack) | ||
return; | ||
//Is volume? | ||
else if (id.indexOf(adapter.namespace + "." + states.volume.name) === 0) { | ||
if (id.indexOf(adapter.namespace + '.' + states.volume.name) === 0) { | ||
that._mediaPlayer.setVolumePromise(state.val) | ||
//ACK written when status update sent by Chromecast | ||
.catch (function (err) { | ||
adapter.log.error(name + " - " + err); | ||
adapter.log.error(name + ' - ' + err); | ||
}); | ||
} | ||
//Is muted? | ||
else if (id.indexOf(adapter.namespace + "." + states.muted.name) === 0) { | ||
else if (id.indexOf(adapter.namespace + '.' + states.muted.name) === 0) { | ||
if (state.val) | ||
@@ -802,3 +822,3 @@ { | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not mute: " + err); | ||
adapter.log.error(name + ' - Could not mute: ' + err); | ||
}); | ||
@@ -810,3 +830,3 @@ } else { | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not unmute: " + err); | ||
adapter.log.error(name + ' - Could not unmute: ' + err); | ||
}); | ||
@@ -816,3 +836,3 @@ } | ||
//Is playing? | ||
else if (id.indexOf(adapter.namespace + "." + states.playing.name) === 0) { | ||
else if (id.indexOf(adapter.namespace + '.' + states.playing.name) === 0) { | ||
@@ -822,3 +842,3 @@ if (state.val) { | ||
adapter.getState(states.contentId.name, function (err, state) { | ||
if (state && state.val && state.val.startsWith("http")) { | ||
if (state && state.val && state.val.startsWith('http')) { | ||
that._playURL(state.val); | ||
@@ -828,3 +848,3 @@ } else { | ||
adapter.getState(states.url2play.name, function (err, state) { | ||
if (state && state.val && state.val.startsWith("http")) { | ||
if (state && state.val && state.val.startsWith('http')) { | ||
that._playURL(state.val); | ||
@@ -842,3 +862,3 @@ } else { | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not stop: " + err); | ||
adapter.log.error(name + ' - Could not stop: ' + err); | ||
}); | ||
@@ -848,3 +868,3 @@ } | ||
//Is paused? | ||
else if (id.indexOf(adapter.namespace + "." + states.paused.name) === 0) { | ||
else if (id.indexOf(adapter.namespace + '.' + states.paused.name) === 0) { | ||
if (state.val) { | ||
@@ -854,3 +874,3 @@ that._mediaPlayer.pausePromise() | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not pause: " + err); | ||
adapter.log.error(name + ' - Could not pause: ' + err); | ||
}); | ||
@@ -861,3 +881,3 @@ } else { | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not resume: " + err); | ||
adapter.log.error(name + ' - Could not resume: ' + err); | ||
}); | ||
@@ -867,3 +887,3 @@ } | ||
//Is jump? | ||
else if (id.indexOf(adapter.namespace + "." + states.jump.name) === 0) { | ||
else if (id.indexOf(adapter.namespace + '.' + states.jump.name) === 0) { | ||
that._mediaPlayer.jumpInPlaylistPromise(state.val) | ||
@@ -874,39 +894,43 @@ .then (function () { | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not jump: " + err); | ||
adapter.log.error(name + ' - Could not jump: ' + err); | ||
}); | ||
} | ||
//Is repeatMode? | ||
else if (id.indexOf(adapter.namespace + "." + states.repeatMode.name) === 0) { | ||
else if (id.indexOf(adapter.namespace + '.' + states.repeatMode.name) === 0) { | ||
adapter.log.error(name + ' - Please use the other boolean repeat variables to set repeat mode for ' + id); | ||
} | ||
//Is repeatOff? | ||
else if (id.indexOf(adapter.namespace + "." + states.repeatOff.name) === 0) { | ||
that._mediaPlayer.setRepeatModePromise(state.val?'REPEAT_OFF':'REPEAT_ALL') | ||
else if (id.indexOf(adapter.namespace + '.' + states.repeatOff.name) === 0) { | ||
that._mediaPlayer.setRepeatModePromise(state.val ? 'REPEAT_OFF' : 'REPEAT_ALL') | ||
//ACK written when status update sent by Chromecast | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not set repeatOff: " + err); | ||
adapter.log.error(name + ' - Could not set repeatOff: ' + err); | ||
}); | ||
} | ||
//Is repeatAllShuffle? | ||
else if (id.indexOf(adapter.namespace + "." + states.repeatAllShuffle.name) === 0) { | ||
that._mediaPlayer.setRepeatModePromise(state.val?'REPEAT_ALL_AND_SHUFFLE':'REPEAT_OFF') | ||
else if (id.indexOf(adapter.namespace + '.' + states.repeatAllShuffle.name) === 0) { | ||
that._mediaPlayer.setRepeatModePromise(state.val ? 'REPEAT_ALL_AND_SHUFFLE' : 'REPEAT_OFF') | ||
//ACK written when status update sent by Chromecast | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not repeatAllShuffle: " + err); | ||
adapter.log.error(name + ' - Could not repeatAllShuffle: ' + err); | ||
}); | ||
} | ||
//Is repeatAll? | ||
else if (id.indexOf(adapter.namespace + "." + states.repeatAll.name) === 0) { | ||
that._mediaPlayer.setRepeatModePromise(state.val?'REPEAT_ALL':'REPEAT_OFF') | ||
else if (id.indexOf(adapter.namespace + '.' + states.repeatAll.name) === 0) { | ||
that._mediaPlayer.setRepeatModePromise(state.val ? 'REPEAT_ALL' : 'REPEAT_OFF') | ||
//ACK written when status update sent by Chromecast | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not repeatAll: " + err); | ||
adapter.log.error(name + ' - Could not repeatAll: ' + err); | ||
}); | ||
} | ||
//Is repeatSingle? | ||
else if (id.indexOf(adapter.namespace + "." + states.repeatSingle.name) === 0) { | ||
that._mediaPlayer.setRepeatModePromise(state.val?'REPEAT_SINGLE':'REPEAT_OFF') | ||
else if (id.indexOf(adapter.namespace + '.' + states.repeatSingle.name) === 0) { | ||
that._mediaPlayer.setRepeatModePromise(state.val ? 'REPEAT_SINGLE' : 'REPEAT_OFF') | ||
//ACK written when status update sent by Chromecast | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not repeatSingle: " + err); | ||
adapter.log.error(name + ' - Could not repeatSingle: ' + err); | ||
}); | ||
} | ||
//Is announcement? | ||
else if (id.indexOf(adapter.namespace + "." + states.announcement.name) === 0) { | ||
else if (id.indexOf(adapter.namespace + '.' + states.announcement.name) === 0) { | ||
that._mediaPlayer.playAnnouncementPromise(state.val) | ||
@@ -917,7 +941,7 @@ .then (function () { | ||
.catch (function (err) { | ||
adapter.log.error(name + " - Could not play announcement: " + err); | ||
adapter.log.error(name + ' - Could not play announcement: ' + err); | ||
}); | ||
} | ||
//Is url2play? | ||
else if (id.indexOf(adapter.namespace + "." + states.url2play.name) === 0) { | ||
else if (id.indexOf(adapter.namespace + '.' + states.url2play.name) === 0) { | ||
that._playURL(state.val); | ||
@@ -924,0 +948,0 @@ } else { |
var controllerDir; | ||
var appName; | ||
function getAppName() { | ||
var parts = __dirname.replace(/\\/g, '/').split('/'); | ||
return parts[parts.length - 2].split('.')[0]; | ||
} | ||
// Get js-controller directory to load libs | ||
@@ -9,12 +15,12 @@ function getControllerDir(isInstall) { | ||
controllerDir = controllerDir.split('/'); | ||
if (controllerDir[controllerDir.length - 3] == 'adapter') { | ||
if (controllerDir[controllerDir.length - 3] === 'adapter') { | ||
controllerDir.splice(controllerDir.length - 3, 3); | ||
controllerDir = controllerDir.join('/'); | ||
} else if (controllerDir[controllerDir.length - 3] == 'node_modules') { | ||
} else if (controllerDir[controllerDir.length - 3] === 'node_modules') { | ||
controllerDir.splice(controllerDir.length - 3, 3); | ||
controllerDir = controllerDir.join('/'); | ||
if (fs.existsSync(controllerDir + '/node_modules/iobroker.js-controller')) { | ||
controllerDir += '/node_modules/iobroker.js-controller'; | ||
} else if (fs.existsSync(controllerDir + '/node_modules/ioBroker.js-controller')) { | ||
controllerDir += '/node_modules/ioBroker.js-controller'; | ||
if (fs.existsSync(controllerDir + '/node_modules/' + appName + '.js-controller')) { | ||
controllerDir += '/node_modules/' + appName + '.js-controller'; | ||
} else if (fs.existsSync(controllerDir + '/node_modules/' + appName.toLowerCase() + '.js-controller')) { | ||
controllerDir += '/node_modules/' + appName.toLowerCase() + '.js-controller'; | ||
} else if (!fs.existsSync(controllerDir + '/controller.js')) { | ||
@@ -41,8 +47,17 @@ if (!isInstall) { | ||
function getConfig() { | ||
return JSON.parse(fs.readFileSync(controllerDir + '/conf/iobroker.json')); | ||
var fs = require('fs'); | ||
if (fs.existsSync(controllerDir + '/conf/' + appName + '.json')) { | ||
return JSON.parse(fs.readFileSync(controllerDir + '/conf/' + appName + '.json')); | ||
} else if (fs.existsSync(controllerDir + '/conf/' + appName.toLowerCase() + '.json')) { | ||
return JSON.parse(fs.readFileSync(controllerDir + '/conf/' + appName.toLowerCase() + '.json')); | ||
} else { | ||
throw new Error('Cannot find ' + controllerDir + '/conf/' + appName + '.json'); | ||
} | ||
} | ||
controllerDir = getControllerDir(typeof process != 'undefined' && process.argv && process.argv.indexOf('--install') != -1); | ||
appName = getAppName(); | ||
controllerDir = getControllerDir(typeof process !== 'undefined' && process.argv && process.argv.indexOf('--install') !== -1); | ||
exports.controllerDir = controllerDir; | ||
exports.getConfig = getConfig; | ||
exports.adapter = require(controllerDir + '/lib/adapter.js'); | ||
exports.Adapter = require(controllerDir + '/lib/adapter.js'); | ||
exports.appName = appName; |
{ | ||
"name": "iobroker.chromecast", | ||
"version": "1.3.0", | ||
"version": "1.3.3", | ||
"description": "ioBroker chromecast Adapter", | ||
@@ -28,16 +28,16 @@ "author": { | ||
"dependencies": { | ||
"castv2-player": "^1.1.4" | ||
"castv2-player": "^1.1.5" | ||
}, | ||
"devDependencies": { | ||
"grunt": "^1.0.1", | ||
"grunt-replace": "^1.0.1", | ||
"grunt-contrib-jshint": "^1.1.0", | ||
"grunt-jscs": "^3.0.1", | ||
"grunt-http": "^2.2.0", | ||
"grunt-contrib-clean": "^1.0.0", | ||
"grunt-contrib-compress": "^1.3.0", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-exec": "^1.0.1", | ||
"mocha": "^2.3.4", | ||
"chai": "^3.4.1" | ||
"grunt": "^1.0.1", | ||
"grunt-replace": "^1.0.1", | ||
"grunt-contrib-jshint": "^1.1.0", | ||
"grunt-jscs": "^3.0.1", | ||
"grunt-http": "^2.2.0", | ||
"grunt-contrib-clean": "^1.1.0", | ||
"grunt-contrib-compress": "^1.4.3", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-exec": "^3.0.0", | ||
"mocha": "^3.5.3", | ||
"chai": "^4.1.2" | ||
}, | ||
@@ -52,2 +52,2 @@ "bugs": { | ||
} | ||
} | ||
} |
![Logo](admin/chromecast.png) | ||
ioBroker.chromecast | ||
# ioBroker.chromecast | ||
============= | ||
@@ -10,3 +10,3 @@ | ||
### A Chromecast adapter for ioBroker | ||
## A Chromecast adapter for ioBroker | ||
@@ -21,4 +21,3 @@ This plugin allows to detect video and/or Chromecast devices. For each detect Chromecast device an ioBroker device is created. This device displays the status of the device and allows to send it a new URL to cast. | ||
Instructions | ||
------------ | ||
## Instructions | ||
@@ -36,4 +35,3 @@ 1. Install into ioBroker | ||
Features | ||
-------- | ||
## Features | ||
@@ -60,4 +58,3 @@ * detect devices with either SSDP or multicast-dns | ||
What is missing? | ||
---------------- | ||
## What is missing? | ||
@@ -68,4 +65,3 @@ * add state machine to track states: detected ->connected -> player loader -> playing | ||
How to build | ||
------------ | ||
## How to build | ||
@@ -81,4 +77,14 @@ 1. Checkout from git | ||
Changelog | ||
--------- | ||
## Changelog | ||
### 1.3.3 (2017.11.24) | ||
* (bluefox) bump a version | ||
### 1.3.2 | ||
* (Vegetto) recognize uncompleted playlist status and trigger a new getStatus | ||
### 1.3.1 | ||
* (Vegetto) Fix updateStates to accept null values | ||
* (Vegetto) Add playlist currentItemdId | ||
### 1.3.0 | ||
@@ -182,3 +188,3 @@ * (Vegetto) Create playlist channel with raw playlist and repeat modes | ||
Copyright (c) 2015 Vegetto <iobroker@angelnu.com> | ||
Copyright (c) 2015-2017 Vegetto <iobroker@angelnu.com> | ||
@@ -185,0 +191,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
/* | ||
ioBroker.chromecast Widget-Set | ||
version: "1.3.0" | ||
version: "1.3.2" | ||
@@ -145,3 +145,3 @@ Copyright 10.2015-2016 Vegetto<iobroker@angelnu.com> | ||
vis.binds.chromecast = { | ||
version: "1.3.0", | ||
version: "1.3.2", | ||
showVersion: function () { | ||
@@ -148,0 +148,0 @@ if (vis.binds.chromecast.version) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
88389
1253
201
15
5
Updatedcastv2-player@^1.1.5