/
/
/
1"""Constants for the Bluesound provider."""
2
3from __future__ import annotations
4
5from music_assistant_models.enums import PlaybackState, PlayerFeature
6
7from music_assistant.models.player import PlayerSource
8
9IDLE_POLL_INTERVAL = 30
10PLAYBACK_POLL_INTERVAL = 10
11
12# how many polls a playing player may report 'connecting' before it counts as stopped.
13# spans the grace period the streams controller gives a player to empty its buffer.
14MAX_CONNECTING_POLLS = 2
15
16PLAYER_FEATURES_BASE = {
17 PlayerFeature.PLAY_MEDIA,
18 PlayerFeature.SET_MEMBERS,
19 PlayerFeature.VOLUME_SET,
20 PlayerFeature.VOLUME_MUTE,
21 PlayerFeature.PAUSE,
22 PlayerFeature.SELECT_SOURCE,
23 PlayerFeature.NEXT_PREVIOUS,
24 PlayerFeature.SEEK,
25}
26
27PLAYBACK_STATE_MAP = {
28 "play": PlaybackState.PLAYING,
29 "stream": PlaybackState.PLAYING,
30 "stop": PlaybackState.IDLE,
31 "pause": PlaybackState.PAUSED,
32 "connecting": PlaybackState.IDLE,
33}
34
35SOURCE_TIDAL = "Tidal"
36SOURCE_AIRPLAY = "AirPlay"
37SOURCE_SPOTIFY = "Spotify"
38SOURCE_RADIOPARADISE = "RadioParadise"
39SOURCE_TUNEIN = "TuneIn"
40SOURCE_HTTP = "http"
41SOURCE_BLUETOOTH = "Bluetooth"
42SOURCE_TV = "HDMI ARC"
43
44PLAYER_SOURCE_MAP = {
45 SOURCE_HTTP: PlayerSource(
46 id=SOURCE_HTTP,
47 name="HTTP Stream",
48 passive=True,
49 can_play_pause=True,
50 can_next_previous=False,
51 can_seek=False,
52 ),
53 SOURCE_BLUETOOTH: PlayerSource(
54 id=SOURCE_BLUETOOTH,
55 name="Bluetooth",
56 passive=True,
57 can_play_pause=True,
58 can_next_previous=False,
59 can_seek=False,
60 ),
61 SOURCE_TV: PlayerSource(
62 id=SOURCE_TV,
63 name="HDMI ARC",
64 passive=True,
65 can_play_pause=False,
66 can_next_previous=False,
67 can_seek=False,
68 ),
69 SOURCE_AIRPLAY: PlayerSource(
70 id=SOURCE_AIRPLAY,
71 name="AirPlay",
72 passive=True,
73 can_play_pause=True,
74 can_next_previous=False,
75 can_seek=False,
76 ),
77 SOURCE_SPOTIFY: PlayerSource(
78 id=SOURCE_SPOTIFY,
79 name="Spotify",
80 passive=True,
81 can_play_pause=True,
82 can_next_previous=True,
83 can_seek=True,
84 ),
85 SOURCE_TIDAL: PlayerSource(
86 id=SOURCE_TIDAL,
87 name="Tidal",
88 passive=True,
89 can_play_pause=True,
90 can_next_previous=True,
91 can_seek=True,
92 ),
93 SOURCE_RADIOPARADISE: PlayerSource(
94 id=SOURCE_RADIOPARADISE,
95 name="Radio Paradise",
96 passive=True,
97 can_play_pause=True,
98 can_next_previous=True,
99 can_seek=False,
100 ),
101 SOURCE_TUNEIN: PlayerSource(
102 id=SOURCE_TUNEIN,
103 name="TuneIn",
104 passive=True,
105 can_play_pause=True,
106 can_next_previous=False,
107 can_seek=False,
108 ),
109}
110
111POLL_STATE_STATIC = "static"
112POLL_STATE_DYNAMIC = "dynamic"
113
114MUSP_MDNS_TYPE = "_musp._tcp.local."
115