music-assistant-server

1.7 KBPY
__init__.py
1.7 KB57 lines • python
1"""
2Sync Group Player provider.
3
4Create sync groups to group compatible speakers to play audio in sync.
5"""
6
7from __future__ import annotations
8
9from typing import TYPE_CHECKING
10
11from music_assistant_models.enums import ProviderFeature
12
13from .player import SyncGroupPlayer
14from .provider import SyncGroupProvider
15
16if TYPE_CHECKING:
17    from music_assistant_models.config_entries import ConfigEntry, ConfigValueType, ProviderConfig
18    from music_assistant_models.provider import ProviderManifest
19
20    from music_assistant import MusicAssistant
21    from music_assistant.models import ProviderInstanceType
22
23SUPPORTED_FEATURES = {ProviderFeature.CREATE_GROUP_PLAYER, ProviderFeature.REMOVE_GROUP_PLAYER}
24
25
26async def setup(
27    mass: MusicAssistant, manifest: ProviderManifest, config: ProviderConfig
28) -> ProviderInstanceType:
29    """Initialize provider(instance) with given configuration."""
30    return SyncGroupProvider(mass, manifest, config, SUPPORTED_FEATURES)
31
32
33async def get_config_entries(
34    mass: MusicAssistant,  # noqa: ARG001
35    instance_id: str | None = None,  # noqa: ARG001
36    action: str | None = None,  # noqa: ARG001
37    values: dict[str, ConfigValueType] | None = None,  # noqa: ARG001
38) -> tuple[ConfigEntry, ...]:
39    """
40    Return Config entries to setup this provider.
41
42    :param mass: MusicAssistant instance.
43    :param instance_id: id of an existing provider instance (None if new instance setup).
44    :param action: [optional] action key called from config entries UI.
45    :param 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    "SyncGroupPlayer",
53    "SyncGroupProvider",
54    "get_config_entries",
55    "setup",
56)
57