python-linkplay 0.0.3__py3-none-any.whl → 0.0.4__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/__main__.py +2 -1
- linkplay/__version__.py +1 -1
- linkplay/controller.py +25 -5
- {python_linkplay-0.0.3.dist-info → python_linkplay-0.0.4.dist-info}/METADATA +1 -1
- python_linkplay-0.0.4.dist-info/RECORD +14 -0
- python_linkplay-0.0.3.dist-info/RECORD +0 -14
- {python_linkplay-0.0.3.dist-info → python_linkplay-0.0.4.dist-info}/LICENSE +0 -0
- {python_linkplay-0.0.3.dist-info → python_linkplay-0.0.4.dist-info}/WHEEL +0 -0
- {python_linkplay-0.0.3.dist-info → python_linkplay-0.0.4.dist-info}/top_level.txt +0 -0
linkplay/__main__.py
CHANGED
@@ -7,11 +7,12 @@ from linkplay.controller import LinkPlayController
|
|
7
7
|
async def main():
|
8
8
|
async with aiohttp.ClientSession() as session:
|
9
9
|
controller = LinkPlayController(session)
|
10
|
-
await controller.discover()
|
11
10
|
|
11
|
+
await controller.discover_bridges()
|
12
12
|
for bridge in controller.bridges:
|
13
13
|
print(bridge)
|
14
14
|
|
15
|
+
await controller.discover_multirooms()
|
15
16
|
for multiroom in controller.multirooms:
|
16
17
|
print(multiroom.followers)
|
17
18
|
|
linkplay/__version__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.0.
|
1
|
+
__version__ = '0.0.4'
|
linkplay/controller.py
CHANGED
@@ -16,7 +16,7 @@ class LinkPlayController():
|
|
16
16
|
self.bridges = []
|
17
17
|
self.multirooms = []
|
18
18
|
|
19
|
-
async def
|
19
|
+
async def discover_bridges(self) -> None:
|
20
20
|
"""Attempts to discover LinkPlay devices on the local network."""
|
21
21
|
|
22
22
|
# Discover new bridges
|
@@ -25,10 +25,30 @@ class LinkPlayController():
|
|
25
25
|
new_bridges = [discovered_bridge for discovered_bridge in discovered_bridges if discovered_bridge.device.uuid not in current_bridges]
|
26
26
|
self.bridges.extend(new_bridges)
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
self.multirooms.append(LinkPlayMultiroom(new_bridge))
|
28
|
+
async def discover_multirooms(self) -> None:
|
29
|
+
"""Attempts to discover multirooms on the local network."""
|
31
30
|
|
32
|
-
#
|
31
|
+
# Create new multirooms from new bridges
|
32
|
+
new_multirooms = []
|
33
|
+
for bridge in self.bridges:
|
34
|
+
has_multiroom = any(multiroom for multiroom in self.multirooms if multiroom.leader == bridge)
|
35
|
+
|
36
|
+
if has_multiroom:
|
37
|
+
continue
|
38
|
+
|
39
|
+
multiroom = LinkPlayMultiroom(bridge)
|
40
|
+
await multiroom.update_status(self.bridges)
|
41
|
+
if len(multiroom.followers) > 0:
|
42
|
+
new_multirooms.append(multiroom)
|
43
|
+
|
44
|
+
# Update existing multirooms
|
33
45
|
for multiroom in self.multirooms:
|
34
46
|
await multiroom.update_status(self.bridges)
|
47
|
+
|
48
|
+
# Remove multirooms if they have no followers
|
49
|
+
empty_multirooms = [multiroom for multiroom in self.multirooms if not multiroom.followers]
|
50
|
+
for empty_multiroom in empty_multirooms:
|
51
|
+
self.multirooms.remove(empty_multiroom)
|
52
|
+
|
53
|
+
# Add new multirooms
|
54
|
+
self.multirooms.extend(new_multirooms)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
linkplay/__init__.py,sha256=y9ZehEq-KhS3cwn-PUpwVSJGfDUx7e5wf_G6guODcTk,56
|
2
|
+
linkplay/__main__.py,sha256=eBEvuF8rDs0vuexX3Mcd5O02GRPQtOOOAVNEWqZhhdg,502
|
3
|
+
linkplay/__version__.py,sha256=-Wqu9UyJphp-2_EahEsqQvkcE0VBhm1-N7D6e5rANdY,22
|
4
|
+
linkplay/bridge.py,sha256=NX02ZBcbaz7yZv1EeFvQ9CAUh5jVcuSABtpKIY4aj74,10948
|
5
|
+
linkplay/consts.py,sha256=KIBGrRQqxd1B4kRO0Vl0e5-UzbMLzJGC_ECohzkSRwQ,7750
|
6
|
+
linkplay/controller.py,sha256=f0-fxURcts4j_p5prW-EW5IkAcdsR5Zl8nT1aL_587U,2050
|
7
|
+
linkplay/discovery.py,sha256=NIUC3FVPH-FcHvMmojJw0s0w2Q-WCuulGrQA-PDLcsw,2642
|
8
|
+
linkplay/exceptions.py,sha256=tWJWHsKVkUEq3Yet1Z739IxcaQT8YamDeSp0tqHde9c,107
|
9
|
+
linkplay/utils.py,sha256=E_SjIyeK76ishhwuU24m28y1FDAMEj1QbRNt-aHIMdA,2137
|
10
|
+
python_linkplay-0.0.4.dist-info/LICENSE,sha256=bgEtxMyjEHX_4uwaAY3GCFTm234D4AOZ5dM15sk26ms,1073
|
11
|
+
python_linkplay-0.0.4.dist-info/METADATA,sha256=j_sNnigaFbClz5uTawxWeggHzuPRxGu_U7xttzRRHKs,2859
|
12
|
+
python_linkplay-0.0.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
13
|
+
python_linkplay-0.0.4.dist-info/top_level.txt,sha256=CpSaOVPTzJf5TVIL7MrotSCR34gcIOQy-11l4zGmxxM,9
|
14
|
+
python_linkplay-0.0.4.dist-info/RECORD,,
|
@@ -1,14 +0,0 @@
|
|
1
|
-
linkplay/__init__.py,sha256=y9ZehEq-KhS3cwn-PUpwVSJGfDUx7e5wf_G6guODcTk,56
|
2
|
-
linkplay/__main__.py,sha256=hVlIhEeSfIRlTjNsDXVMSAtOatbUqqIMdXPxdwBBE1c,447
|
3
|
-
linkplay/__version__.py,sha256=yyLtGsBhynC-sSHdax-rRGvHNjH-gdWxIY68WnPVfDw,22
|
4
|
-
linkplay/bridge.py,sha256=NX02ZBcbaz7yZv1EeFvQ9CAUh5jVcuSABtpKIY4aj74,10948
|
5
|
-
linkplay/consts.py,sha256=KIBGrRQqxd1B4kRO0Vl0e5-UzbMLzJGC_ECohzkSRwQ,7750
|
6
|
-
linkplay/controller.py,sha256=Rp92CQdpwreH-I132DrxogiZ_I8NngdmCeXzfQYAFMQ,1244
|
7
|
-
linkplay/discovery.py,sha256=NIUC3FVPH-FcHvMmojJw0s0w2Q-WCuulGrQA-PDLcsw,2642
|
8
|
-
linkplay/exceptions.py,sha256=tWJWHsKVkUEq3Yet1Z739IxcaQT8YamDeSp0tqHde9c,107
|
9
|
-
linkplay/utils.py,sha256=E_SjIyeK76ishhwuU24m28y1FDAMEj1QbRNt-aHIMdA,2137
|
10
|
-
python_linkplay-0.0.3.dist-info/LICENSE,sha256=bgEtxMyjEHX_4uwaAY3GCFTm234D4AOZ5dM15sk26ms,1073
|
11
|
-
python_linkplay-0.0.3.dist-info/METADATA,sha256=ifK_uu-ZBe81Wcqo8YoIObMiuPQ6ub1QUio7Mnm5JYE,2859
|
12
|
-
python_linkplay-0.0.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
13
|
-
python_linkplay-0.0.3.dist-info/top_level.txt,sha256=CpSaOVPTzJf5TVIL7MrotSCR34gcIOQy-11l4zGmxxM,9
|
14
|
-
python_linkplay-0.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|