-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-dynamic-client.py
executable file
·58 lines (44 loc) · 1.28 KB
/
test-dynamic-client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
#
# Some examples of dynamic class generation
# https://github.com/boto/boto3
#
# make sure that help(client) called on a client object actually shows documentation!
# show example of using ipython
#
# ``` python
# In [1]: from pyavcontrol import get_model, create_client
# In [2]: m = get_model('mcintosh_mx160')
# In [3] c = create_client(m)
# In [4]: c.
# c.mute c.power
# c.volume
#
# In [5]: c.mute
# c.mute.on c.mute.off
#
# In [6]: c.mute.on()
# ```
import logging
import coloredlogs
from pyavcontrol import DeviceClient, DeviceModelLibrary
from pyavcontrol.connection import NullConnection
LOG = logging.getLogger(__name__)
coloredlogs.install(level='DEBUG')
# SendFunction = Callable[[list[int]], bool]
def main():
# url = 'socket://localhost:4999'
connection = NullConnection()
library = DeviceModelLibrary.create()
supported_models = library.supported_models()
supported_models = ['mcintosh_mx160']
for model_id in supported_models:
model_def = library.load_model(model_id)
client = DeviceClient.create(model_def, connection)
print(type(client))
# help(client)
# print(client.software.info())
# help(client)
# return
if __name__ == '__main__':
main()