pywiim 3.0.0__tar.gz → 3.0.2__tar.gz
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.
- {pywiim-3.0.0/pywiim.egg-info → pywiim-3.0.2}/PKG-INFO +1 -1
- {pywiim-3.0.0 → pywiim-3.0.2}/pyproject.toml +3 -1
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/__init__.py +1 -1
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/__init__.py +13 -3
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/base.py +1 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/debounce.py +6 -1
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/statemgr.py +24 -18
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/polling.py +1 -1
- {pywiim-3.0.0 → pywiim-3.0.2/pywiim.egg-info}/PKG-INFO +1 -1
- {pywiim-3.0.0 → pywiim-3.0.2}/LICENSE +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/README.md +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/__init__.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/audio_pro.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/audio_settings.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/base.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/bluetooth.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/constants.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/device.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/diagnostics.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/endpoints.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/eq.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/firmware.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/group.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/lms.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/loop_mode.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/misc.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/parser.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/peq.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/playback.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/preset.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/ssl.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/subwoofer.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/api/timer.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/backoff.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/capabilities.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/cli/__init__.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/cli/diagnostics.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/cli/discovery_cli.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/cli/group_test_cli.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/cli/join_test_cli.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/cli/monitor_cli.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/cli/verify_cli.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/client.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/device_capabilities.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/discovery.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/exceptions.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/group.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/group_helpers.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/mcp/__init__.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/mcp/__main__.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/mcp/config.example.json +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/mcp/config.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/mcp/context.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/mcp/server.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/metadata.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/model_names.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/models.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/normalize.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/audio.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/bluetooth.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/coverart.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/diagnostics.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/groupops.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/media.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/playback.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/properties.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/source_capabilities.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/stream.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/stream_enricher.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/player/volume.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/profiles.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/py.typed +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/role.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/state.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/upnp/__init__.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/upnp/client.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/upnp/eventer.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/upnp/health.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/upnp/metadata.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim/upnp/playqueue.py +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim.egg-info/SOURCES.txt +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim.egg-info/dependency_links.txt +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim.egg-info/entry_points.txt +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim.egg-info/requires.txt +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/pywiim.egg-info/top_level.txt +0 -0
- {pywiim-3.0.0 → pywiim-3.0.2}/setup.cfg +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pywiim"
|
|
7
|
-
version = "3.0.
|
|
7
|
+
version = "3.0.2"
|
|
8
8
|
description = "Python library for WiiM/LinkPlay device communication"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -113,4 +113,6 @@ addopts = "-m 'not integration'"
|
|
|
113
113
|
filterwarnings = [
|
|
114
114
|
"ignore:Unclosed client session:ResourceWarning",
|
|
115
115
|
"ignore:Unclosed connector:ResourceWarning",
|
|
116
|
+
"error:coroutine .* was never awaited:RuntimeWarning",
|
|
117
|
+
"error::pytest.PytestUnraisableExceptionWarning",
|
|
116
118
|
]
|
|
@@ -7,6 +7,7 @@ that adds group awareness, role management, and cached state with getter methods
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import logging
|
|
10
|
+
import time
|
|
10
11
|
from collections.abc import Callable, Sequence
|
|
11
12
|
from typing import TYPE_CHECKING, Any, Literal
|
|
12
13
|
|
|
@@ -410,16 +411,25 @@ class Player(PlayerBase):
|
|
|
410
411
|
self._on_state_changed()
|
|
411
412
|
|
|
412
413
|
async def initialize_peq_presets(self) -> None:
|
|
413
|
-
"""Read saved PEQ
|
|
414
|
+
"""Read saved PEQ names if the player's cache is not initialized."""
|
|
414
415
|
if self._peq_presets is not None:
|
|
415
416
|
return
|
|
416
|
-
|
|
417
|
-
self._peq_presets = list(dict.fromkeys(name for key in ("custom", "preset") for name in presets[key] if name))
|
|
417
|
+
await self._refresh_peq_presets()
|
|
418
418
|
try:
|
|
419
419
|
await self.refresh_peq_preset()
|
|
420
420
|
except WiiMError as err:
|
|
421
421
|
_LOGGER.debug("Could not read initial PEQ state for %s: %s", self.host, err)
|
|
422
422
|
|
|
423
|
+
async def _refresh_peq_presets(self) -> None:
|
|
424
|
+
"""Refresh saved names without changing the active PEQ state."""
|
|
425
|
+
try:
|
|
426
|
+
presets = await self.client.get_peq_preset_list()
|
|
427
|
+
self._peq_presets = list(
|
|
428
|
+
dict.fromkeys(name for key in ("custom", "preset") for name in presets[key] if name)
|
|
429
|
+
)
|
|
430
|
+
finally:
|
|
431
|
+
self._last_peq_presets_check = time.time()
|
|
432
|
+
|
|
423
433
|
async def refresh_peq_preset(self) -> None:
|
|
424
434
|
"""Refresh the current input's active PEQ preset."""
|
|
425
435
|
async with self._peq_lock:
|
|
@@ -158,6 +158,7 @@ class PlayerBase:
|
|
|
158
158
|
self._room_correction_name: str = ""
|
|
159
159
|
self._last_room_correction_check: float = 0
|
|
160
160
|
self._peq_presets: list[str] | None = None
|
|
161
|
+
self._last_peq_presets_check: float = 0
|
|
161
162
|
self._peq_preset: str | None = None
|
|
162
163
|
self._peq_enabled: bool | None = None
|
|
163
164
|
self._last_peq_state_check: float = 0
|
|
@@ -46,7 +46,12 @@ class PlayStateDebouncer:
|
|
|
46
46
|
|
|
47
47
|
try:
|
|
48
48
|
loop = asyncio.get_event_loop()
|
|
49
|
-
|
|
49
|
+
pending = self._apply_delayed_state(new_state)
|
|
50
|
+
try:
|
|
51
|
+
self._pending_task = loop.create_task(pending)
|
|
52
|
+
except RuntimeError:
|
|
53
|
+
pending.close()
|
|
54
|
+
raise
|
|
50
55
|
except RuntimeError:
|
|
51
56
|
# No event loop (sync context) - apply immediately
|
|
52
57
|
_LOGGER.debug("No event loop available, applying state immediately: %s", new_state)
|
|
@@ -58,6 +58,10 @@ def _coerce_player_play_state(value: str | None) -> _PlayerPlayState | None:
|
|
|
58
58
|
# UPnP retry cooldown - wait this many seconds between failed creation attempts
|
|
59
59
|
UPNP_RETRY_COOLDOWN = 60.0
|
|
60
60
|
|
|
61
|
+
# Saved EQ names change infrequently; retry an empty initial cache sooner.
|
|
62
|
+
EQ_PRESET_LIST_INTERVAL = 15 * 60.0
|
|
63
|
+
EQ_PRESET_INITIAL_RETRY_INTERVAL = 60.0
|
|
64
|
+
|
|
61
65
|
# Sources where play_url() filename fallback is the intended title.
|
|
62
66
|
# WiiM reports URL playback as custompushurl (display name "URL Stream").
|
|
63
67
|
_URL_PLAYBACK_SOURCES = frozenset({"wifi", "network", "ethernet", "usb", "udisk", "http", "custompushurl"})
|
|
@@ -1079,21 +1083,14 @@ class StateManager:
|
|
|
1079
1083
|
# Clear cached state on exception to avoid showing stale information
|
|
1080
1084
|
self.player._audio_output_status = None
|
|
1081
1085
|
|
|
1082
|
-
#
|
|
1083
|
-
#
|
|
1084
|
-
# Periodic fetch ensures list stays current even without activity
|
|
1086
|
+
# Saved lists change infrequently and are independent of track changes.
|
|
1087
|
+
# A new input invalidates the graphic list and needs an immediate read.
|
|
1085
1088
|
eq_supported = self.player.client.capabilities.get("supports_eq", False)
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
or (self.player._eq_presets is None and now - (self.player._last_eq_presets_check or 0) >= 60)
|
|
1090
|
-
or (
|
|
1091
|
-
self._polling_strategy
|
|
1092
|
-
and self._polling_strategy.should_fetch_eq_info(
|
|
1093
|
-
self.player._last_eq_presets_check, eq_supported, now=now
|
|
1094
|
-
)
|
|
1095
|
-
)
|
|
1089
|
+
last_eq_list_check = self.player._last_eq_presets_check or 0
|
|
1090
|
+
eq_list_interval = (
|
|
1091
|
+
EQ_PRESET_INITIAL_RETRY_INTERVAL if self.player._eq_presets is None else EQ_PRESET_LIST_INTERVAL
|
|
1096
1092
|
)
|
|
1093
|
+
should_fetch_eq_presets = full or not last_eq_list_check or now - last_eq_list_check >= eq_list_interval
|
|
1097
1094
|
if should_fetch_eq_presets and eq_supported:
|
|
1098
1095
|
source = self.player._eq_state_source
|
|
1099
1096
|
revision = self.player._eq_state_revision
|
|
@@ -1107,9 +1104,8 @@ class StateManager:
|
|
|
1107
1104
|
if source == self.player._eq_state_source and revision == self.player._eq_state_revision:
|
|
1108
1105
|
self.player._last_eq_presets_check = now
|
|
1109
1106
|
|
|
1110
|
-
# EQGetBand - enabled flag and preset name.
|
|
1111
|
-
#
|
|
1112
|
-
# without trusting the stale status field.
|
|
1107
|
+
# EQGetBand - enabled flag and preset name. Active state retains its own
|
|
1108
|
+
# shorter cadence and can change without the saved preset list changing.
|
|
1113
1109
|
should_fetch_eq_status = (
|
|
1114
1110
|
full
|
|
1115
1111
|
or track_changed
|
|
@@ -1289,9 +1285,18 @@ class StateManager:
|
|
|
1289
1285
|
except Exception as err:
|
|
1290
1286
|
_LOGGER.debug("Failed to fetch DAC digital filter for %s: %s", self.player.host, err)
|
|
1291
1287
|
|
|
1292
|
-
#
|
|
1293
|
-
# switch together on the same 60s tier. supports_peq is the gate.
|
|
1288
|
+
# PEQ names are cached independently of the current input's active state.
|
|
1294
1289
|
peq_supported = bool(self.player.client.capabilities.get("supports_peq", False))
|
|
1290
|
+
last_peq_list_check = self.player._last_peq_presets_check or 0
|
|
1291
|
+
peq_list_interval = (
|
|
1292
|
+
EQ_PRESET_INITIAL_RETRY_INTERVAL if self.player._peq_presets is None else EQ_PRESET_LIST_INTERVAL
|
|
1293
|
+
)
|
|
1294
|
+
if peq_supported and (full or not last_peq_list_check or now - last_peq_list_check >= peq_list_interval):
|
|
1295
|
+
try:
|
|
1296
|
+
await self.player._refresh_peq_presets()
|
|
1297
|
+
except Exception as err:
|
|
1298
|
+
_LOGGER.debug("Failed to fetch PEQ presets for %s: %s", self.player.host, err)
|
|
1299
|
+
|
|
1295
1300
|
should_fetch_peq = (
|
|
1296
1301
|
full
|
|
1297
1302
|
or eq_source_changed
|
|
@@ -1309,6 +1314,7 @@ class StateManager:
|
|
|
1309
1314
|
self.player._last_peq_state_check = now
|
|
1310
1315
|
except Exception as err:
|
|
1311
1316
|
_LOGGER.debug("Failed to fetch PEQ state for %s: %s", self.player.host, err)
|
|
1317
|
+
# RoomFit profiles and state remain on their existing configuration tier.
|
|
1312
1318
|
should_fetch_room = full or (
|
|
1313
1319
|
self._polling_strategy
|
|
1314
1320
|
and self._polling_strategy.should_fetch_led_indicator(
|
|
@@ -63,7 +63,7 @@ class PollingStrategy:
|
|
|
63
63
|
# Polling interval constants (in seconds)
|
|
64
64
|
FAST_POLL_INTERVAL = 1.0 # Active Playback / UI Responsiveness
|
|
65
65
|
NORMAL_POLL_INTERVAL = 5.0 # Idle / Background
|
|
66
|
-
CONFIGURATION_INTERVAL = 60.0 # Bluetooth, EQ
|
|
66
|
+
CONFIGURATION_INTERVAL = 60.0 # Bluetooth, active EQ state, device info
|
|
67
67
|
# Faster tier for user-toggled hardware (12V trigger, subwoofer) — light GETs, visible in HA/monitor
|
|
68
68
|
HARDWARE_STATUS_INTERVAL = 15.0
|
|
69
69
|
METADATA_CHECK_INTERVAL = 1.0 # Check for track changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|