/
/
/
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
34PLAYER_SOURCE_MAP = {
35 SOURCE_LINE_IN: PlayerSource(
36 id=SOURCE_LINE_IN,
37 name="Line-in",
38 passive=False,
39 can_play_pause=False,
40 can_next_previous=False,
41 can_seek=False,
42 ),
43 SOURCE_TV: PlayerSource(
44 id=SOURCE_TV,
45 name="TV",
46 passive=False,
47 can_play_pause=False,
48 can_next_previous=False,
49 can_seek=False,
50 ),
51 SOURCE_AIRPLAY: PlayerSource(
52 id=SOURCE_AIRPLAY,
53 name="AirPlay",
54 passive=True,
55 can_play_pause=True,
56 can_next_previous=True,
57 can_seek=True,
58 ),
59 SOURCE_SPOTIFY: PlayerSource(
60 id=SOURCE_SPOTIFY,
61 name="Spotify",
62 passive=True,
63 can_play_pause=True,
64 can_next_previous=True,
65 can_seek=True,
66 ),
67 SOURCE_RADIO: PlayerSource(
68 id=SOURCE_RADIO,
69 name="Radio",
70 passive=True,
71 can_play_pause=True,
72 can_next_previous=True,
73 can_seek=True,
74 ),
75}
76
77UNSUPPORTED_MODELS_NATIVE_ANNOUNCEMENTS = ("Play:1",)
78