/
/
/
1"""Constants for the Sonos (S2) provider."""
2
3from __future__ import annotations
4
5from aiosonos.api.models import PlayBackState as SonosPlayBackState
6from music_assistant_models.enums import PlaybackState, PlayerFeature
7
8from music_assistant.models.player import PlayerSource
9
10PLAYBACK_STATE_MAP = {
11 SonosPlayBackState.PLAYBACK_STATE_BUFFERING: PlaybackState.PLAYING,
12 SonosPlayBackState.PLAYBACK_STATE_IDLE: PlaybackState.IDLE,
13 SonosPlayBackState.PLAYBACK_STATE_PAUSED: PlaybackState.PAUSED,
14 SonosPlayBackState.PLAYBACK_STATE_PLAYING: PlaybackState.PLAYING,
15}
16
17PLAYER_FEATURES_BASE = {
18 PlayerFeature.SET_MEMBERS,
19 PlayerFeature.PAUSE,
20 PlayerFeature.ENQUEUE,
21 PlayerFeature.NEXT_PREVIOUS,
22 PlayerFeature.SEEK,
23 PlayerFeature.SELECT_SOURCE,
24 PlayerFeature.GAPLESS_PLAYBACK,
25}
26
27SOURCE_LINE_IN = "line_in"
28SOURCE_AIRPLAY = "airplay"
29SOURCE_SPOTIFY = "spotify"
30SOURCE_UNKNOWN = "unknown"
31SOURCE_TV = "tv"
32SOURCE_RADIO = "radio"
33
34CONF_AIRPLAY_MODE = "airplay_mode"
35
36PLAYER_SOURCE_MAP = {
37 SOURCE_LINE_IN: PlayerSource(
38 id=SOURCE_LINE_IN,
39 name="Line-in",
40 passive=False,
41 can_play_pause=False,
42 can_next_previous=False,
43 can_seek=False,
44 ),
45 SOURCE_TV: PlayerSource(
46 id=SOURCE_TV,
47 name="TV",
48 passive=False,
49 can_play_pause=False,
50 can_next_previous=False,
51 can_seek=False,
52 ),
53 SOURCE_AIRPLAY: PlayerSource(
54 id=SOURCE_AIRPLAY,
55 name="AirPlay",
56 passive=True,
57 can_play_pause=True,
58 can_next_previous=True,
59 can_seek=True,
60 ),
61 SOURCE_SPOTIFY: PlayerSource(
62 id=SOURCE_SPOTIFY,
63 name="Spotify",
64 passive=True,
65 can_play_pause=True,
66 can_next_previous=True,
67 can_seek=True,
68 ),
69 SOURCE_RADIO: PlayerSource(
70 id=SOURCE_RADIO,
71 name="Radio",
72 passive=True,
73 can_play_pause=True,
74 can_next_previous=True,
75 can_seek=True,
76 ),
77}
78
79UNSUPPORTED_MODELS_NATIVE_ANNOUNCEMENTS = ("Play:1",)
80