Skip to content

Commit

Permalink
replace deprecated constants
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Oct 20, 2024
1 parent f750462 commit 3744c3e
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions custom_components/mass/media_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
MEDIA_CLASS_MUSIC,
MEDIA_CLASS_PLAYLIST,
MEDIA_CLASS_TRACK,
MEDIA_TYPE_ALBUM,
MEDIA_TYPE_ARTIST,
MEDIA_TYPE_PLAYLIST,
MEDIA_TYPE_TRACK,
MediaClass,
MediaType,
)
Expand All @@ -31,11 +27,11 @@
MEDIA_TYPE_RADIO = "radio"

PLAYABLE_MEDIA_TYPES = [
MEDIA_TYPE_PLAYLIST,
MEDIA_TYPE_ALBUM,
MEDIA_TYPE_ARTIST,
MediaType.PLAYLIST,
MediaType.ALBUM,
MediaType.ARTIST,
MEDIA_TYPE_RADIO,
MEDIA_TYPE_TRACK,
MediaType.TRACK,
]

LIBRARY_ARTISTS = "artists"
Expand Down Expand Up @@ -153,7 +149,7 @@ async def build_playlists_listing(mass: MusicAssistantClient):
return BrowseMedia(
media_class=MEDIA_CLASS_DIRECTORY,
media_content_id=LIBRARY_PLAYLISTS,
media_content_type=MEDIA_TYPE_PLAYLIST,
media_content_type=MediaType.PLAYLIST,
title=LIBRARY_TITLE_MAP[LIBRARY_PLAYLISTS],
can_play=False,
can_expand=True,
Expand All @@ -178,7 +174,7 @@ async def build_playlist_items_listing(mass: MusicAssistantClient, identifier: s
return BrowseMedia(
media_class=MEDIA_CLASS_PLAYLIST,
media_content_id=playlist.uri,
media_content_type=MEDIA_TYPE_PLAYLIST,
media_content_type=MediaType.PLAYLIST,
title=playlist.name,
can_play=True,
can_expand=True,
Expand All @@ -202,7 +198,7 @@ async def build_artists_listing(mass: MusicAssistantClient):
return BrowseMedia(
media_class=MEDIA_CLASS_DIRECTORY,
media_content_id=LIBRARY_ARTISTS,
media_content_type=MEDIA_TYPE_ARTIST,
media_content_type=MediaType.ARTIST,
title=LIBRARY_TITLE_MAP[LIBRARY_ARTISTS],
can_play=False,
can_expand=True,
Expand All @@ -226,9 +222,9 @@ async def build_artist_items_listing(mass: MusicAssistantClient, identifier: str
albums = await mass.music.get_artist_albums(artist.item_id, artist.provider)

return BrowseMedia(
media_class=MEDIA_TYPE_ARTIST,
media_class=MediaType.ARTIST,
media_content_id=artist.uri,
media_content_type=MEDIA_TYPE_ARTIST,
media_content_type=MediaType.ARTIST,
title=artist.name,
can_play=True,
can_expand=True,
Expand All @@ -248,7 +244,7 @@ async def build_albums_listing(mass: MusicAssistantClient):
return BrowseMedia(
media_class=MEDIA_CLASS_DIRECTORY,
media_content_id=LIBRARY_ALBUMS,
media_content_type=MEDIA_TYPE_ALBUM,
media_content_type=MediaType.ALBUM,
title=LIBRARY_TITLE_MAP[LIBRARY_ALBUMS],
can_play=False,
can_expand=True,
Expand All @@ -272,9 +268,9 @@ async def build_album_items_listing(mass: MusicAssistantClient, identifier: str)
tracks = await mass.music.get_album_tracks(album.item_id, album.provider)

return BrowseMedia(
media_class=MEDIA_TYPE_ALBUM,
media_class=MediaType.ALBUM,
media_content_id=album.uri,
media_content_type=MEDIA_TYPE_ALBUM,
media_content_type=MediaType.ALBUM,
title=album.name,
can_play=True,
can_expand=True,
Expand All @@ -292,7 +288,7 @@ async def build_tracks_listing(mass: MusicAssistantClient):
return BrowseMedia(
media_class=MEDIA_CLASS_DIRECTORY,
media_content_id=LIBRARY_ALBUMS,
media_content_type=MEDIA_TYPE_TRACK,
media_content_type=MediaType.TRACK,
title=LIBRARY_TITLE_MAP[LIBRARY_TRACKS],
can_play=False,
can_expand=True,
Expand Down

0 comments on commit 3744c3e

Please sign in to comment.