Help needed to test Spotify plugin with Oauth

Discuss, contribute and orient Volumio development!

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.

Help needed to test Spotify plugin with Oauth

Postby skikirkwood » Thu May 31 2018 22:37

Hi All, Spotify shut off access to the "My Playlists" feature of (the deprecated) Libspotify last week. I'm experimenting to see if we can replace that feature with the new (and supported) Spotify Web API. Good news is it appears to work!

So to get this working you need to authenticate your Spotify account and get back a token that the Volumio can then use in API calls to access your personal playlists. Good news is the old Libspotify library appears to still work for audio playback, as there is no replacement yet.

So I could use some help testing the Proof of Concept I created. Here's what you need to do:

[edit: this post is now deprecated. Please view a more recent post in this thread for updated instructions.]
Attachments
My Playlists.png
My Playlists.png (7.45 MiB) Viewed 8570 times
Last edited by skikirkwood on Sat Nov 17 2018 19:31, edited 2 times in total.
Volumio 2 on Raspberry Pi 3 B+, Schiit Modi 2 Multibit DAC, Volumio 2 on Raspberry Pi 3, IQAudio Pi-DAC+, Schiit Freya preamp, Bryston 3b power amp, B&W 803 speakers
User avatar
skikirkwood
Objectivist
Objectivist
 
Posts: 277
Joined: Thu Jan 08 2015 17:16
Location: Los Altos Hills, California

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.


Help needed to test Spotify plugin with Oauth

Postby skikirkwood » Fri Jun 01 2018 01:46

First three people who help me test this will get first dibs on the v2 version under development - which has "My Albums", "My Tracks" and "My Artists" - and yes, they are already working!
Attachments
spotify.png
spotify.png (4.88 MiB) Viewed 8550 times
Volumio 2 on Raspberry Pi 3 B+, Schiit Modi 2 Multibit DAC, Volumio 2 on Raspberry Pi 3, IQAudio Pi-DAC+, Schiit Freya preamp, Bryston 3b power amp, B&W 803 speakers
User avatar
skikirkwood
Objectivist
Objectivist
 
Posts: 277
Joined: Thu Jan 08 2015 17:16
Location: Los Altos Hills, California


Help needed to test Spotify plugin with Oauth

Postby pierre.bornancin » Fri Jun 01 2018 09:05

Hi,

Tested. It is working like a charm.

One imitation (probably due to a pagination feature in Spotify API), I can see only the first 100 songs of a playlist. the additional songs are not retrieved.

Cheers,

Pierre.
Random avatar
pierre.bornancin
Fresh off the boat
Fresh off the boat
 
Posts: 1
Joined: Fri Jun 01 2018 09:02


Help needed to test Spotify plugin with Oauth

Postby chsims1 » Fri Jun 01 2018 09:24

Sorry to report that nothing showing in 'My Playlists.'

Pretty sure that I followed you instructions correctly, & no errors thrown in console (journalctl). The rest of Spotify in spop seems to work fine. Anything you want checking?
New to Volumio? Please read the Quick Start Guide to get your system up and running :). FAQs? Docs?
User avatar
chsims1
Moderator
 
Posts: 1839
Joined: Sat Aug 02 2014 10:44
Location: East Yorkshire, UK


Help needed to test Spotify plugin with Oauth

Postby m0ritz » Fri Jun 01 2018 09:35

Not working for me... I used a windows tool called "winscp" to see if I placed the corrected file on my raspberry pi and it is there but "My playlists" is not working.
Random avatar
m0ritz
Fresh off the boat
Fresh off the boat
 
Posts: 2
Joined: Tue Jan 17 2017 16:57


Help needed to test Spotify plugin with Oauth

Postby joeythesaint » Fri Jun 01 2018 13:12

Yeah, also not working for me. Instead of copying files around I cloned the plugins repo to my local machine, made the change there and verified the change made it over to my pi:

Code: Select all
skynet plugins/music_service/spotify$ git br
  master
* oauth
skynet plugins/music_service/spotify$ git status
On branch oauth
Your branch is up-to-date with 'origin/oauth'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   index.js

no changes added to commit (use "git add" and/or "git commit -a")
skynet plugins/music_service/spotify$ ssh volumio@victor 'grep -A3 "Refresh token below" /data/plugins/music_service/spop/index.js'
volumio@victor's password:
X11 forwarding request failed on channel 0
        // Plug in your Spotify Refresh token below - not the access token - the refresh token!

        var refreshToken = '<actual refresh token removed but verified to be the same as the one on the page at http://54.86.144.136:8888/';

skynet plugins/music_service/spotify$


Still the same behaviour as before, though, nothing happening when I select `My Playlists`, but the others (`Featured` etc.) seem fine. Anything I can do to help debug this on my side?
-Joe.
:wq
User avatar
joeythesaint
Sunday DIYer
Sunday DIYer
 
Posts: 10
Joined: Thu Apr 05 2018 18:49
Location: Ottawa, Ontario, Canada


Help needed to test Spotify plugin with Oauth

Postby joeythesaint » Fri Jun 01 2018 15:46

Quick follow-up. I uninstalled my existing spop plugin with the Volumio UI, rebooted, re-installed and copied over the index.js file again. Now I'm seeing this in my logs when I attempt to re-enter my account information:

Code: Select all
2018-06-01T15:23:26.961Z - info: CALLMETHOD: music_service spop saveSpotifyAccount [object Object]
2018-06-01T15:23:26.970Z - info: CoreCommandRouter::executeOnPlugin: spop , saveSpotifyAccount
2018-06-01T15:23:27.452Z - info: mDNS: Found device james-Volumio
2018-06-01T15:23:27.888Z - info: SpopD Daemon Started
2018-06-01T15:23:32.898Z - info: Connecting to daemon
2018-06-01T15:23:32.955Z - info: CoreCommandRouter::volumioAddToBrowseSources[object Object]
2018-06-01T15:23:32.966Z - info: [1527866612959] CoreMusicLibrary::Adding element Spotify
2018-06-01T15:23:33.025Z - info: FIRST BRANCH
2018-06-01T15:23:33.350Z - info: Spotify credentials grant failed with WebapiError: Bad Request


I then went back to the unmodified plugin and I'm able to log back in to my account successfully (though obviously without access to `My Playlists`). FWIW, I did try with the previous token and a newly created one from http://54.86.144.136:8888
-Joe.
:wq
User avatar
joeythesaint
Sunday DIYer
Sunday DIYer
 
Posts: 10
Joined: Thu Apr 05 2018 18:49
Location: Ottawa, Ontario, Canada


Help needed to test Spotify plugin with Oauth

Postby skikirkwood » Fri Jun 01 2018 16:06

chsims1 wrote:Sorry to report that nothing showing in 'My Playlists.'

Pretty sure that I followed you instructions correctly, & no errors thrown in console (journalctl). The rest of Spotify in spop seems to work fine. Anything you want checking?

Hmmm, looks like my first release is working for 1/4 people. It continues to work across all 3 of my Volumio systems today. Let me try to follow my own instructions on one of my Pi's and see if I can find what the issue is.

For those of you who tried it and did not get it working, can you post your /var/log/volumio.log file. I can see for one person the actual Spotify credentials grant failed, so that's progress.
Volumio 2 on Raspberry Pi 3 B+, Schiit Modi 2 Multibit DAC, Volumio 2 on Raspberry Pi 3, IQAudio Pi-DAC+, Schiit Freya preamp, Bryston 3b power amp, B&W 803 speakers
User avatar
skikirkwood
Objectivist
Objectivist
 
Posts: 277
Joined: Thu Jan 08 2015 17:16
Location: Los Altos Hills, California


Help needed to test Spotify plugin with Oauth

Postby joeythesaint » Fri Jun 01 2018 16:43

Okay, going back to try to start from a clean slate, so I uninstalled the Spotify (spop) plugin, rebooted, then installed it and configured it with my account details. So I'm starting from a pristine plugin that lets me log in and view the Featured, etc. items but not my playlists.

That log is here: https://pastebin.com/1USpndRi

Then I went back to http://54.86.144.136:8888 and grabbed a new Refresh token, placed it in my local copy of index.js and copied it over to my pi. Nothing really interesting in that log but I dumped it here: https://pastebin.com/VmF6nVhs

Then I rebooted the pi again and verified the index.js still had the correct token. After that, the volumio.log shows from boot until I click on the 'My Playlists' item. No error this time, it seems, but also no success on showing the page. And interestingly maybe, the error I saw before is gone when I went back to reconfigure the Spotify plugin with my username and password again. That was fine this time. So I don't know what happened in the middle there. That log is here: https://pastebin.com/d1kccmAT

One last thing, though, when I was looking at the code I noticed there was a mix of tabs and spaces in the newly added stuff. It doesn't seem to impact anything here, but I cleaned that up anyway: https://pastebin.com/agE1T8cv
-Joe.
:wq
User avatar
joeythesaint
Sunday DIYer
Sunday DIYer
 
Posts: 10
Joined: Thu Apr 05 2018 18:49
Location: Ottawa, Ontario, Canada


Help needed to test Spotify plugin with Oauth

Postby chsims1 » Fri Jun 01 2018 18:03

/var/log/volumio.log @ https://pastebin.com/Qciv5XAK
New to Volumio? Please read the Quick Start Guide to get your system up and running :). FAQs? Docs?
User avatar
chsims1
Moderator
 
Posts: 1839
Joined: Sat Aug 02 2014 10:44
Location: East Yorkshire, UK

Next

Return to Development talks

Who is online

Users browsing this forum: No registered users and 0 guests