python-linkplay 0.0.16__py3-none-any.whl → 0.0.18__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 CHANGED
@@ -1 +1 @@
1
- __version__ = '0.0.16'
1
+ __version__ = '0.0.18'
linkplay/bridge.py CHANGED
@@ -62,16 +62,16 @@ class LinkPlayDevice:
62
62
  flags = InputMode(
63
63
  int(self.properties[DeviceAttribute.PLAYMODE_SUPPORT], base=16)
64
64
  )
65
- return [INPUT_MODE_MAP[flag] for flag in flags]
65
+
66
+ playing_modes = [INPUT_MODE_MAP[flag] for flag in flags]
67
+ playing_modes.insert(0, PlayingMode.NETWORK) # always supported
68
+ return playing_modes
66
69
 
67
70
  @property
68
- def eth(self) -> str:
71
+ def eth(self) -> str | None:
69
72
  """Returns the ethernet address."""
70
- return (
71
- self.properties[DeviceAttribute.ETH_DHCP]
72
- if DeviceAttribute.ETH_DHCP in self.properties
73
- else self.properties[DeviceAttribute.ETH0]
74
- )
73
+ eth2 = self.properties.get(DeviceAttribute.ETH2)
74
+ return eth2 if eth2 else self.properties.get(DeviceAttribute.APCLI0)
75
75
 
76
76
 
77
77
  class LinkPlayPlayer:
@@ -163,10 +163,22 @@ class LinkPlayPlayer:
163
163
 
164
164
  async def play_preset(self, preset_number: int) -> None:
165
165
  """Play a preset."""
166
- if not 0 < preset_number <= 10:
167
- raise ValueError("Preset must be between 1 and 10.")
166
+ max_number_of_presets_allowed = int(
167
+ self.bridge.device.properties.get(DeviceAttribute.PRESET_KEY) or "10"
168
+ )
169
+ if not 0 < preset_number <= max_number_of_presets_allowed:
170
+ raise ValueError(
171
+ f"Preset must be between 1 and {max_number_of_presets_allowed}."
172
+ )
168
173
  await self.bridge.request(LinkPlayCommand.PLAY_PRESET.format(preset_number))
169
174
 
175
+ async def timesync(self) -> None:
176
+ """Sync the time."""
177
+ import time
178
+
179
+ timestamp = time.strftime("%Y%m%d%H%M%S")
180
+ await self.bridge.request(LinkPlayCommand.TIMESYNC.format(timestamp))
181
+
170
182
  @property
171
183
  def muted(self) -> bool:
172
184
  """Returns if the player is muted."""
linkplay/consts.py CHANGED
@@ -96,6 +96,7 @@ class LinkPlayCommand(StrEnum):
96
96
  MULTIROOM_UNMUTE = "setPlayerCmd:slave_mute:unmute"
97
97
  MULTIROOM_JOIN = "ConnectMasterAp:JoinGroupMaster:eth{}:wifi0.0.0.0"
98
98
  PLAY_PRESET = "MCUKeyShortClick:{}"
99
+ TIMESYNC = "timeSync:{}"
99
100
 
100
101
 
101
102
  class LinkPlayTcpUartCommand(StrEnum):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python_linkplay
3
- Version: 0.0.16
3
+ Version: 0.0.18
4
4
  Summary: A Python Library for Seamless LinkPlay Device Control
5
5
  Author: Velleman Group nv
6
6
  License: MIT
@@ -1,15 +1,15 @@
1
1
  linkplay/__init__.py,sha256=y9ZehEq-KhS3cwn-PUpwVSJGfDUx7e5wf_G6guODcTk,56
2
2
  linkplay/__main__.py,sha256=Wcza80QaWfOaHjyJEfQYhB9kiPLE0NOqIj4zVWv2Nqs,577
3
- linkplay/__version__.py,sha256=5vMZ7nEbQLox_DLkqIOF_1TMciyAGIRp1uVHFqyV7Xc,23
4
- linkplay/bridge.py,sha256=A5W8Qgtn9KVNYdhxEmwP9iKoH5YTAknFrKJxDKd5juY,13120
5
- linkplay/consts.py,sha256=IoIEKT8yUULqtc2dui_5qBFTqx3OD15zzbHAkWHF-wY,13457
3
+ linkplay/__version__.py,sha256=Te1DfrvgEn6zd58FwD1NO8Ms7gZvtmQkfEmQw_u7h7k,23
4
+ linkplay/bridge.py,sha256=dJ0WfqkSEiFhp7vydqUCzBRt_Nxhylfg8pYZfs2e_N0,13619
5
+ linkplay/consts.py,sha256=5JQ-5CgmbPMBhrxhTb_0APnt1EnYhiNwsHn-68yDiTI,13486
6
6
  linkplay/controller.py,sha256=i3eLlaZ5pWoGgRT27I564Z9Bmi_aiY9g6lUocXE2qmk,2894
7
7
  linkplay/discovery.py,sha256=aEzN_94pKLmHKYIL7DxSW0FYRsaF2ruZe2bwXz0zf5U,4299
8
8
  linkplay/endpoint.py,sha256=5Ybr54aroFVEZ6fnFYP41QAuSP7-J9qHYAzLod4S3KY,2459
9
9
  linkplay/exceptions.py,sha256=tWJWHsKVkUEq3Yet1Z739IxcaQT8YamDeSp0tqHde9c,107
10
10
  linkplay/utils.py,sha256=aU_9TL39ngQaEMhFWMtlwB3POba2GjGlfNBshLFFS90,7788
11
- python_linkplay-0.0.16.dist-info/LICENSE,sha256=bgEtxMyjEHX_4uwaAY3GCFTm234D4AOZ5dM15sk26ms,1073
12
- python_linkplay-0.0.16.dist-info/METADATA,sha256=nCbgwBf0qR5YVVjdjpXtNu1txPcrTnoqaBeZ3wjgh00,2988
13
- python_linkplay-0.0.16.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
14
- python_linkplay-0.0.16.dist-info/top_level.txt,sha256=CpSaOVPTzJf5TVIL7MrotSCR34gcIOQy-11l4zGmxxM,9
15
- python_linkplay-0.0.16.dist-info/RECORD,,
11
+ python_linkplay-0.0.18.dist-info/LICENSE,sha256=bgEtxMyjEHX_4uwaAY3GCFTm234D4AOZ5dM15sk26ms,1073
12
+ python_linkplay-0.0.18.dist-info/METADATA,sha256=V4CmIWB_LMwkchCc3Ya0L3ao5BVM13CxcYtNq2VOet8,2988
13
+ python_linkplay-0.0.18.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
14
+ python_linkplay-0.0.18.dist-info/top_level.txt,sha256=CpSaOVPTzJf5TVIL7MrotSCR34gcIOQy-11l4zGmxxM,9
15
+ python_linkplay-0.0.18.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5