spotifywebapipython.spotifyconnect.spotifyconnectzeroconfcastlistener
ZEROCONF_SERVICETYPE_GOOGLECAST: str =
'_googlecast._tcp.local.'
Googlecast Zeroconf service type identifier (e.g. "_googlecast._tcp.local.").
CAST_TYPE_CHROMECAST =
'cast'
Regular chromecast, supports video/audio
CAST_TYPE_AUDIO =
'audio'
Cast Audio device, supports only audio
CAST_TYPE_GROUP =
'group'
Cast Audio group device, supports only audio
CAST_TYPE_NONE =
None
cast_type not set; assume it supports audio
class
SpotifyConnectZeroconfCastListener(pychromecast.discovery.AbstractCastListener):
Google Chromecast Zeroconf Listener class.
Listens for Chromecast device connection updates for devices that support Spotify Connect.
SpotifyConnectZeroconfCastListener(parentDirectory, zeroconf_RLock: <function RLock>)
Initializes a new instance of the class.
Arguments:
- parentDirectory (SpotifyConnectDirectoryTask): Parent SpotifyConnectDirectoryTask instance.
- zeroconf_RLock (threading.RLock): Lock object used to enforce thread-safe updates.
def
add_cast(self, uuid: uuid.UUID, serviceName: str) -> None:
Called when a new cast has been discovered.
Arguments:
- uuid (UUID): The cast's uuid, which is the dictionary key to find the chromecast metadata in CastBrowser.devices collection.
- serviceName (str): First known MDNS service name or host:port.
def
remove_cast( self, uuid: uuid.UUID, serviceName: str, castInfo: pychromecast.models.CastInfo) -> None:
Called when a cast has been lost (MDNS info expired or host down).
Arguments:
- uuid (UUID): The cast's uuid, which is the dictionary key to find the chromecast metadata in CastBrowser.devices collection.
- serviceName (str): Last valid MDNS service name or host:port.
- castInfo (CastInfo): CastInfo for the service to aid cleanup.
def
update_cast(self, uuid: uuid.UUID, serviceName: str) -> None:
Called when a cast has been updated (MDNS info renewed or changed).
Arguments:
- uuid (UUID): The cast's uuid, which is the dictionary key to find the chromecast metadata in CastBrowser.devices collection.
- serviceName (str): MDNS service name or host:port.