aome510 / spotify-player

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

Stuck on loading big playlist #494

Closed japopich closed 2 months ago

japopich commented 2 months ago

Describe the bug I have a large playlist ~450 songs that I am trying to load and I seem to be getting stuck on loading.

To Reproduce

  1. Try to open the playlsit Pumped UP Music by djmax444

Expected behaviour The playlist to load.

Log and backtrace

2024-07-07T19:13:50.022653Z  INFO client_request{request=GetCurrentUserQueue}: spotify_player::client: Successfully handled the client request, took: 275ms
2024-07-07T19:13:50.748507Z  INFO spotify_player::client::handlers: Current context ID (None) is different from the expected ID (Some(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))), update the context state
2024-07-07T19:13:50.748588Z  INFO client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client: Get playlist context: spotify:playlist:7HKmE2T8ahhI5F0xTvqrVB
2024-07-07T19:13:51.749405Z  INFO client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client: Get playlist context: spotify:playlist:7HKmE2T8ahhI5F0xTvqrVB
2024-07-07T19:13:52.416160Z ERROR client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client::handlers: Failed to handle client request: data did not match any variant of untagged enum PlayableItem at line 1 column 218091
2024-07-07T19:13:52.750879Z  INFO client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client: Get playlist context: spotify:playlist:7HKmE2T8ahhI5F0xTvqrVB
2024-07-07T19:13:53.361334Z ERROR client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client::handlers: Failed to handle client request: data did not match any variant of untagged enum PlayableItem at line 1 column 218091
2024-07-07T19:13:53.752646Z  INFO client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client: Get playlist context: spotify:playlist:7HKmE2T8ahhI5F0xTvqrVB
2024-07-07T19:13:54.371317Z ERROR client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client::handlers: Failed to handle client request: data did not match any variant of untagged enum PlayableItem at line 1 column 218091
2024-07-07T19:13:55.290299Z ERROR client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client::handlers: Failed to handle client request: data did not match any variant of untagged enum PlayableItem at line 1 column 218091
2024-07-07T19:13:55.754105Z  INFO spotify_player::client::handlers: Current context ID (None) is different from the expected ID (Some(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))), update the context state
2024-07-07T19:13:55.754163Z  INFO client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client: Get playlist context: spotify:playlist:7HKmE2T8ahhI5F0xTvqrVB
2024-07-07T19:13:56.755475Z  INFO client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client: Get playlist context: spotify:playlist:7HKmE2T8ahhI5F0xTvqrVB
2024-07-07T19:13:57.319011Z ERROR client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client::handlers: Failed to handle client request: data did not match any variant of untagged enum PlayableItem at line 1 column 218091
2024-07-07T19:13:57.756730Z  INFO spotify_player::client::handlers: Current context ID (None) is different from the expected ID (Some(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))), update the context state
2024-07-07T19:13:57.756784Z  INFO client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client: Get playlist context: spotify:playlist:7HKmE2T8ahhI5F0xTvqrVB
2024-07-07T19:13:58.161553Z ERROR client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client::handlers: Failed to handle client request: data did not match any variant of untagged enum PlayableItem at line 1 column 218091
2024-07-07T19:13:59.527344Z ERROR client_request{request=GetContext(Playlist(PlaylistId("7HKmE2T8ahhI5F0xTvqrVB")))}: spotify_player::client::handlers: Failed to handle client request: data did not match any variant of untagged enum PlayableItem at line 1 column 218091

Environment

Additional context Add any other context about the problem here.

aome510 commented 2 months ago

Might be related to https://github.com/ramsayleung/rspotify/issues/477. Big playlist shouldn't be a problem. Does your playlist contain a local file or something similar?

japopich commented 2 months ago

No it does not, it only has songs added through the spotify official client.

aome510 commented 2 months ago

After playing around with the APIs, I figured out the error. Look like the artist's name can be null(????) while Spotify indicates it should be available. This is the reason why the 3rd-party library failed to parse the API's response.

I lost count of how many times Spotify API returns broken response that doesn't follow their documentation 😞 . That said, I will push a patch for this soon.

{
  "preview_url": "https://podz-content.spotifycdn.com/audio/clips/0qUCzoCvHaxX0VFuhqLv0A/clip_0_60000.mp3",
  "is_playable": true,
  "explicit": true,
  "type": "episode",
  "episode": false,
  "track": true,
  "album": {
    "type": "show",
    "album_type": "compilation",
    "href": "https://api.spotify.com/v1/shows/0lfQ5daJgYKi14NEFmHpI5",
    "id": "0lfQ5daJgYKi14NEFmHpI5",
    "images": [
      {
        "height": 640,
        "url": "https://i.scdn.co/image/ab6765630000ba8af046fa11c07945fe159409d2",
        "width": 640
      },
      {
        "height": 300,
        "url": "https://i.scdn.co/image/ab67656300005f1ff046fa11c07945fe159409d2",
        "width": 300
      },
      {
        "height": 64,
        "url": "https://i.scdn.co/image/ab6765630000f68df046fa11c07945fe159409d2",
        "width": 64
      }
    ],
    "name": "A Gabbies: The Podcast",
    "release_date": null,
    "release_date_precision": null,
    "uri": "spotify:show:0lfQ5daJgYKi14NEFmHpI5",
    "artists": [
      {
        "external_urls": {
          "spotify": "https://open.spotify.com/show/0lfQ5daJgYKi14NEFmHpI5"
        },
        "href": "https://api.spotify.com/v1/shows/0lfQ5daJgYKi14NEFmHpI5",
        "id": "0lfQ5daJgYKi14NEFmHpI5",
        "name": null,
        "type": "A Gabbies: The Podcast",
        "uri": "spotify:show:0lfQ5daJgYKi14NEFmHpI5"
      }
    ],
    "external_urls": {
      "spotify": "https://open.spotify.com/album/0lfQ5daJgYKi14NEFmHpI5"
    },
    "total_tracks": 1
  },
  "artists": [
    {
      "external_urls": {
        "spotify": "https://open.spotify.com/show/0lfQ5daJgYKi14NEFmHpI5"
      },
      "href": "https://api.spotify.com/v1/shows/0lfQ5daJgYKi14NEFmHpI5",
      "id": "0lfQ5daJgYKi14NEFmHpI5",
      "name": null,
      "type": "A Gabbies: The Podcast",
      "uri": "spotify:show:0lfQ5daJgYKi14NEFmHpI5"
    }
  ],
  "disc_number": 0,
  "track_number": 0,
  "duration_ms": 253573,
  "external_ids": {
    "spotify": "https://open.spotify.com/episode/1cGMaqvEzDEWAD7ZMIxWFQ"
  },
  "external_urls": {
    "spotify": "https://open.spotify.com/episode/1cGMaqvEzDEWAD7ZMIxWFQ"
  },
  "href": "https://api.spotify.com/v1/episodes/1cGMaqvEzDEWAD7ZMIxWFQ",
  "id": "1cGMaqvEzDEWAD7ZMIxWFQ",
  "name": "David Banner - Dance The Night Away (Feat. Denim) (From \"Footloose\" Soundtrack)",
  "popularity": 0,
  "uri": "spotify:episode:1cGMaqvEzDEWAD7ZMIxWFQ",
  "is_local": false
}