File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,25 @@ for client in server.clients:
2727# set volume for client #0 to 50%
2828client = server.clients[0 ]
2929loop.run_until_complete(server.client_volume(client.identifier, {' percent' : 50 , ' muted' : False }))
30+
31+ # create background task (polling)
32+ async def testloop ():
33+ while (1 ):
34+ print (" still running" )
35+ # print(json.dumps(server.streams[0].properties, indent=4))
36+ print (server.groups)
37+ await asyncio.sleep(10 )
38+
39+ test = loop.create_task(testloop())
40+
41+ # add callback for client #0 volume change
42+ def my_update_func (client ):
43+ print (client.volume)
44+
45+ server.clients[0 ].set_callback(my_update_func)
46+
47+ # keep loop running to receive callbacks and to keep background task alive
48+ loop.run_forever()
3049```
3150
3251### Client
You can’t perform that action at this time.
0 commit comments