/
/
1"""
2Protocol definitions for provider dependencies.
3
4Allows typing of external provider references without importing concrete classes.
5"""
6
7from __future__ import annotations
8
9from collections.abc import AsyncGenerator
10from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
11
12if TYPE_CHECKING:
13 from music_assistant_models.enums import MediaType
14 from music_assistant_models.streamdetails import StreamDetails
15
16
17@runtime_checkable
18class YandexMusicProviderLike(Protocol):
19 """
20 Structural interface for the yandex_music MusicProvider.
21
22 Only the subset of methods/properties used by the Ynison plugin.
23 """
24
25 async def get_stream_details(self, item_id: str, media_type: MediaType) -> StreamDetails:
26 """Resolve stream details for a track."""
27 ...
28
29 def get_audio_stream(self, stream_details: StreamDetails) -> AsyncGenerator[bytes]:
30 """Return async generator of raw audio bytes."""
31 ...
32
33 async def get_rotor_station_tracks(
34 self, station_id: str, queue: str | int | None = None
35 ) -> tuple[list[Any], str | None]:
36 """Fetch tracks from a rotor station for radio queue replenishment."""
37 ...
38