from platypush.message.event import Event
[docs]
class SnapcastEvent(Event):
"""Base class for Snapcast events"""
[docs]
def __init__(self, host='localhost', *args, **kwargs):
super().__init__(*args, host=host, **kwargs)
[docs]
class ClientConnectedEvent(SnapcastEvent):
"""
Event fired upon client connection
"""
[docs]
def __init__(self, client, host='localhost', *args, **kwargs):
super().__init__(*args, client=client, host=host, **kwargs)
[docs]
class ClientDisconnectedEvent(SnapcastEvent):
"""
Event fired upon client disconnection
"""
[docs]
def __init__(self, client, host='localhost', *args, **kwargs):
super().__init__(*args, client=client, host=host, **kwargs)
[docs]
class ClientVolumeChangeEvent(SnapcastEvent):
"""
Event fired upon volume change or mute status change on a client
"""
[docs]
def __init__(self, client, volume, muted, host='localhost', *args, **kwargs):
super().__init__(
*args, client=client, host=host, volume=volume, muted=muted, **kwargs
)
[docs]
class ClientLatencyChangeEvent(SnapcastEvent):
"""
Event fired upon latency change on a client
"""
[docs]
def __init__(self, client, latency, host='localhost', *args, **kwargs):
super().__init__(*args, client=client, host=host, latency=latency, **kwargs)
[docs]
class ClientNameChangeEvent(SnapcastEvent):
"""
Event fired upon name change of a client
"""
[docs]
def __init__(self, client, name, host='localhost', *args, **kwargs):
super().__init__(*args, client=client, host=host, name=name, **kwargs)
[docs]
class GroupMuteChangeEvent(SnapcastEvent):
"""
Event fired upon mute status change
"""
[docs]
def __init__(self, group, muted, host='localhost', *args, **kwargs):
super().__init__(*args, group=group, host=host, muted=muted, **kwargs)
[docs]
class GroupStreamChangeEvent(SnapcastEvent):
"""
Event fired upon group stream change
"""
[docs]
def __init__(self, group, stream, host='localhost', *args, **kwargs):
super().__init__(*args, group=group, host=host, stream=stream, **kwargs)
[docs]
class StreamUpdateEvent(SnapcastEvent):
"""
Event fired upon stream update
"""
[docs]
def __init__(self, stream_id, stream, host='localhost', *args, **kwargs):
super().__init__(*args, stream_id=stream_id, stream=stream, host=host, **kwargs)
[docs]
class ServerUpdateEvent(SnapcastEvent):
"""
Event fired upon stream update
"""
[docs]
def __init__(self, server, host='localhost', *args, **kwargs):
super().__init__(*args, server=server, host=host, **kwargs)
# vim:sw=4:ts=4:et: