New 2023 Spotify Plugin

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.

1 Like

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.

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.

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?

zero indexed :wink:

0,1,2,3,.....49
\______   ____/
     limit=50 items

^
|
offset=0

0 - 50

here you have 51 items total :smile_cat: :

1 Like

Fantastic!

I have been using the old 3.x plugin for a while now and although I had come up with some workarounds for it’s quirks, this new total rewrite works just as I’d hoped it would. I haven’t run into any problems with it so far.

Kudos to @volumio and the development team: @ashthespy, @balbuze & @skikirkwood

Cheers,
Andrew

RBPi 3+
System: 3.546
DAC: HiFiBerry DAC Plus
Mixer Type: Hardware

Edited to include Kudos to @volumio