-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New endpoint to show if any speaker is running #781
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,8 +58,27 @@ function doResumeAll(system) { | |
return Promise.all(promises); | ||
} | ||
|
||
function anyPlayerOn(player, values) { | ||
logger.debug("is any player on"); | ||
|
||
if (values[0] && values[0] > 0) { | ||
setTimeout(function () { | ||
doStateOn(player.system); | ||
}, values[0] * 1000 * 60); | ||
return Promise.resolve(); | ||
} | ||
|
||
return doAnyPlayerOn(player.system); | ||
} | ||
|
||
function doAnyPlayerOn(system) { | ||
const promises = system.zones.some(zone => zone.coordinator.state.playbackState === 'PLAYING'); | ||
return {promises}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing here is a promise, so not sure why you return an object with |
||
} | ||
|
||
|
||
module.exports = function (api) { | ||
api.registerAction('pauseall', pauseAll); | ||
api.registerAction('resumeall', resumeAll); | ||
} | ||
api.registerAction('anyplayeron', anyPlayerOn); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be in it's own action file, since it doesn't really have anything to do with play/pause all functionality. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this setTimeout?