From 579d217c6bb5968d9671685d294a103727e295e4 Mon Sep 17 00:00:00 2001 From: Jozef Kruszynski <60214390+jozefKruszynski@users.noreply.github.com> Date: Mon, 1 Sep 2025 14:27:48 +0200 Subject: [PATCH] Fix sort order in media browser for music assistant integration (#150910) --- .../components/music_assistant/media_browser.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/music_assistant/media_browser.py b/homeassistant/components/music_assistant/media_browser.py index e4724be650af..23d6ab607e8c 100644 --- a/homeassistant/components/music_assistant/media_browser.py +++ b/homeassistant/components/music_assistant/media_browser.py @@ -70,7 +70,7 @@ LIBRARY_MEDIA_CLASS_MAP = { MEDIA_CONTENT_TYPE_FLAC = "audio/flac" THUMB_SIZE = 200 -SORT_NAME_DESC = "sort_name_desc" +SORT_NAME = "sort_name" LOGGER = logging.getLogger(__name__) @@ -173,7 +173,7 @@ async def build_playlists_listing(mass: MusicAssistantClient) -> BrowseMedia: # we only grab the first page here because the # HA media browser does not support paging for item in await mass.music.get_library_playlists( - limit=500, order_by=SORT_NAME_DESC + limit=500, order_by=SORT_NAME ) if item.available ], @@ -225,7 +225,7 @@ async def build_artists_listing(mass: MusicAssistantClient) -> BrowseMedia: # we only grab the first page here because the # HA media browser does not support paging for artist in await mass.music.get_library_artists( - limit=500, order_by=SORT_NAME_DESC + limit=500, order_by=SORT_NAME ) if artist.available ], @@ -275,7 +275,7 @@ async def build_albums_listing(mass: MusicAssistantClient) -> BrowseMedia: # we only grab the first page here because the # HA media browser does not support paging for album in await mass.music.get_library_albums( - limit=500, order_by=SORT_NAME_DESC + limit=500, order_by=SORT_NAME ) if album.available ], @@ -323,7 +323,7 @@ async def build_tracks_listing(mass: MusicAssistantClient) -> BrowseMedia: # we only grab the first page here because the # HA media browser does not support paging for track in await mass.music.get_library_tracks( - limit=500, order_by=SORT_NAME_DESC + limit=500, order_by=SORT_NAME ) if track.available ], @@ -346,7 +346,7 @@ async def build_podcasts_listing(mass: MusicAssistantClient) -> BrowseMedia: # we only grab the first page here because the # HA media browser does not support paging for podcast in await mass.music.get_library_podcasts( - limit=500, order_by=SORT_NAME_DESC + limit=500, order_by=SORT_NAME ) if podcast.available ], @@ -369,7 +369,7 @@ async def build_audiobooks_listing(mass: MusicAssistantClient) -> BrowseMedia: # we only grab the first page here because the # HA media browser does not support paging for audiobook in await mass.music.get_library_audiobooks( - limit=500, order_by=SORT_NAME_DESC + limit=500, order_by=SORT_NAME ) if audiobook.available ], @@ -392,7 +392,7 @@ async def build_radio_listing(mass: MusicAssistantClient) -> BrowseMedia: # we only grab the first page here because the # HA media browser does not support paging for track in await mass.music.get_library_radios( - limit=500, order_by=SORT_NAME_DESC + limit=500, order_by=SORT_NAME ) if track.available ],