Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Use Deezer record_type to set the album type of Deezer albums #1905

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion music_assistant/providers/deezer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def parse_artist(self, artist: deezer.Artist) -> Artist:
def parse_album(self, album: deezer.Album) -> Album:
"""Parse the deezer-python album to a Music Assistant album."""
return Album(
album_type=AlbumType(album.type),
album_type=self.get_album_type(album),
item_id=str(album.id),
provider=self.lookup_key,
name=album.title,
Expand Down Expand Up @@ -688,6 +688,23 @@ def get_short_title(self, track: deezer.Track):
return track.title_short
return track.title

def get_album_type(self, album: deezer.Album):
marcelveldt marked this conversation as resolved.
Show resolved Hide resolved
"""Read and convert the Deezer album type."""
if not hasattr(album, "record_type"):
return AlbumType.UNKNOWN

match album.record_type:
case "album":
return AlbumType.ALBUM
case "single":
return AlbumType.SINGLE
case "ep":
return AlbumType.EP
case "compile":
return AlbumType.COMPILATION
case _:
return AlbumType.UNKNOWN

### SEARCH AND PARSE FUNCTIONS ###
async def search_and_parse_tracks(
self, query: str, user_country: str, limit: int = 20
Expand Down
Loading