Bose SoundTouch Toolkit

Documentation for controlling and preserving Bose SoundTouch devices

View the Project on GitHub gesellix/Bose-SoundTouch

Content Selection Implementation Summary

This document summarizes the implementation of advanced content selection features for the Bose SoundTouch Go client, including full support for the LOCAL_INTERNET_RADIO streamUrl format and LOCAL_MUSIC/STORED_MUSIC content selection.

โœ… Implementation Status: COMPLETE

All content selection features from the SoundTouch WebServices API Wiki are now fully implemented with comprehensive API methods, CLI commands, tests, and documentation.

๐ŸŽฏ Features Implemented

1. Core API Methods

SelectContentItem(contentItem *models.ContentItem) error

SelectLocalInternetRadio(location, sourceAccount, itemName, containerArt string) error

SelectLocalMusic(location, sourceAccount, itemName, containerArt string) error

SelectStoredMusic(location, sourceAccount, itemName, containerArt string) error

2. CLI Commands

All API methods are exposed through comprehensive CLI commands:

soundtouch-cli source internet-radio

soundtouch-cli --host <device> source internet-radio \
  --location "http://contentapi.gmuth.de/station.php?name=MyStation&streamUrl=https://stream.example.com/radio" \
  --name "My Station" \
  --artwork "https://example.com/art.png"

soundtouch-cli source local-music

soundtouch-cli --host <device> source local-music \
  --location "album:983" \
  --account "3f205110-4a57-4e91-810a-123456789012" \
  --name "Welcome to the New"

soundtouch-cli source stored-music

soundtouch-cli --host <device> source stored-music \
  --location "6_a2874b5d_4f83d999" \
  --account "d09708a1-5953-44bc-a413-123456789012/0" \
  --name "Christmas Album"

soundtouch-cli source content (Advanced)

soundtouch-cli --host <device> source content \
  --source LOCAL_INTERNET_RADIO \
  --location "https://stream.example.com/radio" \
  --name "My Stream" \
  --type stationurl \
  --presetable

๐Ÿงช Test Coverage

Comprehensive test suites implemented for all new functionality:

Unit Tests

Test Coverage Summary

๐Ÿ“š Documentation

Updated Documentation

  1. CLI-REFERENCE.md: Added comprehensive CLI command examples
  2. Content Selection Example: New /examples/content-selection/ with working code
  3. README Updates: Added streamUrl format examples
  4. API Documentation: Inline Go documentation for all methods

Example Code

Complete working example demonstrating:

๐Ÿ” streamUrl Format Support

What is the streamUrl Format?

The streamUrl format uses a proxy server that accepts the actual stream URL as a parameter:

http://contentapi.gmuth.de/station.php?name=StationName&streamUrl=ActualStreamURL

Implementation Details

๐Ÿ—๏ธ Architecture

Design Principles

  1. Consistency: All methods follow the same parameter patterns
  2. Flexibility: SelectContentItem() allows maximum control
  3. Convenience: Specific methods (SelectLocalInternetRadio(), etc.) provide simpler interfaces
  4. Validation: Comprehensive input validation with clear error messages
  5. Defaults: Sensible defaults when optional parameters are empty

ContentItem Construction

All convenience methods create properly structured ContentItem objects:

Sibling Features (Also Implemented)

Based on the wiki structure, these related features are also supported:

  1. LOCAL_MUSIC: โœ… Fully implemented
  2. STORED_MUSIC: โœ… Fully implemented
  3. SPOTIFY: โœ… Previously implemented
  4. TUNEIN: โœ… Previously implemented
  5. BLUETOOTH: โœ… Previously implemented
  6. AIRPLAY: โœ… Previously implemented

๐Ÿ“‹ Usage Examples

API Usage

// streamUrl format
location := "http://contentapi.gmuth.de/station.php?name=MyStation&streamUrl=https://stream.example.com/radio"
err := client.SelectLocalInternetRadio(location, "", "My Station", "")

// Direct ContentItem
contentItem := &models.ContentItem{
    Source:       "LOCAL_INTERNET_RADIO",
    Type:         "stationurl", 
    Location:     location,
    ItemName:     "My Station",
    IsPresetable: true,
}
err := client.SelectContentItem(contentItem)

CLI Usage

# streamUrl format
soundtouch-cli --host 192.168.1.100 source internet-radio \
  --location "http://contentapi.gmuth.de/station.php?name=MyStation&streamUrl=https://stream.example.com/radio" \
  --name "My Station"

# Direct stream
soundtouch-cli --host 192.168.1.100 source internet-radio \
  --location "https://stream.example.com/radio" \
  --name "Direct Stream"

๐Ÿ”— References

โœ… Verification

This implementation has been verified to:

  1. โœ… Support exact wiki specification for streamUrl format
  2. โœ… Handle all LOCAL_INTERNET_RADIO, LOCAL_MUSIC, and STORED_MUSIC scenarios
  3. โœ… Pass comprehensive test suite
  4. โœ… Work with CLI commands
  5. โœ… Include complete documentation and examples
  6. โœ… Maintain backward compatibility

Status: ๐ŸŽ‰ COMPLETE - All requested content selection features are fully implemented and ready for use!