/
/
/
1"""Constants for the MPD Player Provider."""
2
3from music_assistant_models.config_entries import ConfigEntry
4from music_assistant_models.enums import PlaybackState
5
6from music_assistant.constants import CONF_ENTRY_OUTPUT_CODEC
7
8RECONNECT_DELAY = 5 # seconds between reconnect attempts
9ELAPSED_POLL_INTERVAL = 5 # seconds between elapsed time polls while playing
10
11# FLAC does not work for infinite HTTP streams - MPD cannot probe the header.
12# Offer MP3, AAC, WAV only, with MP3 as default.
13# from_dict expects options as plain dicts, not ConfigValueOption objects.
14CONF_ENTRY_OUTPUT_CODEC_MPD = ConfigEntry.from_dict(
15 {
16 **CONF_ENTRY_OUTPUT_CODEC.to_dict(),
17 "default_value": "mp3",
18 "options": [
19 {"title": "MP3 (lossy)", "value": "mp3"},
20 {"title": "AAC (lossy)", "value": "aac"},
21 {"title": "WAV (uncompressed PCM)", "value": "wav"},
22 ],
23 }
24)
25
26MPD_STATE_MAP: dict[str, PlaybackState] = {
27 "play": PlaybackState.PLAYING,
28 "pause": PlaybackState.PAUSED,
29 "stop": PlaybackState.IDLE,
30}
31