python-linkplay 0.0.10__py3-none-any.whl → 0.0.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- linkplay/__version__.py +1 -1
- linkplay/bridge.py +20 -6
- linkplay/consts.py +18 -0
- linkplay/endpoint.py +12 -1
- {python_linkplay-0.0.10.dist-info → python_linkplay-0.0.11.dist-info}/METADATA +1 -1
- python_linkplay-0.0.11.dist-info/RECORD +15 -0
- {python_linkplay-0.0.10.dist-info → python_linkplay-0.0.11.dist-info}/WHEEL +1 -1
- python_linkplay-0.0.10.dist-info/RECORD +0 -15
- {python_linkplay-0.0.10.dist-info → python_linkplay-0.0.11.dist-info}/LICENSE +0 -0
- {python_linkplay-0.0.10.dist-info → python_linkplay-0.0.11.dist-info}/top_level.txt +0 -0
linkplay/__version__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.0.
|
1
|
+
__version__ = '0.0.11'
|
linkplay/bridge.py
CHANGED
@@ -26,12 +26,15 @@ class LinkPlayDevice:
|
|
26
26
|
"""Represents a LinkPlay device."""
|
27
27
|
|
28
28
|
bridge: LinkPlayBridge
|
29
|
-
properties: dict[DeviceAttribute, str]
|
30
|
-
DeviceAttribute.__members__.values(), ""
|
31
|
-
)
|
29
|
+
properties: dict[DeviceAttribute, str]
|
32
30
|
|
33
31
|
def __init__(self, bridge: LinkPlayBridge):
|
34
32
|
self.bridge = bridge
|
33
|
+
self.properties = dict.fromkeys(DeviceAttribute.__members__.values(), "")
|
34
|
+
|
35
|
+
def to_dict(self):
|
36
|
+
"""Return the state of the LinkPlayDevice."""
|
37
|
+
return {"properties": self.properties}
|
35
38
|
|
36
39
|
async def update_status(self) -> None:
|
37
40
|
"""Update the device status."""
|
@@ -74,12 +77,15 @@ class LinkPlayPlayer:
|
|
74
77
|
"""Represents a LinkPlay player."""
|
75
78
|
|
76
79
|
bridge: LinkPlayBridge
|
77
|
-
properties: dict[PlayerAttribute, str]
|
78
|
-
PlayerAttribute.__members__.values(), ""
|
79
|
-
)
|
80
|
+
properties: dict[PlayerAttribute, str]
|
80
81
|
|
81
82
|
def __init__(self, bridge: LinkPlayBridge):
|
82
83
|
self.bridge = bridge
|
84
|
+
self.properties = dict.fromkeys(PlayerAttribute.__members__.values(), "")
|
85
|
+
|
86
|
+
def to_dict(self):
|
87
|
+
"""Return the state of the LinkPlayPlayer."""
|
88
|
+
return {"properties": self.properties}
|
83
89
|
|
84
90
|
async def update_status(self) -> None:
|
85
91
|
"""Update the player status."""
|
@@ -256,6 +262,14 @@ class LinkPlayBridge:
|
|
256
262
|
|
257
263
|
return self.device.name
|
258
264
|
|
265
|
+
def to_dict(self):
|
266
|
+
"""Return the state of the LinkPlayBridge."""
|
267
|
+
return {
|
268
|
+
"endpoint": self.endpoint.to_dict(),
|
269
|
+
"device": self.device.to_dict(),
|
270
|
+
"player": self.player.to_dict(),
|
271
|
+
}
|
272
|
+
|
259
273
|
async def json_request(self, command: str) -> dict[str, str]:
|
260
274
|
"""Performs a GET request on the given command and returns the result as a JSON object."""
|
261
275
|
return await self.endpoint.json_request(command)
|
linkplay/consts.py
CHANGED
@@ -304,6 +304,12 @@ class PlayerAttribute(StrEnum):
|
|
304
304
|
VOLUME = "vol"
|
305
305
|
MUTED = "mute"
|
306
306
|
|
307
|
+
def __str__(self):
|
308
|
+
return self.value
|
309
|
+
|
310
|
+
def __repr__(self):
|
311
|
+
return self.value
|
312
|
+
|
307
313
|
|
308
314
|
class DeviceAttribute(StrEnum):
|
309
315
|
"""Defines the device attributes."""
|
@@ -412,6 +418,12 @@ class DeviceAttribute(StrEnum):
|
|
412
418
|
POWER_MODE = "power_mode"
|
413
419
|
SECURITY_CAPABILITIES = "security_capabilities"
|
414
420
|
|
421
|
+
def __str__(self):
|
422
|
+
return self.value
|
423
|
+
|
424
|
+
def __repr__(self):
|
425
|
+
return self.value
|
426
|
+
|
415
427
|
|
416
428
|
class MultiroomAttribute(StrEnum):
|
417
429
|
"""Defines the player attributes."""
|
@@ -420,3 +432,9 @@ class MultiroomAttribute(StrEnum):
|
|
420
432
|
FOLLOWER_LIST = "slave_list"
|
421
433
|
UUID = "uuid"
|
422
434
|
IP = "ip"
|
435
|
+
|
436
|
+
def __str__(self):
|
437
|
+
return self.value
|
438
|
+
|
439
|
+
def __repr__(self):
|
440
|
+
return self.value
|
linkplay/endpoint.py
CHANGED
@@ -3,7 +3,6 @@ from abc import ABC, abstractmethod
|
|
3
3
|
|
4
4
|
from aiohttp import ClientSession
|
5
5
|
|
6
|
-
from linkplay.consts import TCPPORT
|
7
6
|
from linkplay.utils import (
|
8
7
|
call_tcpuart,
|
9
8
|
call_tcpuart_json,
|
@@ -23,6 +22,10 @@ class LinkPlayEndpoint(ABC):
|
|
23
22
|
async def json_request(self, command: str) -> dict[str, str]:
|
24
23
|
"""Performs a request on the given command and returns the result as a JSON object."""
|
25
24
|
|
25
|
+
@abstractmethod
|
26
|
+
def to_dict(self) -> dict[str, str]:
|
27
|
+
"""Return the state of the LinkPlayEndpoint"""
|
28
|
+
|
26
29
|
|
27
30
|
class LinkPlayApiEndpoint(LinkPlayEndpoint):
|
28
31
|
"""Represents a LinkPlay HTTP API endpoint."""
|
@@ -35,6 +38,10 @@ class LinkPlayApiEndpoint(LinkPlayEndpoint):
|
|
35
38
|
self._endpoint: str = f"{protocol}://{endpoint}"
|
36
39
|
self._session: ClientSession = session
|
37
40
|
|
41
|
+
def to_dict(self):
|
42
|
+
"""Return the state of the LinkPlayEndpoint"""
|
43
|
+
return {"endpoint": self._endpoint}
|
44
|
+
|
38
45
|
async def request(self, command: str) -> None:
|
39
46
|
"""Performs a GET request on the given command and verifies the result."""
|
40
47
|
await session_call_api_ok(self._endpoint, self._session, command)
|
@@ -55,6 +62,10 @@ class LinkPlayTcpUartEndpoint(LinkPlayEndpoint):
|
|
55
62
|
):
|
56
63
|
self._connection = connection
|
57
64
|
|
65
|
+
def to_dict(self):
|
66
|
+
"""Return the state of the LinkPlayEndpoint"""
|
67
|
+
return {}
|
68
|
+
|
58
69
|
async def request(self, command: str) -> None:
|
59
70
|
reader, writer = self._connection
|
60
71
|
await call_tcpuart(reader, writer, command)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
linkplay/__init__.py,sha256=y9ZehEq-KhS3cwn-PUpwVSJGfDUx7e5wf_G6guODcTk,56
|
2
|
+
linkplay/__main__.py,sha256=Wcza80QaWfOaHjyJEfQYhB9kiPLE0NOqIj4zVWv2Nqs,577
|
3
|
+
linkplay/__version__.py,sha256=hiU_rp5scA1P5fsYbz24O_RUsChart9LA0KijNB5GvU,23
|
4
|
+
linkplay/bridge.py,sha256=tE5eHpjZw8CQM6DTTemMoXj07QHvBAcpinNrQ35DIpQ,12116
|
5
|
+
linkplay/consts.py,sha256=40K-pYZnKjdtYxXEANmOkGl9svx8ocTBTxl_2YY_BYA,13371
|
6
|
+
linkplay/controller.py,sha256=IYoXvHh2zhrsRoRG7gwYFoWSIrL5Hl9hR7c2dhGPNX8,2484
|
7
|
+
linkplay/discovery.py,sha256=aEzN_94pKLmHKYIL7DxSW0FYRsaF2ruZe2bwXz0zf5U,4299
|
8
|
+
linkplay/endpoint.py,sha256=5Ybr54aroFVEZ6fnFYP41QAuSP7-J9qHYAzLod4S3KY,2459
|
9
|
+
linkplay/exceptions.py,sha256=tWJWHsKVkUEq3Yet1Z739IxcaQT8YamDeSp0tqHde9c,107
|
10
|
+
linkplay/utils.py,sha256=WVKdxITDymLCmKGqlD9Ieyb96qZ-QSC9oIe-KGW4IFU,7827
|
11
|
+
python_linkplay-0.0.11.dist-info/LICENSE,sha256=bgEtxMyjEHX_4uwaAY3GCFTm234D4AOZ5dM15sk26ms,1073
|
12
|
+
python_linkplay-0.0.11.dist-info/METADATA,sha256=ifrGRusUec4qeH0vLnEmvY_-OJMkzaE_t37tE2iEonI,2988
|
13
|
+
python_linkplay-0.0.11.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
14
|
+
python_linkplay-0.0.11.dist-info/top_level.txt,sha256=CpSaOVPTzJf5TVIL7MrotSCR34gcIOQy-11l4zGmxxM,9
|
15
|
+
python_linkplay-0.0.11.dist-info/RECORD,,
|
@@ -1,15 +0,0 @@
|
|
1
|
-
linkplay/__init__.py,sha256=y9ZehEq-KhS3cwn-PUpwVSJGfDUx7e5wf_G6guODcTk,56
|
2
|
-
linkplay/__main__.py,sha256=Wcza80QaWfOaHjyJEfQYhB9kiPLE0NOqIj4zVWv2Nqs,577
|
3
|
-
linkplay/__version__.py,sha256=op0YgbBDjpD8XP_2_aEIvFkIRz9w0nlrOp56GUt0XxQ,23
|
4
|
-
linkplay/bridge.py,sha256=LXUc1zcRh1Hx1QauhlpA9da5k7f6h3KLfGRA1jAbTPU,11602
|
5
|
-
linkplay/consts.py,sha256=OGEj34YTiEWRBPjIebokDOVKOsa-DpZkCkUpThO8IIc,13068
|
6
|
-
linkplay/controller.py,sha256=IYoXvHh2zhrsRoRG7gwYFoWSIrL5Hl9hR7c2dhGPNX8,2484
|
7
|
-
linkplay/discovery.py,sha256=aEzN_94pKLmHKYIL7DxSW0FYRsaF2ruZe2bwXz0zf5U,4299
|
8
|
-
linkplay/endpoint.py,sha256=aWNiiU6h3gIWiNzcnavfA8IMZLufv9A8Cm5qphRpRvA,2158
|
9
|
-
linkplay/exceptions.py,sha256=tWJWHsKVkUEq3Yet1Z739IxcaQT8YamDeSp0tqHde9c,107
|
10
|
-
linkplay/utils.py,sha256=WVKdxITDymLCmKGqlD9Ieyb96qZ-QSC9oIe-KGW4IFU,7827
|
11
|
-
python_linkplay-0.0.10.dist-info/LICENSE,sha256=bgEtxMyjEHX_4uwaAY3GCFTm234D4AOZ5dM15sk26ms,1073
|
12
|
-
python_linkplay-0.0.10.dist-info/METADATA,sha256=ZzxS4W64XCLZXbDssg4YNhtbAmDkAgg-_aF_tY6SJYs,2988
|
13
|
-
python_linkplay-0.0.10.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
14
|
-
python_linkplay-0.0.10.dist-info/top_level.txt,sha256=CpSaOVPTzJf5TVIL7MrotSCR34gcIOQy-11l4zGmxxM,9
|
15
|
-
python_linkplay-0.0.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|