mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-24 14:47:23 +00:00
storePreset on the speaker was failing with "AddPreset - failed due to invalid SourceID" because the watchdog priming path only pushed ZeroConf credentials and never registered a SPOTIFY ConfiguredSource in marge. PrimeDeviceWithSpotify now: - resolves the device's paired account via live :8090/info (margeAccountUUID), falling back to ServiceDeviceInfo.AccountID — same order as setup.populateDeviceInfo; - writes a SPOTIFY ConfiguredSource under that account (providerID=15, BoseSecret as credential), mirroring bridgeSpotifyToMarge; - POSTs `<updates><sourcesUpdated/></updates>` so the speaker re-fetches its on-device Sources.xml from marge. Also introduce zeroconf.ErrAddUserNoOp for the narrow firmware quirk (404 + empty body on ?action=addUser when activeUser already matches). Recognised only on that exact pattern; real 4xx/5xx still surface loudly with full response details. Same treatment applied to Amazon priming. Docs: - new docs/concepts/spotify-overview.md anchors the topic (mental model, streamingoauth.bose.com DNS gotcha, token lifecycle, clientId notes, troubleshooting table); - spotify-oauth.md drops the removed install-primer endpoint and the on-device boot-primer install sections, adds /mgmt/spotify/prime; - spotify-priming-strategy.md and MUSIC-SERVICES.md link to the overview. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
22 lines
942 B
Go
22 lines
942 B
Go
package spotify
|
|
|
|
import "github.com/gesellix/bose-soundtouch/pkg/service/zeroconf"
|
|
|
|
// ErrAddUserNoOp re-exports zeroconf.ErrAddUserNoOp so callers in the spotify
|
|
// package don't need a direct dependency on the zeroconf package to recognise
|
|
// the benign-no-op sentinel.
|
|
var ErrAddUserNoOp = zeroconf.ErrAddUserNoOp
|
|
|
|
// ZeroConfGetInfo fetches the speaker's DH public key via GET ?action=getInfo.
|
|
func ZeroConfGetInfo(zcBaseURL string) ([]byte, error) {
|
|
return zeroconf.GetInfo(zcBaseURL)
|
|
}
|
|
|
|
// PushSpotifyCredentials pushes Spotify credentials to a speaker using the full
|
|
// ZeroConf DH key exchange protocol. Falls back to simplified token push if
|
|
// the speaker does not support DH (older firmware).
|
|
// zcBaseURL is the base URL of the ZeroConf endpoint, e.g. "http://192.168.1.10:8200/zc".
|
|
func PushSpotifyCredentials(zcBaseURL, username, accessToken string) error {
|
|
return zeroconf.PushCredentials(zcBaseURL, username, accessToken)
|
|
}
|