bosesoundtouchapi.models.sourcelist

@export
class SourceList:

SoundTouch device SourceList configuration object.

This class contains the attributes and sub-items that represent the sources configuration of the device.

SourceList(root: xml.etree.ElementTree.Element = None)

Initializes a new instance of the class.

Arguments:
  • root (Element): xmltree Element item to load arguments from.
    If specified, then other passed arguments are ignored.
DeviceId: str

Device identifier the configuration information was obtained from.

The list of SourceItem items.

def GetSourceItemByTitle(self, title: str) -> bosesoundtouchapi.models.sourceitem.SourceItem:

Returns a SourceItem instance for the given source title value.

Arguments:
  • title (str): Source title string to locate in the SourceItems list. Value is case-sensitive, and must match exactly.
Returns:

A SourceItem if the title argument value was found; otherwise, None.

def GetTitleBySource(self, source: str, sourceAccount: str = None) -> str:

Returns a title for the given source and sourceAccount values.

Arguments:
  • source (str): The source of media content (e.g. "TUNEIN", "AIRPLAY", "UPNP", etc). Value is case-sensitive, and must match exactly.
  • sourceAccount (str): The account associated with the Source. Value is case-sensitive, and must match exactly.
Returns:

A SourceItem.SourceTitle if the title argument value was found; otherwise, None.

def ToDictionary(self, encoding: str = 'utf-8') -> dict:

Returns a dictionary representation of the class.

Arguments:
  • encoding (str): encode type (e.g. 'utf-8', 'unicode', etc).
    Default is 'utf-8'.
def ToElement(self, isRequestBody: bool = False) -> xml.etree.ElementTree.Element:

Returns an xmltree Element node representation of the class.

Arguments:
  • isRequestBody (bool): True if the element should only return attributes needed for a POST request body; otherwise, False to return all attributes.
def ToSourceArray(self, includeSourceAccount: bool = False) -> list[str]:

Returns an array of source names (and optionally source account) strings.

Arguments:
  • includeSourceAccount (bool): True to include SourceAccount property values if present; otherwise, False to only return Source property values.

If includeSourceAccount=True was specified and a SourceAccount value is present, then it will return the Source entry as "Source:sourceAccount" as well as a second entry of just the "Source" value; otherwise, just the "Source" value is returned for the source item.

def ToSourceTitleArray(self) -> list[str]:

Returns an array of source title strings.

def ToString(self, includeItems: bool = False) -> str:

Returns a displayable string representation of the class.

Arguments:
  • includeItems (bool): True to include all items in the list; otherwise False to only include the base list.