Fix Yandex Station credential borrowing and stream playback - #5605
Open
trudenboy wants to merge 5 commits into
Open
Fix Yandex Station credential borrowing and stream playback#5605trudenboy wants to merge 5 commits into
trudenboy wants to merge 5 commits into
Conversation
Co-authored-by: Administrator <admin@example.com> Co-authored-by: marcelveldt <marcelveldt@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Yandex Station authentication borrowing and firmware-aware stream playback.
Changes:
- Reads linked Yandex Music setup credentials with startup retries.
- Adds
audio_playsupport while retaining legacyradio_play. - Expands authentication, playback, announcement, and setup tests.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
music_assistant/providers/yandex_station/VERSION |
Updates provider version. |
music_assistant/providers/yandex_station/borrow.py |
Adds setup-data credential borrowing. |
music_assistant/providers/yandex_station/manifest.json |
Updates authentication dependency. |
music_assistant/providers/yandex_station/player.py |
Adds firmware-aware playback and state handling. |
music_assistant/providers/yandex_station/provider.py |
Adds borrowed-token startup retries. |
music_assistant/providers/yandex_station/setup_flow.py |
Normalizes QR URI type. |
tests/providers/yandex_station/test_announcements.py |
Tests announcement playback. |
tests/providers/yandex_station/test_auth_wrappers.py |
Tests authentication wrappers. |
tests/providers/yandex_station/test_borrow_mode.py |
Tests borrowing and startup retries. |
tests/providers/yandex_station/test_borrow_setup_data.py |
Tests setup-data account selection. |
tests/providers/yandex_station/test_player_state.py |
Tests playback commands and state transitions. |
tests/providers/yandex_station/test_project_consistency.py |
Checks standalone dependency consistency. |
tests/providers/yandex_station/test_protobuf.py |
Tests stream command payloads. |
tests/providers/yandex_station/test_provider_cascade.py |
Updates cascade test persistence. |
tests/providers/yandex_station/test_setup_flow_unit.py |
Tests interactive setup paths. |
tests/providers/yandex_station/test_setup_script.py |
Tests standalone setup safety. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
Suppressed comments (3)
music_assistant/providers/yandex_station/borrow.py:39
- [CRITICAL] This early return gives legacy config precedence whenever either old token remains, so guided-flow setup data—including rotated or deliberately cleared credentials—is ignored and borrowing can authenticate with stale credentials; retain
super().read_tokens()for validation/fallback but preferowner.get_setup_value()when available.
music_token, x_token = super().read_tokens()
if music_token is not None or x_token is not None:
return music_token, x_token
music_assistant/providers/yandex_station/provider.py:474
- [PROBLEM]
resolve_music_token()also raisesResourceTemporarilyUnavailablefor Passport network/rate-limit failures, so this loop can retry an external call 40 times at 250 ms instead of only waiting for provider load; poll the non-networkedread_tokens()readiness first, then resolve once so the normal retry/backoff handles Passport outages.
except ResourceTemporarilyUnavailable:
if attempt == _BORROW_SOURCE_LOAD_ATTEMPTS - 1:
raise
await asyncio.sleep(_BORROW_SOURCE_LOAD_DELAY)
music_assistant/providers/yandex_station/player.py:1212
- [PROBLEM] This applies progress even when
external_media_matchesisFalse, so the stale old-track update explicitly handled above is exposed as the newly requested track's elapsed position; ignore progress from known-mismatched player state.
if self._external_audio_client:
self._attr_elapsed_time = progress
self._attr_elapsed_time_last_updated = time.time()
Comment on lines
+465
to
+474
| for attempt in range(_BORROW_SOURCE_LOAD_ATTEMPTS): | ||
| try: | ||
| music_token = await self._borrow_source.resolve_music_token() | ||
| _, x_token = self._borrow_source.read_tokens() | ||
| return music_token, x_token | ||
| except ResourceTemporarilyUnavailable: | ||
| if attempt == _BORROW_SOURCE_LOAD_ATTEMPTS - 1: | ||
| raise | ||
| await asyncio.sleep(_BORROW_SOURCE_LOAD_DELAY) | ||
| raise RuntimeError("Borrowed credential wait exhausted unexpectedly") |
Comment on lines
+1093
to
1100
| elif ( | ||
| self._external_play_confirmed | ||
| and alice_state in ("IDLE", "") | ||
| and external_media_matches is not False | ||
| ): | ||
| # Stream was playing, now stopped without voice trigger → | ||
| # user pressed physical pause/stop on the speaker. | ||
| self._handle_physical_pause() |
Comment on lines
+1084
to
+1088
| if self._external_audio_client: | ||
| if external_media_matches is True or ( | ||
| external_media_matches is None and self._external_stop_observed | ||
| ): | ||
| self._external_play_confirmed = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this implement/fix?
Synchronizes the Yandex Station provider from v1.5.6 to v1.5.6 and fixes two
regressions affecting current Music Assistant and Yandex Station installations.
Authentication borrowing
the legacy provider-config fallback.
avoiding a startup-order race that previously left the Station provider
unavailable.
ya-passport-auth[ma]==1.8.0.Stream playback on current Station firmware
audio_clientcapability and sendsaudio_playwithtrack/HLS metadata on current firmware.
radio_playas a fallback for older firmware.progress reported by
audio_play.from the previous source cannot turn a normal track handoff into a reported
physical pause.
compatibility with cores that do not expose the announcement-duration
resolver.
The PR also includes the corresponding authentication, setup-flow,
announcement, protobuf, player-state, and project-consistency tests, plus a
small return-type normalization for generated QR data URIs.
Source provider: trudenboy/ma-provider-yandex-station, version 1.5.6
Related issue (if applicable):
Types of changes
bugfixnew-featureenhancementnew-providerbreaking-changerefactordocumentationmaintenancecidependenciesChecklist
pre-commit run --all-filespasses.pytestpasses, and tests have been added/updated undertests/where applicable.music-assistant/modelsis linked.music-assistant/frontendis linked.