aome510 / spotify-player

A Spotify player in the terminal with full feature parity
MIT License
3.38k stars 147 forks source link

Details of album cannot be loaded when it has been in the library for a while #519

Open mannodermaus opened 1 month ago

mannodermaus commented 1 month ago

Describe the bug I've been observing this with albums that I put into my library (i.e. ❤️'d) a long time ago. When trying to open their details via the library, the player gets stuck in a perpetual "Loading..." state. When I then search for the artist explicitly and select the same album from search results, the album loads as expected.

See the below for an example. I started playback of the album from my library via the official Spotify GUI client, then closed it and opened the CLI player. Playback works just fine, but I'm unable to view the album's details (either via G+Space or via the aforementioned navigation from the library) until I search for the artist again and select it from there.

To Reproduce I'm not exactly sure, but I suppose that you:

  1. Add an album to your library
  2. Wait a few years (!?)
  3. Try to open the album's details page from the library

Expected behaviour I see the details of the album.

Log and backtrace

1. Failing case (open old album reference via library)

2024-07-29T00:37:55.189254Z  INFO spotify_player::client::handlers: Current context ID (None) is different from the expected ID (Some(Album(AlbumId("4in34qwyUghNc9ykmH2BTO")))), update the context state
2024-07-29T00:37:55.189387Z  INFO client_request{request=GetContext(Album(AlbumId("4in34qwyUghNc9ykmH2BTO")))}: spotify_player::client: Get album context: spotify:album:4in34qwyUghNc9ykmH2BTO
2024-07-29T00:37:55.292886Z ERROR client_request{request=GetContext(Album(AlbumId("4in34qwyUghNc9ykmH2BTO")))}: spotify_player::client::handlers: Failed to handle client request: json parse error: invalid type: null, expected ID or URI for struct TrackId at line 1 column 1869: invalid type: null, expected ID or URI for struct TrackId at line 1 column 1869

The second and third lines repeat indefinitely until I cancel the action. It implies some sort of format incompatibility, maybe this is an older entry and had a different structure?

2. Succeeding case (open album reference via artist's info page)

2024-07-29T00:38:40.264654Z  INFO spotify_player::client::handlers: Current context ID (None) is different from the expected ID (Some(Album(AlbumId("25PQxi9SR1OODB5XG6m48J")))), update the context state

I see only this and then the data loads. Interestingly enough, the album ID is different from the failing case above. Has there possibly been a migration of IDs at Spotify some years back? The GUI client can keep the references (i.e. show the album even when I go to it via the library).

Screenshots

https://github.com/user-attachments/assets/d3bf1fa7-c4f8-446c-a2a1-835790f7161c

Environment

Additional context -/-

mannodermaus commented 1 month ago

Maybe this is a wontfix, since it really seems like these two albums are different listings on Spotify. Using the official Spotify app for Android, it shows the album as "in your library ✅" when I view it from my library, but when I open the same album via the artist page, there is no checkmark (even though it still recognizes the individual tracks as downloaded).

Unless spotify-player has a way to "alias" records together into the same album, this ticket may be closeable. It's unfortunate as it affects many entries in my library, though.

Opened from library Open from artist
Screenshot_20240730-141133 Screenshot_20240730-141127
aome510 commented 1 month ago

I think the json parse error: invalid type: null, expected ID or URI for struct TrackId at line 1 column 1869: invalid type: null, expected ID or URI for struct TrackId at line 1 column 1869 is because of a bug in Spotify API, so it's not really because of specific albums. This tends to happen a lot and in the past I had to implement patch from spotify_player side to handle those.

aome510 commented 1 month ago

This tends to happen a lot and in the past I had to implement patch from spotify_player side to handle those.

That said, this bug is not trivial to implement patch on. Open an issue in https://github.com/ramsayleung/rspotify/issues/486