mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Make Sonos use BrowseMedia (#39742)
This commit is contained in:
parent
72300a54df
commit
21dbce1554
@ -1479,14 +1479,14 @@ def item_payload(item):
|
|||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
return {
|
return BrowseMedia(
|
||||||
"title": item.title,
|
title=item.title,
|
||||||
"thumbnail": getattr(item, "album_art_uri", None),
|
thumbnail=getattr(item, "album_art_uri", None),
|
||||||
"media_content_id": get_content_id(item),
|
media_content_id=get_content_id(item),
|
||||||
"media_content_type": SONOS_TO_MEDIA_TYPES[get_media_type(item)],
|
media_content_type=SONOS_TO_MEDIA_TYPES[get_media_type(item)],
|
||||||
"can_play": can_play(item.item_class),
|
can_play=can_play(item.item_class),
|
||||||
"can_expand": can_expand(item),
|
can_expand=can_expand(item),
|
||||||
}
|
)
|
||||||
|
|
||||||
|
|
||||||
def library_payload(media_library):
|
def library_payload(media_library):
|
||||||
@ -1495,14 +1495,14 @@ def library_payload(media_library):
|
|||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
return {
|
return BrowseMedia(
|
||||||
"title": "Music Library",
|
title="Music Library",
|
||||||
"media_content_id": "library",
|
media_content_id="library",
|
||||||
"media_content_type": "library",
|
media_content_type="library",
|
||||||
"can_play": False,
|
can_play=False,
|
||||||
"can_expand": True,
|
can_expand=True,
|
||||||
"children": [item_payload(item) for item in media_library.browse()],
|
children=[item_payload(item) for item in media_library.browse()],
|
||||||
}
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_media_type(item):
|
def get_media_type(item):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user