mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +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.
|
||||
"""
|
||||
return {
|
||||
"title": item.title,
|
||||
"thumbnail": getattr(item, "album_art_uri", None),
|
||||
"media_content_id": get_content_id(item),
|
||||
"media_content_type": SONOS_TO_MEDIA_TYPES[get_media_type(item)],
|
||||
"can_play": can_play(item.item_class),
|
||||
"can_expand": can_expand(item),
|
||||
}
|
||||
return BrowseMedia(
|
||||
title=item.title,
|
||||
thumbnail=getattr(item, "album_art_uri", None),
|
||||
media_content_id=get_content_id(item),
|
||||
media_content_type=SONOS_TO_MEDIA_TYPES[get_media_type(item)],
|
||||
can_play=can_play(item.item_class),
|
||||
can_expand=can_expand(item),
|
||||
)
|
||||
|
||||
|
||||
def library_payload(media_library):
|
||||
@ -1495,14 +1495,14 @@ def library_payload(media_library):
|
||||
|
||||
Used by async_browse_media.
|
||||
"""
|
||||
return {
|
||||
"title": "Music Library",
|
||||
"media_content_id": "library",
|
||||
"media_content_type": "library",
|
||||
"can_play": False,
|
||||
"can_expand": True,
|
||||
"children": [item_payload(item) for item in media_library.browse()],
|
||||
}
|
||||
return BrowseMedia(
|
||||
title="Music Library",
|
||||
media_content_id="library",
|
||||
media_content_type="library",
|
||||
can_play=False,
|
||||
can_expand=True,
|
||||
children=[item_payload(item) for item in media_library.browse()],
|
||||
)
|
||||
|
||||
|
||||
def get_media_type(item):
|
||||
|
Loading…
x
Reference in New Issue
Block a user