Skip to content

Add Yandex Music Connect (Ynison) plugin provider#3614

Open
trudenboy wants to merge 9 commits intomusic-assistant:devfrom
trudenboy:upstream/yandex_ynison
Open

Add Yandex Music Connect (Ynison) plugin provider#3614
trudenboy wants to merge 9 commits intomusic-assistant:devfrom
trudenboy:upstream/yandex_ynison

Conversation

@trudenboy
Copy link
Copy Markdown
Contributor

@trudenboy trudenboy commented Apr 8, 2026

Summary

Add new Yandex Music Connect (Ynison) plugin provider that makes Music Assistant players appear as playback devices in the Yandex Music app — similar to how Spotify Connect works.

When a user selects the MA device in the Yandex Music app, the plugin receives track IDs via the Ynison WebSocket protocol, fetches audio from Yandex Music CDN (via the linked yandex_music MusicProvider), and streams PCM to the selected MA player.

Architecture

Yandex Music app (phone/web/desktop)
  -> Ynison WebSocket <-> YandexYnisonProvider
    -> receives track_id from PlayerState
    -> fetches audio via Yandex Music API (reuses yandex_music provider)
    -> PCM audio -> PluginSource -> MA Player (Chromecast/DLNA/AirPlay/etc.)
    <- play/pause/seek/next/prev -> update_playing_status back to Ynison

Key features

  • Ynison WebSocket protocol: two-step connection (redirector → state service), device registration, bidirectional state sync
  • Exponential-backoff reconnect with jitter, session ownership tracking, and graceful disconnect handling
  • Audio streaming via linked yandex_music MusicProvider with FFmpeg PCM conversion (-re realtime pacing) and byte-accurate progress sync
  • Authentication via ya-passport-auth==1.2.3 — QR code flow with automatic music-token refresh from x_token (self-healing)
  • Playback control: play / pause / next / prev / seek, synced bidirectionally to Ynison state
  • Echo detection: prevents feedback loops when our own state updates bounce back from Ynison
  • Radio queue management: proactive prefetch of next radio batch at ~80% track progress, SyncStateFromEOV for queue replenishment, bounds-validated queue advancement
  • Pause-resume handling: polling-based pause wait (1s intervals, 30s deadline) to correctly handle same-track resume without blocking on track-change events
  • Plugin source ownership: clean in_use_by lifecycle — released on pause, re-acquired on resume via needs_reselect flag
  • Player selection: auto (first available) or manual target player
  • Multi-instance support: token sharing between instances, custom device names via instance_name_postfix
  • Metadata sync: title, cover art, duration, and elapsed time pushed to MA frontend via StreamMetadata

Changed files

File Lines Description
providers/yandex_ynison/__init__.py 246 Plugin setup, config entries, QR auth flow, sibling token detection
providers/yandex_ynison/provider.py 1353 Core plugin: state machine, streaming, queue management, echo detection
providers/yandex_ynison/ynison_client.py 670 Ynison WebSocket client: two-step connect, state sync, reconnect with backoff
providers/yandex_ynison/streaming.py 49 PCM format helpers, pacing args
providers/yandex_ynison/yandex_auth.py 73 Thin wrapper around ya-passport-auth for QR auth and token refresh
providers/yandex_ynison/constants.py 55 Protocol URLs, config keys, defaults
providers/yandex_ynison/protocols.py 39 Protocol types for provider/client decoupling
providers/yandex_ynison/config_helpers.py 31 Config entry helpers for player selection
providers/yandex_ynison/manifest.json 12 Plugin metadata (ya-passport-auth==1.2.3, depends_on: yandex_music)
providers/yandex_ynison/icon.svg 3 Provider icon
requirements_all.txt +1 Added ya-passport-auth==1.2.3
tests/.../test_provider.py 1918 Provider unit tests (state machine, streaming, queue, echo detection)
tests/.../test_ynison_client.py 1400 WebSocket client tests (connect, reconnect, state parsing)
tests/.../test_yandex_auth.py 254 Auth flow tests (QR login, token refresh, error handling)
tests/.../test_streaming.py 83 Streaming helper tests (format creation, pacing)

Test plan

  • 179 unit tests pass (pytest)
  • ruff lint and format clean
  • mypy type check clean
  • Manual testing on HAOS: device appears in Yandex Music app, audio plays through MA player (DLNA), track changes, pause/resume, seek, and radio queue advancement work correctly

Dependencies

  • ya-passport-auth==1.2.3 — Yandex passport authentication (QR login, token management)
  • Requires yandex_music MusicProvider (depends_on in manifest) — hard requirement for audio streaming; the plugin will not load without it. Runtime detection via _check_yandex_provider_match() handles the edge case where the provider is unloaded while the plugin is running.

Source: trudenboy/ma-provider-yandex-ynison · branch dev · v1.5.2

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🔒 Dependency Security Report

📦 Modified Dependencies

music_assistant/providers/yandex_ynison/manifest.json

Added:

The following dependencies were added or modified:

diff --git a/requirements_all.txt b/requirements_all.txt
index ba714854..0a5c4d83 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -87,6 +87,7 @@ unidecode==1.4.0
 uv>=0.8.0
 websocket-client==1.9.0
 xmltodict==1.0.4
+ya-passport-auth==1.2.3
 yandex-music==2.2.0
 ytmusicapi==1.11.5
 zeroconf==0.148.0

New/modified packages to review:

  • ya-passport-auth==1.2.3

🔍 Vulnerability Scan Results

ERROR:pip_audit._virtual_env:internal pip failure: ERROR: Ignored the following versions that require a different python version: 0.10.0 Requires-Python >=3.10,<3.13; 0.9.0 Requires-Python >=3.8,<3.12; 0.9.1 Requires-Python >=3.8,<3.12
ERROR: Could not find a version that satisfies the requirement audible==0.10.0 (from versions: 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.6.0, 0.7.0, 0.7.1, 0.7.2, 0.8.0, 0.8.1, 0.8.2)
ERROR: No matching distribution found for audible==0.10.0

ERROR:pip_audit._cli:Failed to install packages: ['/tmp/tmpg133x843/bin/python', '-m', 'pip', 'install', '--no-input', '--keyring-provider=subprocess', '--dry-run', '--report', '/tmp/tmp7z9pjj3l/tmp6adswblu', '-r', 'requirements_all.txt']

⚠️ Vulnerabilities detected! Please review the findings above.


Automated Security Checks

  • Vulnerability Scan: Failed - Known vulnerabilities detected
  • Trusted Sources: All packages have verified source repositories
  • Typosquatting Check: No suspicious package names detected
  • License Compatibility: All licenses are OSI-approved and compatible
  • Supply Chain Risk: Passed - packages appear mature and maintained

Manual Review

Maintainer approval required:

  • I have reviewed the changes above and approve these dependency updates

To approve: Comment /approve-dependencies or manually add the dependencies-reviewed label.

@trudenboy trudenboy changed the title feat(yandex_ynison): add yandex_ynison provider v1.0.0 feat: add Yandex Music Connect (Ynison) plugin provider Apr 8, 2026
@trudenboy trudenboy changed the title feat: add Yandex Music Connect (Ynison) plugin provider Add Yandex Music Connect (Ynison) plugin provider Apr 8, 2026
@trudenboy trudenboy marked this pull request as ready for review April 8, 2026 16:48
Copilot AI review requested due to automatic review settings April 8, 2026 16:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new yandex_ynison plugin provider that exposes Music Assistant players as Yandex Music Connect (Ynison) devices, including QR-based authentication, a WebSocket client for Ynison state sync, and PCM streaming via the existing yandex_music provider.

Changes:

  • Introduce the Ynison WebSocket client (redirector → state service) with reconnect and state parsing/sending helpers.
  • Add the plugin provider that maps Ynison state/control to Music Assistant player/source selection and streaming via ffmpeg conversion.
  • Add QR authentication helpers and a unit test suite for client/provider behavior.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
music_assistant/providers/yandex_ynison/__init__.py Provider setup and config flow (QR auth actions, player selection options).
music_assistant/providers/yandex_ynison/constants.py Centralized protocol/config constants for Ynison.
music_assistant/providers/yandex_ynison/manifest.json Declares the plugin provider metadata and docs link.
music_assistant/providers/yandex_ynison/icon.svg Provider icon asset.
music_assistant/providers/yandex_ynison/yandex_auth.py Yandex Passport QR auth + token exchange helpers.
music_assistant/providers/yandex_ynison/ynison_client.py Core Ynison WebSocket client implementation (connect, message loop, reconnect, send/state parsing).
music_assistant/providers/yandex_ynison/provider.py PluginProvider implementation bridging Ynison state to MA playback/source and streaming.
tests/providers/yandex_ynison/__init__.py Test package marker.
tests/providers/yandex_ynison/test_ynison_client.py Unit tests for protocol header/state parsing/sending/disconnect/device-id generation.
tests/providers/yandex_ynison/test_provider.py Unit tests for provider init, player selection, source selection behavior, provider matching, and Ynison state handling.

Comment thread music_assistant/providers/yandex_ynison/ynison_client.py Outdated
Comment thread music_assistant/providers/yandex_ynison/ynison_client.py Outdated
Comment thread music_assistant/providers/yandex_ynison/ynison_client.py
Comment thread music_assistant/providers/yandex_ynison/provider.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Comment thread music_assistant/providers/yandex_ynison/provider.py
Comment thread music_assistant/providers/yandex_ynison/ynison_client.py
Comment thread music_assistant/providers/yandex_ynison/ynison_client.py
Comment thread music_assistant/providers/yandex_ynison/provider.py
Copilot AI review requested due to automatic review settings April 9, 2026 12:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/provider.py
Comment thread music_assistant/providers/yandex_ynison/provider.py
Copilot AI review requested due to automatic review settings April 9, 2026 14:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Comment thread music_assistant/providers/yandex_ynison/ynison_client.py Outdated
Comment thread music_assistant/providers/yandex_ynison/ynison_client.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py
Copilot AI review requested due to automatic review settings April 9, 2026 14:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/provider.py
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copilot AI review requested due to automatic review settings April 9, 2026 15:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/provider.py
Copilot AI review requested due to automatic review settings April 9, 2026 15:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copilot AI review requested due to automatic review settings April 9, 2026 16:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Comment thread music_assistant/providers/yandex_ynison/ynison_client.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copilot AI review requested due to automatic review settings April 9, 2026 19:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/provider.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/manifest.json
Comment thread music_assistant/providers/yandex_ynison/ynison_client.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/ynison_client.py
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/config_helpers.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Comment thread music_assistant/providers/yandex_ynison/ynison_client.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.

Comment thread music_assistant/providers/yandex_ynison/crossfade.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/crossfade.py Outdated
Comment thread music_assistant/providers/yandex_ynison/prebuffer.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/provider.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 20 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/prebuffer.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 20 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/prebuffer.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 20 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/crossfade.py Outdated
Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 20 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
trudenboy and others added 2 commits April 15, 2026 08:26
Makes Music Assistant players appear as devices in the Yandex Music app
via the Ynison protocol (similar to Spotify Connect).

- Ynison WebSocket client with two-step connection and reconnect
- Audio streaming via linked yandex_music provider with FFmpeg PCM
- Bidirectional playback control (play/pause/seek/next/prev)
- QR-code authentication via ya-passport-auth
- Radio queue management with proactive prefetch
- Echo detection to prevent state sync feedback loops
- 179 unit tests

Depends on: yandex_music MusicProvider
Requires: ya-passport-auth==1.2.3

Source: trudenboy/ma-provider-yandex-ynison v1.5.2

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/provider.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.

Comment thread music_assistant/providers/yandex_ynison/ynison_client.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Comment thread music_assistant/providers/yandex_ynison/provider.py Outdated
Comment thread music_assistant/providers/yandex_ynison/protocols.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants