/
/
/
1"""Constants for the MusicCast provider."""
2
3from music_assistant_models.config_entries import ConfigEntry
4
5from music_assistant.constants import (
6 CONF_ENTRY_FLOW_MODE,
7 CONF_ENTRY_HTTP_PROFILE_DEFAULT_2,
8 CONF_ENTRY_ICY_METADATA_HIDDEN_DISABLED,
9 create_sample_rates_config_entry,
10)
11
12# Constants for players
13# both the http profile and icy didn't matter for me testing it.
14CONF_ENTRY_FLOW_MODE_HIDDEN_DISABLED = ConfigEntry.from_dict(
15 {
16 **CONF_ENTRY_FLOW_MODE.to_dict(),
17 "default_value": False,
18 "value": False,
19 "hidden": True,
20 }
21)
22PLAYER_CONFIG_ENTRIES = [
23 CONF_ENTRY_HTTP_PROFILE_DEFAULT_2,
24 CONF_ENTRY_ICY_METADATA_HIDDEN_DISABLED,
25 CONF_ENTRY_FLOW_MODE_HIDDEN_DISABLED,
26 create_sample_rates_config_entry(max_sample_rate=192000, max_bit_depth=24),
27]
28# player id is {device_id}{ZONE_SPLITTER}{zone_name}
29PLAYER_ZONE_SPLITTER = "___" # must be url ok
30
31# Switch to these non netusb sources when leaving a group as a dev
32# with multiple zones. Optionally turn device off.
33CONF_PLAYER_HANDLE_SOURCE_DISABLED = "handle_source_allowed"
34CONF_PLAYER_SWITCH_SOURCE_NON_NET = "main_switch_source"
35CONF_PLAYER_TURN_OFF_ON_LEAVE = "turn_off_on_leave"
36MAIN_SWITCH_SOURCE_NON_NET = "audio1"
37PLAYER_ZONE2_SWITCH_SOURCE_NON_NET = "audio2"
38PLAYER_ZONE3_SWITCH_SOURCE_NON_NET = "audio3"
39PLAYER_ZONE4_SWITCH_SOURCE_NON_NET = "audio4"
40
41
42# MusicCast constants
43MC_POLL_INTERVAL = 10
44MC_PLAY_TITLE = "Music Assistant"
45
46MC_DEVICE_INFO_ENDPOINT = "YamahaExtendedControl/v1/system/getDeviceInfo"
47MC_DEVICE_UPNP_ENDPOINT = "MediaRenderer/desc.xml"
48# if this is not a constant, we'll have to do some xml parsing
49MC_DEVICE_UPNP_CTRL_ENDPOINT = "AVTransport/ctrl"
50MC_DEVICE_UPNP_PORT = 49154
51MC_NULL_GROUP = "00000000000000000000000000000000"
52MC_DEFAULT_ZONE = "main"
53
54MC_SOURCE_MC_LINK = "mc_link"
55MC_SOURCE_MAIN_SYNC = "main_sync"
56MC_LINK_SOURCES = [MC_SOURCE_MC_LINK, MC_SOURCE_MAIN_SYNC]
57
58MC_PASSIVE_SOURCE_IDS = [MC_SOURCE_MC_LINK]
59MC_NETUSB_SOURCE_IDS = [
60 "napster",
61 "spotify",
62 "qobuz",
63 "tidal",
64 "deezer",
65 "amazon_music",
66 "alexa",
67 "airplay",
68 "usb",
69 "server",
70 "net_radio",
71 "bluetooth",
72 # these were in aiomusiccast/musiccast_media_content.py:
73 "pandora",
74 "rhapsody",
75 "siriusxm",
76 "juke",
77 "radiko",
78]
79MC_CONTROL_SOURCE_IDS = MC_NETUSB_SOURCE_IDS
80MC_CONTROL_SOURCE_IDS.append(
81 # tuner can be controlled, will change the station
82 "tuner",
83)
84