spotifywebapipython.models.spotifyconnectdevices

@export
class SpotifyConnectDevices:

Spotify Connect Devices collection.

SpotifyConnectDevices()

Initializes a new instance of the class.

AgeLastRefreshed: float

Number of seconds between the current date time and the DateLastRefreshed property value.

DateLastRefreshed: float

Date and time the device list was last refreshed, in unix epoch format (e.g. 1669123919.331225).

Array of SpotifyConnectDevice objects.

ItemsCount: int

Number of objects in the Items property array.

def ContainsDeviceId(self, value: str) -> bool:

Returns True if the Items collection contains the specified device id value; otherwise, False.

Alias entries (if any) are also compared.

def ContainsDeviceName(self, value: str) -> bool:

Returns True if the Items collection contains the specified device name value; otherwise, False.

Alias entries (if any) are also compared.

def ContainsZeroconfEndpointGetInformation(self, value: str) -> bool:

Returns True if the Items collection contains the specified Zeroconf getInfo Endpoint url value; otherwise, False.

def GetDeviceByDiscoveryKey( self, value: str) -> spotifywebapipython.models.spotifyconnectdevice.SpotifyConnectDevice:

Returns a SpotifyConnectDevice instance if the Items collection contains the specified device zeroconf discovery results key value; otherwise, None.

Returns a SpotifyConnectDevice instance if the Items collection contains the specified device id value; otherwise, None.

All Spotify Connect Zeroconf GetInfo response DeviceId entries are checked first; if not resolved, then base device Id entries are checked. We do it this way in case a Spotify Connect Zeroconf GetInfo response has not been recevied for a device yet.

Returns a SpotifyConnectDevice instance if the Items collection contains the specified device name value; otherwise, None.

All Spotify Connect Zeroconf GetInfo response RemoteName / Zeroconf DiscoveryResult DeviceName entries are checked first; if not resolved, then Spotify Connect Zeroconf GetInfo Alias entries are checked. We do it this way in case an alias name is defined for a Spotify Connect Zeroconf entry that already exists with the same name (e.g. the RemoteName entry will take precedence).

def GetDeviceByNameAndId(self, deviceName: str, deviceId: str) -> int:

Returns a SpotifyConnectDevice instance if the Items collection contains the specified device name and id value; otherwise, None.

Alias entries (if any) are NOT compared.

def GetDeviceIndexByDiscoveryKey(self, value: str) -> int:

Returns the index of the Items collection entry that contains the specified device zeroconf discovery results key value if found; otherwise, -1.

def GetDeviceIndexByDiscoveryName(self, value: str) -> int:

Returns the index of the Items collection entry that contains the specified device zeroconf discovery results name value if found; otherwise, -1.

def GetDeviceList(self) -> list[spotifywebapipython.models.device.Device]:

Returns a list of Device objects that can be used to build a selection list of available devices.

Note that the Device object has the following properties populated: Id, Name, IsActive, Type.

def ToDictionary(self) -> dict:

Returns a dictionary representation of the class.

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

Returns a displayable string representation of the class.

Arguments:
  • includeItems (bool): True to include the Items collection of objects; otherwise, False to only return base properties.