Files
Bose-SoundTouch/pkg/models/mediaservers.go
T
Tobias GesellchenandClaude Opus 4.8 c4acc794b8 feat(cli,client): soundtouch-cli library command + ListMediaServers
Adds the CLI-first surface for the DLNA feature
(https://github.com/gesellix/Bose-SoundTouch/discussions/213), so the
discovery/browse/play plumbing can be exercised against a real media server
and speaker without the web build loop.

- soundtouch-cli library servers: app-side SSDP sweep
  (discovery.DiscoverMediaServers); --via-speaker queries the speaker's own
  /listMediaServers instead, for an A/B of the two views.
- soundtouch-cli library browse --udn <id> [--object --start --count]:
  dlna.Browse of a discovered server's ContentDirectory.
- soundtouch-cli library play --url <streamURL> --mode <...>: plays a track
  URL on a speaker; --mode selects the playback path (local-internet-radio,
  local-music, stored-music, content-item) so the best one can be found
  empirically on hardware.
- pkg/client.ListMediaServers() + models.ListMediaServersResponse for the
  speaker-native (Option 2) path; an empty <ListMediaServersResponse />
  parses to an empty slice.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:50:49 +02:00

33 lines
1.4 KiB
Go

package models
import "encoding/xml"
// ListMediaServersResponse is the XML response from the speaker's
// /listMediaServers endpoint. Real speakers can return an empty self-closing
// element when no servers are visible, so MediaServers may be nil or empty.
type ListMediaServersResponse struct {
XMLName xml.Name `xml:"ListMediaServersResponse"`
MediaServers []MediaServerInfo `xml:"media_server"`
}
// MediaServerInfo describes a single DLNA media server as reported by the
// speaker's own UPnP/DLNA discovery layer.
type MediaServerInfo struct {
// ID is the UDN (uuid:...) of the server.
ID string `xml:"id,attr"`
// MAC is the server's MAC address when reported by the speaker.
MAC string `xml:"mac,attr,omitempty"`
// IP is the LAN IP address the speaker resolved for the server.
IP string `xml:"ip,attr,omitempty"`
// Manufacturer is the vendor string from the UPnP description.
Manufacturer string `xml:"manufacturer,attr,omitempty"`
// ModelName is the model string from the UPnP description.
ModelName string `xml:"model_name,attr,omitempty"`
// FriendlyName is the human-readable server name.
FriendlyName string `xml:"friendly_name,attr,omitempty"`
// ModelDescription is the optional long model description.
ModelDescription string `xml:"model_description,attr,omitempty"`
// Location is the URL of the device's UPnP root description document.
Location string `xml:"location,attr,omitempty"`
}