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
4 changes: 2 additions & 2 deletions streamrip/metadata/album.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def from_tidal(cls, resp) -> AlbumMetadata | None:
# genre not returned by API
date = typed(resp.get("releaseDate"), str)
year = date[:4]
_copyright = typed(resp.get("copyright", ""), str)
_copyright = typed(resp.get("copyright") or "", str)

artists = typed(resp.get("artists", []), list)
albumartist = ", ".join(a["name"] for a in artists)
Expand Down Expand Up @@ -384,7 +384,7 @@ def from_tidal_playlist_track_resp(cls, resp: dict) -> AlbumMetadata | None:
else:
year = "Unknown Year"

_copyright = typed(resp.get("copyright", ""), str)
_copyright = typed(resp.get("copyright") or "", str)
artists = typed(resp.get("artists", []), list)
albumartist = ", ".join(a["name"] for a in artists)
if not albumartist:
Expand Down
34 changes: 34 additions & 0 deletions tests/test_tidal_null_copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from streamrip.metadata.album import AlbumMetadata


def test_tidal_from_track_and_album_handles_null_copyright():
album_resp = {
"allowStreaming": True,
"title": "Test Album",
"id": 123,
"numberOfTracks": 1,
"numberOfVolumes": 1,
"copyright": None,
"releaseDate": "2024-01-01",
"artists": [{"name": "Artist"}],
"explicit": False,
"audioQuality": "LOSSLESS",
"cover": "abc-def",
"mediaMetadata": {"tags": ["LOSSLESS"]},
}
track_resp = {
"allowStreaming": True,
"title": "Test Track",
"id": 456,
"copyright": None,
"artists": [{"name": "Artist"}],
"explicit": False,
"audioQuality": "LOSSLESS",
"album": {"title": "Test Album", "id": 123, "cover": "abc-def"},
"mediaMetadata": {"tags": ["LOSSLESS"]},
}

from_album = AlbumMetadata.from_tidal(album_resp)
from_track = AlbumMetadata.from_tidal_playlist_track_resp(track_resp)
assert from_album is not None and from_album.copyright == ""
assert from_track is not None and from_track.copyright == ""