Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions streamrip/metadata/album.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,17 @@ def from_qobuz(cls, resp: dict) -> AlbumMetadata:
def from_deezer(cls, resp: dict) -> AlbumMetadata | None:
album = resp.get("title", "Unknown Album")
tracktotal = typed(resp.get("track_total", 0) or resp.get("nb_tracks", 0), int)
disctotal = typed(resp["tracks"][-1]["disk_number"], int)
disctotal = typed(resp["tracks"][-1]["disk_number"], int) if resp["tracks"] else 1
genres = [typed(g["name"], str) for g in resp["genres"]["data"]]

date = typed(resp["release_date"], str)
year = date[:4]
_copyright = None
description = None
albumartist = typed(safe_get(resp, "artist", "name"), str)
contributors = resp.get("contributors", [])
albumartist = ", ".join(
c["name"] for c in contributors if c["type"] == "artist"
) or typed(safe_get(resp, "artist", "name"), str)
albumcomposer = None
label = resp.get("label")
booklets = None
Expand Down
5 changes: 4 additions & 1 deletion streamrip/metadata/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ def from_deezer(cls, album: AlbumMetadata, resp) -> TrackMetadata | None:
explicit = typed(resp["explicit_lyrics"], bool)
work = None
title = typed(resp["title"], str)
artist = typed(resp["artist"]["name"], str)
contributors = resp.get("contributors", [])
artist = ", ".join(
c["name"] for c in contributors if c["type"] == "artist"
) or typed(resp["artist"]["name"], str)
tracknumber = typed(resp["track_position"], int)
discnumber = typed(resp["disk_number"], int)
composer = None
Expand Down