Documentation for controlling and preserving Bose SoundTouch devices
This document outlines a strategy to refactor the SoundTouch Service’s content handling into a modular provider-based system.
Currently, content handling for BMX (Bose Media Exchange) services like TuneIn or RadioBrowser is deeply intertwined with the HTTP handlers and XML models. Adding a new content provider (e.g., Local Media, Podcast RSS) requires modifying several files and duplicating boilerplate code for HTTP requests and error handling.
We define a generic ContentProvider interface that abstracts away the source-specific logic (API calls, data parsing).
package provider
import "github.com/gesellix/bose-soundtouch/pkg/models"
type ContentProvider interface {
// ID returns the unique identifier for this provider (e.g. "RADIO_BROWSER")
ID() string
// Resolve returns playback details for a given content identifier
Resolve(id string) (*models.BmxPlaybackResponse, error)
// Search allows finding content within this provider
Search(query string) ([]models.ContentItem, error)
}
A central registry in soundtouch-service manages the lifecycle and selection of providers.
type Registry struct {
providers map[string]ContentProvider
}
func (r *Registry) Register(p ContentProvider) { ... }
func (r *Registry) Get(id string) ContentProvider { ... }
bmx.go into a new package pkg/service/providers/radiobrowser.de1.api.radio-browser.info, nl1.api.radio-browser.info).ContentProvider interface.HandleTuneInPlayback and HandleOrionPlayback to use the registry.HandleBMXRegistry to dynamically generate the bmx_services.json content based on the currently registered and enabled providers.ContentProvider interface to include metadata (icons, user-friendly names).radiobrowser provider with failover support.