hrkfdn / ncspot

Cross-platform ncurses Spotify client written in Rust, inspired by ncmpc and the likes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Playlists do not load

OtaK opened this issue · comments

Describe the bug
Playlists do not load.

To Reproduce
Steps to reproduce the behavior:

  1. Clear playlist cache (by removing .cache/ncspot/playlists.db)
  2. Start ncspot
  3. Go to the playlists tab
  4. See error

Expected behavior
Playlists list should display

Screenshots
N/A

System (please complete the following information):

  • OS: Linux
  • Terminal: Kitty
  • Version: 1.1.0
  • Installed from: cargo

Backtrace/Debug log

[2024-03-26][00:43:24] [ureq::unit] [DEBUG] response 200 to GET https://api.spotify.com/v1/me/playlists?offset=0&limit=50
[2024-03-26][00:43:24] [ureq::pool] [DEBUG] adding stream to pool: https|api.spotify.com|443 -> Stream(RustlsStream)
[2024-03-26][00:43:24] [ureq::pool] [DEBUG] host https|api.spotify.com|443 has 1 conns, dropping oldest: Stream(RustlsStream)
[2024-03-26][00:43:24] [ureq::stream] [DEBUG] dropping stream: Stream(RustlsStream)
[2024-03-26][00:43:24] [ncspot::spotify_api] [ERROR] unhandled api error: json parse error: invalid type: null, expected a sequence at line 1 column 28815

Additional context
Add any other context about the problem here.

Related to ramsayleung/rspotify#459

I managed to make it work by adding images to the playlists that didn't have one (I had a couple of very old - 2008 - empty playlists without pictures).

Any tricks to lure rspotify or ncspot to dump information about which if my 200+ playlists suddenly lack information without having to rewrite the code yourself?

@Brynyard Nope. I just went through a similar number of them myself. It's pretty easy to spot anyway. Just go on the web interface, any playlist with no picture at all (the autogenerated ones are OK) is a culprit.

@OtaK No luck, gone through all my playlists and checked that they both have songs and an image.

Reading the original bug report in rspotify it is clear that there's a major SW architecture issue (and they don't even want to touch it - it's not failing on the devs setup), so it seems I'll be best of just adding a patch dumping the offending JSON and work around this issue.

@Brynyard : use ncspot --debug tmp.log and fetch a recent/valid Bearer token:

[2024-03-28][09:02:33] [rspotify_http::ureq]
  [INFO] Making request Request(GET https://api.spotify.com/v1/me/,
  [authorization: Bearer <THIS_TOKEN_HERE>])

Then curl the json yourself:

curl 'https://api.spotify.com/v1/me/playlists?limit=50&offset=0' \
  -H 'Authorization: Bearer <THIS_TOKEN_HERE>' 
  -o playlist.json

Then use the error (also in the debug log):

[ureq::unit] [DEBUG] response 200 to GET https://api.spotify.com/v1/me/playlists?offset=0&limit=50
...
[ERROR] unhandled api error: json parse error: invalid type: null, expected a sequence at line 1 column 3764

And look over there in playlist.json. I suspect it was this before editing:

...,"images":null,"name":"Soft Trance",...
                ^- 3764

After:

...,"images":[{"height":null,"url":"https://image-cdn-fa.spotifycdn.com/image/ab67706c0000da849b6028390071f2d6c163da0a","width":null}],"name":"Soft Trance",...

@wdoekes just adding a track didn't work, I had to explicitly upload an image to some of the playlists for this to go away.

I had to explicitly upload an image to some of the playlists for this to go away.

Nobody said anything about adding tracks. The fix was to add an image.

Nobody said anything about adding tracks. The fix was to add an image.

I read it as "playlist is missing image, make sure it has one", and the playlists in questions didn't have an image and got one (auto generated) when I added a track that I was sure was available. Apologies for not fully comprehending all the nuances of this quirk.

I tried the curl in @wdoekes message, but my entire playlist.json is:

{"href":"https://api.spotify.com/v1/users/andydecleyre/playlists?offset=0&limit=50","limit":50,"next":null,"offset":0,"previous":null,"total":0,"items":[]}

Well after a few relaunches ncspot told me to log in again, with something like "bytes were left on the stream," and after logging in again the playlists loaded.

I'm experiencing this issue too.

My playlists weren't loading, but adding an image to a playlist without one fixed it for me. Thank you

I have added images and it still doesnt load.

(EDIT) deleting my liked songs playlist fixed this.

Related to ramsayleung/rspotify#459

I managed to make it work by adding images to the playlists that didn't have one (I had a couple of very old - 2008 - empty playlists without pictures).

Thanks for this advice. I had the same issue, I made sure there were images in every playlist and then the issue resolved.

A new version of rspotify was released. I updated the one in main branch yesterday. Does it fix your problems?

commented

Is it present in v1.1.1 because still having this I think

No, I'd have to draft a new release. Would be helpful if someone could confirm this is fixed when using main.

commented

Will try tomorrow 👍

Still getting this issue. I'm trying to add photos to all my playlists, but it's not really a "solution", especially if you have a lot of playlists. (excuse my frustration, I know this is a application that's maintained by volunteers, I'm just tired of not having access to my playlists for the last couple months. I really appreciate this app for what it is)

Still have about 40 playlist to add photos to, so I'll lyk if the issue gets fixed when I'm done. Almost stopped using ncspot over this bug, but I love this application too much to give up on it.

Still getting this issue. I'm trying to add photos to all my playlists, but it's not really a "solution", especially if you have a lot of playlists. (excuse my frustration, I know this is a application that's maintained by volunteers, I'm just tired of not having access to my playlists for the last couple months. I really appreciate this app for what it is)

Still have about 40 playlist to add photos to, so I'll lyk if the issue gets fixed when I'm done. Almost stopped using ncspot over this bug, but I love this application too much to give up on it.

With the main branch? I understand your frustration and I wish I could help, but this is a bug in a library we use, so there's not too much that can be done on ncspot side, I believe.

I can try and build from main, right now I've just been using the arch repo version of the app. Is there any special sauce I need to get it working in arch?

Edit: I'm building it now, will lyk if it's still bugged

Ok, apologies for freaking out on you, building from main fixed my issues!

Thanks for the help!

Thanks for testing. Will draft a release today.

commented

Sorry completely forgot on my end, but good it seems to work