music-assistant-server

1.7 KBPY
__init__.py
1.7 KB57 lines • python
1"""
2Universal Group Player provider.
3
4Create universal groups to group speakers of different
5protocols/ecosystems to play the same audio (but not in sync).
6"""
7
8from __future__ import annotations
9
10from typing import TYPE_CHECKING
11
12from music_assistant_models.enums import ProviderFeature
13
14from .player import UniversalGroupPlayer
15from .provider import UniversalGroupProvider
16
17if TYPE_CHECKING:
18    from music_assistant_models.config_entries import ConfigEntry, ConfigValueType, ProviderConfig
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 = {ProviderFeature.CREATE_GROUP_PLAYER, ProviderFeature.REMOVE_GROUP_PLAYER}
25
26
27async def setup(
28    mass: MusicAssistant, manifest: ProviderManifest, config: ProviderConfig
29) -> ProviderInstanceType:
30    """Initialize provider(instance) with given configuration."""
31    return UniversalGroupProvider(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 (for now)
48    return ()
49
50
51__all__ = (
52    "UniversalGroupPlayer",
53    "UniversalGroupProvider",
54    "get_config_entries",
55    "setup",
56)
57