/
/
/
1"""
2Universal Player provider.
3
4Auto-creates virtual players that merge multiple protocol players
5(AirPlay, Chromecast, DLNA, Squeezelite, SendSpin) for the same device
6into a single unified player when no native provider exists.
7"""
8
9from __future__ import annotations
10
11from typing import TYPE_CHECKING
12
13from .player import UniversalPlayer
14from .provider import UniversalPlayerProvider
15
16if TYPE_CHECKING:
17 from music_assistant_models.config_entries import ConfigEntry, ConfigValueType, ProviderConfig
18 from music_assistant_models.enums import ProviderFeature
19 from music_assistant_models.provider import ProviderManifest
20
21 from music_assistant import MusicAssistant
22 from music_assistant.models import ProviderInstanceType
23
24SUPPORTED_FEATURES: set[ProviderFeature] = set()
25
26
27async def setup(
28 mass: MusicAssistant, manifest: ProviderManifest, config: ProviderConfig
29) -> ProviderInstanceType:
30 """Initialize provider(instance) with given configuration."""
31 return UniversalPlayerProvider(mass, manifest, config, SUPPORTED_FEATURES)
32
33
34async def get_config_entries(
35 mass: MusicAssistant, # noqa: ARG001
36 instance_id: str | None = None, # noqa: ARG001
37 action: str | None = None, # noqa: ARG001
38 values: dict[str, ConfigValueType] | None = None, # noqa: ARG001
39) -> tuple[ConfigEntry, ...]:
40 """
41 Return Config entries to setup this provider.
42
43 instance_id: id of an existing provider instance (None if new instance setup).
44 action: [optional] action key called from config entries UI.
45 values: the (intermediate) raw values for config entries sent with the action.
46 """
47 # Nothing to configure - universal players are auto-created
48 return ()
49
50
51__all__ = (
52 "UniversalPlayer",
53 "UniversalPlayerProvider",
54 "get_config_entries",
55 "setup",
56)
57