1818CLIENT_SETNAME = 'Client.SetName'
1919CLIENT_SETLATENCY = 'Client.SetLatency'
2020CLIENT_SETMUTE = 'Client.SetMute'
21+ CLIENT_SETSTREAM = 'Client.SetStream'
2122CLIENT_SETVOLUME = 'Client.SetVolume'
2223CLIENT_ONUPDATE = 'Client.OnUpdate'
2324CLIENT_ONDELETE = 'Client.OnDelete'
2728_EVENTS = [CLIENT_ONUPDATE , CLIENT_ONCONNECT , CLIENT_ONDISCONNECT ,
2829 CLIENT_ONDELETE ]
2930_METHODS = [SERVER_GETSTATUS , SERVER_DELETECLIENT , CLIENT_SETNAME ,
30- CLIENT_SETLATENCY , CLIENT_SETMUTE , CLIENT_SETVOLUME ]
31+ CLIENT_SETLATENCY , CLIENT_SETSTREAM , CLIENT_SETMUTE ,
32+ CLIENT_SETVOLUME ]
3133
3234
3335class Snapclient :
@@ -58,7 +60,7 @@ def version(self):
5860 @property
5961 def connected (self ):
6062 """ Connected or not. """
61- return self ._client .get ('version ' )
63+ return self ._client .get ('connected ' )
6264
6365 @property
6466 def name (self ):
@@ -94,6 +96,17 @@ def muted(self, status):
9496 self ._client ['volume' ]['muted' ] = self ._server .client_muted (self ._mac ,
9597 status )
9698
99+ @property
100+ def stream (self ):
101+ """ Volume percent. """
102+ return self ._client .get ('stream' )
103+
104+ @stream .setter
105+ def stream (self , path ):
106+ """ Set client stream path. """
107+ self ._client ['stream' ] = self ._server .client_stream (
108+ self ._mac , path )
109+
97110 @property
98111 def volume (self ):
99112 """ Volume percent. """
@@ -105,8 +118,7 @@ def volume(self, percent):
105118 if percent not in range (0 , 101 ):
106119 raise ValueError ('Volume percent out of range' )
107120 self ._client ['volume' ]['percent' ] = self ._server .client_volume (
108- self ._mac ,
109- percent )
121+ self ._mac , percent )
110122
111123 def update (self , data ):
112124 """ Update client with new state. """
@@ -168,6 +180,10 @@ def client_muted(self, mac, muted):
168180 """ Set client mute status. """
169181 return self ._client (CLIENT_SETMUTE , mac , 'mute' , muted )
170182
183+ def client_stream (self , mac , stream ):
184+ """ Set client stream. """
185+ return self ._client (CLIENT_SETSTREAM , mac , 'stream' , stream )
186+
171187 def client_volume (self , mac , volume ):
172188 """ Set client volume. """
173189 return self ._client (CLIENT_SETVOLUME , mac , 'volume' , volume )
0 commit comments