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,
return track.title_short
return track.title
+ def get_album_type(self, album: deezer.Album) -> AlbumType:
+ """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