New 2023 Spotify Plugin

Dear Volumioners,
we have a fantastic news to share: there is a new, totally rewritten (literally), perfectly working plugin for Spotify.

The new plugin is version 4.0.x and it’s available now.

IMPORTANT! To update your plugin follow carefully the steps below!

If you have the old plugin installed (or the old volspotconnect2) follow this steps:

  • Uninstall all spotify plugins (volspotconnect2 or spop)
  • Restart your system
  • Install the new plugin from the Volumio Plugin store
  • Enjoy!

If you don’t have any of the above plugins, simply install it from the Volumio plugin store.

IMPORTANT2! Make sure you’ve disabled plugin test mode!

While this plugin has gone extensive QA and testing before being released, please report if something is not working as it should.
As alwasys, this is the info we need:

We’ll collect all the infos and updates in this thread (going to lock the old one)

Enjoy!

PS: If you enjoy this new plugin, and want to support the project, please consider subscribing to Volumio Premium. Not only you will show your appreciation but you’ll get a whole lot of amazing features.

Update 03/11/2023

Version 4.0.3 is out:

What has been fixed\improved

  • Better bidirectional Volume control
  • Fixed the limit of 50 items (thanks @phts)
  • Added followed artists page
  • Fixed shuffle and repeat on connect mode (thanks @phts)
  • Fixed support of podcasts
  • Increase limit of 50 personal playlists

What next

  • Get gapless playback working (by using prefetch)
  • Show logged in user id

What won’t be fixed

  • Switching from connect mode to brosing mode (for example: New 2023 Spotify Plugin - #10 by SimonE)
    Reason is that this is really a major endeavour
  • Signalling the maximum volume level in Spotify clients, as it’s not possible. In any case the max volume setting is respected, and this is the important bit
19 Likes

Raspberry Pi4
USB DAC (Topping d10s)
Volumio v3.546 Premium
Official RPI 7" display

Initial tests positive:

  • No lag between tracks
  • Flips between music library and Spotify (plugin) without problems (old app it was usually necessary to clear queue a couple of times when changing sources)
  • Volume settings on display correct
  • SuperSearch and autoplay working perfectly (seems faster)

Using Spotify from the app on my phone (Connect) it’s much faster, but if I am playing tracks from my library and then click a track on Spotify Connect it doesn’t play the spotify track. It does if I first stop the library track first and then play from Spotify.
Log

Generally a huge improvement though. Congrats!

Installed and working great. The plugin is fast and responsive. Just one question. I have over 100 albums stored as favourites. Is the plugin still limited to showing just the first 50 albums?

Playback randomly stops and plays next song, via spotify connect. Around every second song skips like that in the middle.

Version: “System Version: 3.546 Released: Wed 27 Sep 2023 11:35:49 AM CEST”
Hardware: Rasp PI 4B
DAC: HiFiBerry Digi2 Pro
Mixer type: none

Tried all common troubleshooting: installed/reinstalled plugin several times, rebooted several times, etc.

Full logs: http://logs.volumio.org/volumio/EZMY4MY.html

Logs
			
time="2023-10-23T19:08:34+02:00" level=debug msg="fetched chunk 4/21, size: 524288"

info: CoreCommandRouter::volumioGetState
ALSA lib pcm.c:8427:(snd_pcm_recover) cannot recovery from underrun, prepare failed: Device or resource busy
time="2023-10-23T19:08:44+02:00" level=error msg="playback failed" error="ALSA error at snd_pcm_recover: Device or resource busy"
time="2023-10-23T19:08:44+02:00" level=trace msg="emitting websocket event: not_playing"
time="2023-10-23T19:08:44+02:00" level=debug msg="loading track spotify:track:7aE5WXu5sFeNRh3Z05wwu4 (paused: false, position: 0ms)"
SPOTIFY: received: {"type":"not_playing","data":{"uri":"spotify:track:5nfMtk9Zty1AITVo4YDhbb","play_origin":"free-tier-album"}}
error: Failed to decode event: not_playing
time="2023-10-23T19:08:44+02:00" level=debug msg="put connect state because PLAYER_STATE_CHANGED"
time="2023-10-23T19:08:44+02:00" level=trace msg="emitting websocket event: will_play"
SPOTIFY: received: {"type":"will_play","data":{"uri":"spotify:track:7aE5WXu5sFeNRh3Z05wwu4","play_origin":"free-tier-album"}}
time="2023-10-23T19:08:44+02:00" level=debug msg="selected format OGG_VORBIS_320 for spotify:track:7aE5WXu5sFeNRh3Z05wwu4"
time="2023-10-23T19:08:44+02:00" level=debug msg="requested aes key for file bd8a476ea299a80d2618c33427141730e5178f76, track: spotify:track:7aE5WXu5sFeNRh3Z05wwu4"
time="2023-10-23T19:08:44+02:00" level=debug msg="fetched first chunk of 23, total size is 11907744 bytes"
time="2023-10-23T19:08:44+02:00" level=trace msg="seek to 0ms (diff: 0ms, samples: 0, bytes: 0)"
time="2023-10-23T19:08:44+02:00" level=debug msg="fetched chunk 2/22, size: 524288"
time="2023-10-23T19:08:44+02:00" level=debug msg="fetched chunk 3/22, size: 524288"
time="2023-10-23T19:08:44+02:00" level=info msg="loaded track \"Wish You Were Here - 2011 Remaster\" (uri: spotify:track:7aE5WXu5sFeNRh3Z05wwu4, paused: false, position: 0ms, duration: 304200ms)"
time="2023-10-23T19:08:44+02:00" level=debug msg="fetched chunk 1/22, size: 524288"
time="2023-10-23T19:08:44+02:00" level=debug msg="put connect state because PLAYER_STATE_CHANGED"
time="2023-10-23T19:08:44+02:00" level=trace msg="emitting websocket event: metadata"
SPOTIFY: received: {"type":"metadata","data":{"uri":"spotify:track:7aE5WXu5sFeNRh3Z05wwu4","name":"Wish You Were Here - 2011 Remaster","artist_names":["Pink Floyd"],"album_name":"Wish You Were Here (Remastered Version)","album_cover_url":"https://i.scdn.co/image/ab67616d00001e02df3aa3f27dfda3285ca7a2e5","position":0,"duration":304200}}
time="2023-10-23T19:08:44+02:00" level=debug msg="put connect state because PLAYER_STATE_CHANGED"
time="2023-10-23T19:08:44+02:00" level=trace msg="emitting websocket event: playing"
SPOTIFY: received: {"type":"playing","data":{"uri":"spotify:track:7aE5WXu5sFeNRh3Z05wwu4","play_origin":"free-tier-album"}}
SPOTIFY: PUSH STATE SPOTIFY
SPOTIFY: {"status":"play","service":"spop","title":"Wish You Were Here - 2011 Remaster","artist":"Pink Floyd","album":"Wish You Were Here (Remastered Version)","albumart":"https://i.scdn.co/image/ab67616d00001e02df3aa3f27dfda3285ca7a2e5","uri":"spotify:track:7aE5WXu5sFeNRh3Z05wwu4","trackType":"spotify","seek":0,"duration":304,"samplerate":"44.1 KHz","bitdepth":"16 bit","bitrate":"320 kbps","codec":"ogg","channels":2,"stream":false,"repeatMode":"all"}
info: CoreCommandRouter::servicePushState
info: CoreStateMachine::pushState
info: CoreCommandRouter::executeOnPlugin: volumiodiscovery , saveDeviceInfo
info: CoreCommandRouter::volumioPushState
info: [GPIO_Control] *** musicPlay ***
info: [GPIO_Control] Delaying: 0ms
info: [GPIO_Control] Turning GPIO 12 On (musicPlay)
SPOTIFY: PUSH STATE SPOTIFY
SPOTIFY: {"status":"play","service":"spop","title":"Wish You Were Here - 2011 Remaster","artist":"Pink Floyd","album":"Wish You Were Here (Remastered Version)","albumart":"https://i.scdn.co/image/ab67616d00001e02df3aa3f27dfda3285ca7a2e5","uri":"spotify:track:7aE5WXu5sFeNRh3Z05wwu4","trackType":"spotify","seek":1000,"duration":304,"samplerate":"44.1 KHz","bitdepth":"16 bit","bitrate":"320 kbps","codec":"ogg","channels":2,"stream":false,"repeatMode":"all"}
info: CoreCommandRouter::servicePushState
info: CoreStateMachine::pushState
info: CoreCommandRouter::executeOnPlugin: volumiodiscovery , saveDeviceInfo
info: CoreCommandRouter::volumioPushState
info: [GPIO_Control] *** musicPlay ***
info: [GPIO_Control] Delaying: 0ms
info: [GPIO_Control] Turning GPIO 12 On (musicPlay)
time="2023-10-23T19:08:56+02:00" level=debug msg="fetched chunk 4/22, size: 524288"

UPD

Today reproduced even on every song, few seconds playing then skips

http://logs.volumio.org/volumio/CBmCXd4.html

I have over 100 albums stored as favourites. Is the plugin still limited to showing just the first 50 albums?

yes, limited by 50 items, due to spotify API, maximum limit of single request. If need fetch more - need to use pagination dealing with rate limits which prevent you from fetching too much data at the same time.

In my fork I managed to implement this logic and it is loading full list of tracks, albums and artists.

I haven’t not rebased my fork onto latest plugin v4 yet.

Please send full logs as per instructions: How to send a log link for a bug report?

Otherwise its just guess work…

Interesting that you’ve found a solution for the pagination. If you would like to contribute to this plugin, a PR (one commit for every fix you do) will be very welcome.

Here you go - http://logs.volumio.org/volumio/EZMY4MY.html

Further clarification of the issue I reported yesterday (and otherwise the plugin is working very well).

Logs: http://logs.volumio.org/volumio/GUnl8Tm.html

Raspberry Pi4
USB DAC (Topping d10s)
Volumio v3.546 Premium / Spotify 4.0.1
Official RPI 7" display
Restarted Volumio before this test

Behaviour:

  • Play track from library - ok
  • If no library track playing, play track from Spotify connect - ok
  • Play track in library and then, whilst still playing, select a Spotify track - carries on with library track.
  • Then stop library track and select Spotify track - ok again
  • Sometimes an Alsa error (failed to open, Volumio busy) when selecting a library track whilst playing a Spotify track. Clicking the library track again plays track properly,

In summary, does not stop me switching between Spotify and other sources (which was more of a problem with the old plugin), but not 100% yet.

EDIT:

  • When playing a library file and then selecting a Spotify track via the plugin (so not via Connect), the Spotify track plays fine (so different to the result in my 3rd bullet point above)
  • When playing a Spotify track via the plugin and then playing a library file I get the Alsa busy error, but it plays ok when I hit play again.

First of all, thank you for the work you put into it :+1:

Spotify does play from the Volumio app and at the same time the next song from the Spotify connect app is not possible, the same as @SimonE
only the same song can be played and repeats itself when you select the next song.
for the rest, from the volumio app spotify it works fine… every now and then there is no sound when selecting the next song, this is sporadic.
rorary encoder KY-040 and infrared work well.

raspberry pi 3b
Ian Canada isolator II and FifoMA 1.5 reclocker.
dac: pcm 1794A dual: upsampling via fusionDSP otherwise no sound from Spotify, upsampling from Volumio (playback options) does not work with Spotify, it is a problem in the DAC itself.
driver: HiFiBerry dac + pro.
7,9 inch waveshare hdmi touchscreen: now playing plugin.

http://logs.volumio.org/volumio/RCIWtep.html

1 Like

Sorry, gave up on Spotify when they failed to deliver on their hi-res promise.

2 Likes

According to their price lift they think they deliver Hi-res. :wink:

Volumio Primo V1 Hifi-edition
Rega Dac-R (connected via USB)
Volumio v3.546

With version 4.0.1 of the new plugin and using Spotify Connect the queue in Spotify will not work.
It says that songs songs are added, but in the queue they are not added.
If I switch to my Chromecast Audio or just plays it locally on my android device the queue works,
but if I then switch back to Volumio in Spotify the queue stops working.

Done the install/reinstalled plugin, rebooted several times etc. Tried both if I`m logged in or not to Spotify in the plugin,

In the log I can see an error that seems to be related to this
volumio go-librespo …msg=“failed handling dealer request” error=“unsupported player command: set_queue”

Logfile: http://logs.volumio.org/volumio/SsxijMe.html

I`ve now switched back to the old 3.0.9 version of the plugin and the queue is working again in the Spotify app when using Spotify Connect to Volumio.

2 Likes

works like a charm for me on volumio 3.512 +hifiberry DAC plus!

thank you ever so much!!!

(there is a small gap between tracks when playing an album, but never mind, this is a tremendeous improvement on the previous version)

and yes, I upgraded to premium !!!

2 Likes

Connect stopped to connect. edit: (not reproducable)
In Spotify App it is hanging with “connecting to (devicename)…”
It worked stable for 1 whole day on Monday
Yesterday late afternoon it began to cut the last half of songs playing the next and cutting also…
Today connect doesn’t connect any longer.

Log:
http://logs.volumio.org/volumio/ng9hhdC.html

If i start playing in the UI of Volumio the connection in the app establishes and i can play some songs but then it suddenly stops playing

Using v4.01 of the plugin
Volumio v3.546

br
Josef

Edit: The issues only appeared on Tuesday and Wednessday last week - and now everything is back to normal. May have been a network issue (tested in the company office, where i am working).
Sorry for the confusion.

1 Like

I would also kindly ask to fix this issue. It is annoying when listen to pink floyd for example.

hi @volumio

PRs:

1 Like

Can you please explain a little bit more for dummies how to bypass this limit of 50 items? :innocent:

Thanks for making a new Spotify plugin!

I have three issues:

  1. Spotify will only connect if nothing else is playing. So it can’t interrupt a local playing file or another stream.
  2. The plugin skips through the playing song several times every second.

http://logs.volumio.org/volumio/BXCuhv8.html

  1. The plugin hangs at 90% finished when installing.

http://logs.volumio.org/volumio/KKQonJo.html

I’m on Primo version 1.

to use pagination

every spotify API request can take limit and offset - call first request with limit=50 and offset=0, then second request with limit=50 and offset=50, third - limit=50 and offset=100, and so on. If received no data then time to stop the loop.

see my MRs above

Unfortunately there is no count available within the API. So you need to loop.
But should the sequence not set to 0 - 50, 51 - 100, 101 - 150?