spotifywebapipython.spotifyconnect.spotifyconnectzeroconfcastapptask

class SpotifyConnectZeroconfCastAppTask(threading.Thread):

Spotify Connect Zeroconf Cast Application class.

Represents the Cast Application that is started on the Chromecast device when a Spotify Connect connection request is made.

SpotifyConnectZeroconfCastAppTask( castDevice: pychromecast.Chromecast, spotifyClientInstance, getInfoResponseReceivedCallback, zeroconfResponseReceivedCallback, transferPlayback: bool = False)

Initializes a new instance of the class.

Arguments:
  • castDevice (Chromecast): Chromecast device target.
  • spotifyClientInstance (SpotifyClient): SpotifyClient instance used to transfer playback to the Chromecast device.
  • getInfoResponseReceivedCallback (function): Function to call when a Spotify Connect GetInfoResponse data structure has been received from the cast device.
  • zeroconfResponseReceivedCallback (function): Function to call when a Spotify Connect ZeroconfResponse data structure has been received from the cast device.
  • transferPlayback (bool): True to transfer playback to the device; otherwise, False to just activate the Spotify Cast App on the device.
name

A string used for identification purposes only.

It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.

CastDevice: pychromecast.Chromecast

Returns the Chromecast device instance if one has been initialized; otherwise, None.

DeviceIdActivated: str

Returns the Chromecast device id that was activated.

The actual deviceId that was activated may be different than the requested deviceId. This can sometimes occur when activating a group, as getInfoResponse will return the deviceId of the group coordinator instead of the deviceId of the group itself.
This only seems to happen in non-Google manufactured devices that have not properly implemented the Cast protocol for grouped devices (e.g. KEF, etc); it never occurs when casting to groups of devices manufactured by Google!

IsStopRequested: bool

Indicator used to denote the task has been asked to stop by the main thread.

SpotifyClientInstance: object

SpotifyClient instance used to transfer playback to the Chromecast device.

TransferPlayback: bool

True to transfer playback to the device; otherwise, False to just activate the Spotify Cast App on the device.

def run(self):

The task to perform on a seperate thread.

Note that any exceptions must be processed via a call to _PostLaunchErrorEvent, if you want the exception to be see by the user; just raising an exception will only log it!