mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Correctly map repeat mode in Music Assistant (#155777)
This commit is contained in:
@@ -115,6 +115,13 @@ QUEUE_OPTION_MAP = {
|
||||
MediaPlayerEnqueue.REPLACE: QueueOption.REPLACE,
|
||||
}
|
||||
|
||||
REPEAT_MODE_MAPPING_TO_HA = {
|
||||
MassRepeatMode.OFF: RepeatMode.OFF,
|
||||
MassRepeatMode.ONE: RepeatMode.ONE,
|
||||
MassRepeatMode.ALL: RepeatMode.ALL,
|
||||
# UNKNOWN is intentionally not mapped - will return None
|
||||
}
|
||||
|
||||
SERVICE_PLAY_MEDIA_ADVANCED = "play_media"
|
||||
SERVICE_PLAY_ANNOUNCEMENT = "play_announcement"
|
||||
SERVICE_TRANSFER_QUEUE = "transfer_queue"
|
||||
@@ -657,7 +664,7 @@ class MusicAssistantPlayer(MusicAssistantEntity, MediaPlayerEntity):
|
||||
# player has an MA queue active (either its own queue or some group queue)
|
||||
self._attr_app_id = DOMAIN
|
||||
self._attr_shuffle = queue.shuffle_enabled
|
||||
self._attr_repeat = queue.repeat_mode.value
|
||||
self._attr_repeat = REPEAT_MODE_MAPPING_TO_HA.get(queue.repeat_mode)
|
||||
if not (cur_item := queue.current_item):
|
||||
# queue is empty
|
||||
return
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
"links": null,
|
||||
"chapters": null,
|
||||
"performers": null,
|
||||
"preview": "https://p.scdn.co/mp3-preview/98deb9c370bbaa350be058b3470fbe3bc1e28d9d?cid=2eb96f9b37494be1824999d58028a305",
|
||||
"preview": "https://p.scdn.co/mp3-preview/98deb9c370bbaa350be058b3470fbe3bc1e28d9d",
|
||||
"popularity": 77,
|
||||
"last_refresh": null
|
||||
},
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
'media_position': 232,
|
||||
'media_position_updated_at': datetime.datetime(2024, 10, 30, 18, 31, 49, 565951, tzinfo=datetime.timezone.utc),
|
||||
'media_title': 'November Rain',
|
||||
'repeat': 'all',
|
||||
'repeat': <RepeatMode.ALL: 'all'>,
|
||||
'shuffle': True,
|
||||
'supported_features': <MediaPlayerEntityFeature: 8320959>,
|
||||
'volume_level': 0.06,
|
||||
|
||||
Reference in New Issue
Block a user