From e044cec9670f29e89da91775b7b5bcad1e61c8f3 Mon Sep 17 00:00:00 2001 From: Chris Nesbitt-Smith Date: Wed, 13 Jan 2021 21:34:41 +0000 Subject: [PATCH] add playbar linein support --- README.md | 5 ++++- lib/actions/linein.js | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 997f6a59..e83417f6 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ The actions supported as of today: * queue * clearqueue * sleep (values in seconds) -* linein (only analog linein, not PLAYBAR yet) +* linein * clip (announce custom mp3 clip) * clipall * clippreset @@ -732,6 +732,9 @@ Selects line-in on zone Office belongs to, with source Office. `/Office/linein/TV%20Room` Selects line-in for zone Office belongs to, with source TV Room. +`/Office/linein/TV%20Room/spdif` +Selects the spdif line-in for zone Office belongs to, with source TV Room, where TV Room is a playbar. + If you want to to isolate a player and then select line-in, use the `/Office/leave` first. Clip diff --git a/lib/actions/linein.js b/lib/actions/linein.js index b6efa94f..4f35141c 100644 --- a/lib/actions/linein.js +++ b/lib/actions/linein.js @@ -2,6 +2,7 @@ function linein(player, values) { const sourcePlayerName = values[0]; + const altInput = values[1]; let lineinSourcePlayer = player; if (sourcePlayerName) { @@ -11,8 +12,13 @@ function linein(player, values) { if (!lineinSourcePlayer) { return Promise.reject(new Error(`Could not find player ${sourcePlayerName}`)); } + let uri + if (altInput === "spdif") { + uri = `x-sonos-htastream:${lineinSourcePlayer.uuid}:spdif`; - const uri = `x-rincon-stream:${lineinSourcePlayer.uuid}`; + } else { + uri = `x-rincon-htastream:${lineinSourcePlayer.uuid}`; + } return player.coordinator.setAVTransport(uri) .then(() => player.coordinator.play());