Skip to content

Fix album decode of object-shaped preReleaseEndDateTime - #107

Closed
Balake wants to merge 1 commit into
Aran404:mainfrom
Balake:fix/album-pre-release-end-date
Closed

Balake wants to merge 1 commit into
Aran404:mainfrom
Balake:fix/album-pre-release-end-date

Conversation

@Balake

@Balake Balake commented Nov 22, 2026

Copy link
Copy Markdown

SyncCatalogue().get_album("spotify:album:3LUcDBe7DZDExhHbZEQchk") raised

BaseClientError: getAlbum: failed to deserialize AlbumDetails:
AlbumDetails.pre_release_end_date_time: value does not match str | None

Spotify now returns preReleaseEndDateTime as {"isoString": ..., "precision": "DAY" | "MINUTE"}, even when isPreRelease is false, but the models declared str | None.

Decode it as ReleaseDate | None on AlbumDetails and on the album search hit (Album), which shares the field. Search skips undecodable hits, so those albums were silently dropped from results. ReleaseDate moves to models.catalogue.common so album.py can use it without an import cycle.

Add an offline regression test built from a trimmed real getAlbum response, and examples/album_lookup.py to reproduce against the live API.

Summary

Adds ability to parse the object for SyncCatalogue().get_album with preReleaseEndDateTime

Why

See #105

Closes #105

Verification

  • Tests cover the changed behavior, or the reason they do not is explained above.
  • python -m pytest -q
  • python -m pyright
  • python -m ruff check .
  • python -m black --check .
  • Public behavior changes include concise documentation or changelog updates.
  • No credentials, cookies, access tokens, or private account data are included.

Contract and lifecycle notes

SyncCatalogue().get_album("spotify:album:3LUcDBe7DZDExhHbZEQchk") raised

    BaseClientError: getAlbum: failed to deserialize AlbumDetails:
    AlbumDetails.pre_release_end_date_time: value does not match str | None

Spotify now returns preReleaseEndDateTime as {"isoString": ...,
"precision": "DAY" | "MINUTE"}, even when isPreRelease is false, but the
models declared str | None.

Decode it as ReleaseDate | None on AlbumDetails and on the album search
hit (Album), which shares the field. Search skips undecodable hits, so
those albums were silently dropped from results. ReleaseDate moves to
models.catalogue.common so album.py can use it without an import cycle.

Add an offline regression test built from a trimmed real getAlbum
response, and examples/album_lookup.py to reproduce against the live API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: get_album fails to decode object-shaped preReleaseEndDateTime

1 participant