Help needed to test Spotify plugin with Oauth

Hi There, unfortunately, the Spotify Web API doesn’t support folders. If you bring up the Web-based Spotify player (instead of an app) you will see there are no folders in your list of playlists.

Developers have been asking Spotify to fix this for a couple of years now, let’s hope they do it!

ah okay strange. Hope they’ll change it. Thanks for the answer :sunglasses:

The latest ‘index.js’ from https://github.com/skikirkwood/volumio-plugins/blob/myalbums/plugins/music_service/spotify/index.js worked for me! Thanks :laughing:

Hi,

I installed Spotify but no Playlists, then I found this post and with the latest version of index.js and a refreshtoken I had it fixed in 5 minutes!

THNX

Harry

Hi,

This doesn’t seem to work well anymore. All I see is a blank page, no matter wether I use IE, FF, Chrome or Waterfox…
When I take a look at the source code I can see the code, but it doesn’t work for me.

However, when I used my mobile phone I did see the right page and I was able to login and get the refreshtoken. And I’m happy to say the playlists now work again :slight_smile:

Cheers,
Danny.

Fetching the refresh token as instructed and grabbing the latest version of skikirkwood/volumio-plugins/oauth/plugins/music_service/spotify/index.js (git sha d1a15790cc2fb7ffd412b1ea1ec8a37aaba05eb3) worked for me!

I can now see all of my playlists (12), both created and followed. Thanks!

Hi there. First: Bravissimo e Grazie for that nice implementation of Spotify Playlists, Artists and Albums in Volumio. :slight_smile:

But as I am still a LP kind of guy I am mostly listen to Albums. I starred at least 500 of them and would love to have direct access via volumio. Now I get only to the letter B with the 50 available.

Is there any update with that pagination issue? @skikirkwood were you able to make any process with that matter? Anyone else?

Before I do any more work on the Spotify plugin I want to sync up with the Volumio team and figure out what the right longterm roadmap is since we have a functional Spotify Connect plugin, and MyVolumio is the future platform.

That said, I don’t hack code in my day job of doing enterprise software sales, so I might hack something out in the next few weeks anyway.

Hi all,
Had the same issue with Spotify after updating the plugin. Followed your instructions and worked first time - great stuff. I now have my saved playlists (again) but also have my saved albums, saved tracks and other stuff too. Fantastic. Thanks for the hard work.
Ian

Thankyou !
I’ve followed your instruction and now I can see my playlists and saved albums.
Only a small problem: I can’t play any of them!
(even before changing the index.js file)
I can play my local music normaly but when I try to play a Spotify song, a notification message say “Playing …” but nothing happen, the play/stop button alway show a play symbol
Here a snap from volumio.log:

2018-07-21T16:11:05.581Z - info: CoreCommandRouter::volumioPlay 2018-07-21T16:11:05.581Z - info: CoreStateMachine::play index 3 2018-07-21T16:11:05.582Z - info: CoreStateMachine::setConsumeUpdateService undefined 2018-07-21T16:11:05.582Z - info: CoreStateMachine::stop 2018-07-21T16:11:05.582Z - info: CoreStateMachine::setConsumeUpdateService undefined 2018-07-21T16:11:05.583Z - info: CoreStateMachine::play index undefined 2018-07-21T16:11:05.583Z - info: CoreStateMachine::setConsumeUpdateService undefined 2018-07-21T16:11:05.583Z - info: CorePlayQueue::getTrack 3 2018-07-21T16:11:05.583Z - info: CoreStateMachine::startPlaybackTimer 2018-07-21T16:11:05.584Z - info: CorePlayQueue::getTrack 3 2018-07-21T16:11:05.584Z - info: [1532189465584] ControllerSpop::clearAddPlayTrack 2018-07-21T16:11:05.584Z - info: {"service":"spop","type":"song","name":"Tineline","title":"Tineline","artist":"Tehu","album":"EP Boulevard","uri":"spotify:track:46b2cvMA07mYFz742nucP9","samplerate":"320Kbps","bitdepth":"16 bit","trackType":"spotify","albumart":"https://i.scdn.co/image/480b5a8e2909a7a23fdd35a74634ed69b7cba5d0","duration":475} 2018-07-21T16:11:05.584Z - info: [1532189465584] ControllerSpop::sendSpopCommand 2018-07-21T16:11:05.585Z - info: ADDING DEFER FOR COMMAND uplay 2018-07-21T16:11:05.588Z - info: SPOP command error: 2018-07-21T16:11:05.588Z - info: message=This socket has been ended by the other party, stack=Error: This socket has been ended by the other party at Socket.writeAfterFIN [as write] (net.js:364:12) at applyWithContext (/data/plugins/music_service/spop/node_modules/fast.js/function/applyWithContext.js:15:22) at /data/plugins/music_service/spop/node_modules/fast.js/function/bind.js:63:14 at onBoundPromise (/data/plugins/music_service/spop/node_modules/kew/kew.js:834:10) at ncall (/data/plugins/music_service/spop/node_modules/kew/kew.js:816:44) at Object.nfcall (/data/plugins/music_service/spop/node_modules/kew/kew.js:803:16) at Promise._successFn (/data/plugins/music_service/spop/index.js:1452:16) at nextTickCallback (/data/plugins/music_service/spop/node_modules/kew/kew.js:47:28) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9), code=EPIPE

Looks like the socket connection to the libspotify app is being dropped. Unfortunately that is really old cold that existed before I added the new Spotify Web API functionality and don’t know a good way to debug it.

This worked for me Thanks!!

github.com/skikirkwood/volumio- … y/index.js

  • maximum seems to be 20 for my playlists
  • no auto loading of new playlists when scrolling down (pagination?)

Really appreciate this thread and the effort!

Thank you, I’m feeling a bit dumb here… what do you mean by “Unfortunately that is really old cold that existed before I added the new Spotify Web API functionality” ? :frowning:

The Volumio team developed the original Spotify plugin, based on Spotify’s Libspotify library. Spotify deprecated the library several years ago but has not developed a full replacement. I added new functionality last year by using Spotify’s Web API library - Featured Playlists, What’s New, Genres and Moods, etc. But left the My Playlists as is, using Libspotify.

Spotify turned off support for personal playlists in Libspotify a while ago, hence I hacked up the plugin to use the Spotify Web API to grab personal playlists, and while I was at it added My Saved Albums, My Saved Tracks, etc. But we are still using the old Libspotify code for playback, and Volumio communicates with the app (SPOP) through a socket connection. So in your case something is not executing correctly - the Spotify Web API calls are working, the connection to the SPOP daemon on your Volumio device is not.

Unfortunately I am not familiar with SPOP and the socket connection to be able to remotely debug your issue. You might want to try a clean install of Volumio and the plugin, and then overwrite the Spotify plugin index.js file as you already have.

Works great, I love you!

Thank you so much!

Thomas

Works perfectly on all 3 of my Volumio systems, thanks so much for all your work on this :smiley:

works out of the box for my setup :smiley: :smiley: :smiley:
Great work!

ok after some time i noticed some issues:
I only get my last 20 playlists in the MY PLAYLIST section.

Yeah, I can’t figure that out. I’m running Volumio on two different Pi’s, one shows me 50 playlists, the other shows me 20. Same code, and I am passing in the “{limit : 50}” parameter to the get playlists call, so no idea why some systems (including one of mine) is returning 20.

The same thing happened to me too. I haven’t changed index.js yet but found this topic by accident while trying to resolve the issue.

I performed a ‘factory reset’ and reloaded the plugin. This time I was careful to reboot between every major change, not sure if that made any difference but at least Spotify plays now.

Now I’ll try changing index.js and see if I can get my playlist to work.

Hi, I’m struggling to have the Spotify plugin showing my playlist. I have followed the step above:

Got a new refreshtoken
Updated index.js with the nee refreshtoken
Restarted volumio

Still My Playlist does not open without any error
The other folder (Featured Playlist, What’s New, Genres & Moods) can be opened and I don’t have any issue.

So following the instruction above I have connected to the web console and tried the API call (“v1/me/playlists”). This is working fine. Note that when I click get token it asks me to select the scope and I have selected playlist-read-private.

Now I do not really understand what you mean here:
For a problem account, now plug in the access token (not refresh token) you get from the EC2 server I put up. Are the results any different between the Spotify Console generated access token and the one from our test server?

What do you mean with “now plug in with the access token you get from EC2 server”. Does it mean that I have to replace the refreshtoken in the index.js file with the access token I got from web page 54.86.144.136:8888/?

I have tried this but in this case I can see an error in volumio log:

2018-08-02T19:59:51.332Z - info: [1533239991331] CoreMusicLibrary::Adding element Spotify
2018-08-02T19:59:51.454Z - info: Spotify credentials grant failed with WebapiError: Bad Request
2018-08-02T19:59:55.863Z - info: [1533239995863] CoreMusicLibrary::Adding element Spotify
2018-08-02T19:59:55.974Z - info: Spotify credentials grant failed with WebapiError: Bad Request
2018-08-02T20:00:01.741Z - info: An error occurred while listing Spotify my playlists WebapiError: Unauthorized
2018-08-02T20:00:03.484Z - info: An error occurred while listing Spotify my playlists WebapiError: Unauthorized

So I have put back the refreshtoken and this one seems to connect properly to Spotify. Here is what I see in the log:

2018-08-02T20:07:27.576Z - info: [1533240447576] CoreMusicLibrary::Adding element Spotify
2018-08-02T20:07:27.717Z - info: Spotify credentials grant success
2018-08-02T20:07:32.325Z - info: [1533240452325] CoreMusicLibrary::Adding element Spotify
2018-08-02T20:07:32.463Z - info: Spotify credentials grant success

However when I click on Playlist folder it does not open.

The whole volumio.log is available here: pastebin.com/jcHh50Pq

Does anyone have any idea of what the problem could be?

Regards,
Alberto