text:
🐛 | Spotify does not work anymore

Bug
What I did
My Working Phoniebox stops working since today.
Spotify integration does not work. only local playback works
I Changed nothing. Works weeks before like a charm.
Spotify Premium is Valid
What happened
May 16 19:46:47 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.__main__ Starting Mopidy 3.2.0
May 16 19:46:47 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.config Loading config from builtin defaults
May 16 19:46:47 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy-local.conf
May 16 19:46:47 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf
May 16 19:46:47 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf
May 16 19:46:47 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.config Loading config from command line options
May 16 19:46:47 phoniebox mopidy[2207]: ERROR    [MainThread] mopidy.internal.log Loading logging config '/etc/mopidy/logging.conf' failed. 'formatters'
May 16 19:46:47 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.__main__ Enabled extensions: local, spotify, file, mpd, iris, m3u, stream, softwaremixer, http
May 16 19:46:47 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.__main__ Disabled extensions: none
May 16 19:46:48 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer
May 16 19:46:48 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.commands Mixer volume set to 30
May 16 19:46:48 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.commands Starting Mopidy audio
May 16 19:46:48 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.commands Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, SpotifyBackend, LocalBackend
May 16 19:46:49 phoniebox mopidy[2207]: INFO     [Audio-2] mopidy.audio.actor Audio output set to "alsasink"
May 16 19:46:49 phoniebox mopidy[2207]: ERROR    [SpotifyEventLoop] spotify.session Spotify login error: <ErrorType.USER_NEEDS_PREMIUM: 15>
May 16 19:46:49 phoniebox mopidy[2207]: INFO     [SpotifyBackend-6] mopidy_spotify.web Logged into Spotify Web API as XXXXXXXXXX
May 16 19:46:49 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.commands Starting Mopidy core
May 16 19:46:49 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.commands Starting Mopidy frontends: IrisFrontend, HttpFrontend, MpdFrontend
May 16 19:46:49 phoniebox mopidy[2207]: INFO     [IrisFrontend-11] mopidy_iris.core Starting Iris 3.54.2
May 16 19:46:49 phoniebox mopidy[2207]: INFO     [HttpFrontend-13] mopidy.http.actor HTTP server running at [0.0.0.0]:6680
May 16 19:46:49 phoniebox mopidy[2207]: INFO     [MainThread] mopidy_mpd.actor MPD server running at [0.0.0.0]:6600
May 16 19:46:49 phoniebox mopidy[2207]: INFO     [MainThread] mopidy.commands Starting GLib mainloop

May 16 19:49:29 phoniebox mopidy[2207]: INFO     [MpdSession-278] mopidy_mpd.session New MPD connection from [127.0.0.1]:34620
May 16 19:49:29 phoniebox mopidy[2207]: INFO     [SpotifyBackend-6] mopidy_spotify.lookup Failed to lookup 'spotify:album:0XXX': Session must be logged in and online to load objects: <ConnectionState.LOGGED_O
May 16 19:49:29 phoniebox mopidy[2207]: INFO     [MpdSession-279] mopidy_mpd.session New MPD connection from [127.0.0.1]:34622

I think its a problem discribed here -> ? https://github.com/mopidy/mopidy-spotify
"As promised last month, Spotify disabled access to libspotify on 16/05/2022. As of today, seven years after libspotify was deprecated, there is still no official replacement library available."

Thanks for reporting this.
Looks like this is a real showstopper.

Can confirm. We have 2 Phonieboxes for our children and both stopped playing spotify over night.

Confirmed by 5 boxes and 5 sad children. There will be no quick way around it. We all hoped that day would never come, but it finally has come and there is not much one can do as long as spotify does not reconsider its decision. At least the non-spotify part is still working.

Holy shite, yes please prioritized this, I think this breaks every other phoniebox out there (including mine :/)

Unfortunately I don’t think that there will be a solution to this, because Spotify disabled the support of libspotify.

@MiczFlor

Is it out of the question to use another API or SDK for Spotify on Phoniebox? It's really depressing to lose that unique selling point. I didn't see it coming, either.

Is it out of the question to use another API or SDK for Spotify on Phoniebox? It's really depressing to lose that unique selling point. I didn't see it coming, either.

See https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1815#issuecomment-1130384442

^that might work, see how to install https://qengineering.eu/install-gstreamer-1.18-on-raspberry-pi-4.html
( I hadn't found time to try ;(  )

Same here spotify is not working anymore. Is there any alternative API or SDK to replace mopidy?
whats about this: https://lib.rs/crates/gst-plugin-spotify (found here mopidy/mopidy-spotify#110 (comment))

Current implementation relies on mopidy in the Spotify edition (also for non Spotify functions), so from my point of view we should wait for an update of mopidy-spotify.
But if anyone comes up with a different solution and proposes a PR, we could also check if this is the way we want to go.
As we are currently working on a new and shiny version 3 we need to check the implications in https://github.com/MiczFlor/RPi-Jukebox-RFID/tree/future3/spotify as well.
@pabera @ChisSoc @Groovylein @MiczFlor

As we are currently working on a new and shiny version 3 we need to check the implications in https://github.com/MiczFlor/RPi-Jukebox-RFID/tree/future3/spotify as well.

^^I've seen there is already alottah python inside, this might be handsome, I'll try...
https://pypi.org/project/spotify/

As we are currently working on a new and shiny version 3 we need to check the implications in https://github.com/MiczFlor/RPi-Jukebox-RFID/tree/future3/spotify as well.

I've tested the development environment for Spotify yesterday and it works 🤞
We are using https://github.com/librespot-org/librespot-java, which is using the Spotify Web-API

As we are currently working on a new and shiny version 3 we need to check the implications in https://github.com/MiczFlor/RPi-Jukebox-RFID/tree/future3/spotify as well.

I've tested the development environment for Spotify yesterday and it works 🤞 We are using https://github.com/librespot-org/librespot-java, which is using the Spotify Web-API

yeah, would be so nice to have a kind of working version, so guys can swtich to future 3 ;)

Hey Guys, that would be so so so awesome if you are able to find an alternative solution! You would be a star for so many Kids and Dads! :-)

I'm to stupid for active coding contribution. It would be awesome to get an alternative for my son. We both created a huge amount of cards with his favorite audiobooks. Therefore it would be great if you professionals find a way to solve the problem.

As we are currently working on a new and shiny version 3 we need to check the implications in https://github.com/MiczFlor/RPi-Jukebox-RFID/tree/future3/spotify as well.

I've tested the development environment for Spotify yesterday and it works 🤞 We are using https://github.com/librespot-org/librespot-java, which is using the Spotify Web-API

How mature is the future3/spotify branch? Can it be merged and released yet?

How mature is the future3/spotify branch? Can it be merged and released yet?

Unfortunately it isn't stable at all. The player management and the whole WebApps are not ready for Spotify yet.

Can we get a merge of future3/dev and spotify? Even if not stable and no web-app, i guess you will get a lot of testers :-)

A few words about the future3/spotify branch: This is not just adding Spotify. This branch massively changes (and improves) the way the Jukebox interfaces with the backend players. Previously there has only been one: MPD, and now there need to be multiple. So even future3/develop and future3/spotify are not compatible at the moment and need to be merged, which is a bit of work. For the user, this is also a not quite transparent change: the way stuff (links etc) is stored must to change from the current release. Currently the spotify branch is also an experimental branch for all these underlying changes. And that is where it is: experimental - many changes, no documentation, little test coverage.
After a highly active coding phase during winter with much progress, there has been a bit of a lush with the beginning of spring. Guess why ;-) We need to pick it up from there. So, long words short: there is no quick solution. It is massively more work than just merging the current branch to develop.

Just came to the discussions to find out, why my daughter's Phoniebox stopped working. And now - oh my, what a catastrophe 😥, our Phoniebox is entirely based on Spotify, I made over 50 cards.  Hopefully, it will work again in Future, shame on Spotify to just cut the access.

This was quite shocking news so I thought about alternatives out of desperation: I have an LMS SqueezeboxServer server on another Raspberry Pi (with working Spotify support), so I installed piCorePlayer on my Phoniebox to use it as an LMS Squeezebox Client, and wrote a script to use RFID tags for starting Spotify playlists.
Of course, this is not supposed to be a replacement for Phoniebox, just a quick and dirty fix to get Spotify working again quickly.  I hope you find a better solution soon! Until then, if someone is desperate enough to try it out, the script and instructions are here https://github.com/maahn/piCorePhonie

wrote a script to use RFID tags for starting Spotify playlists.
nice!!
I'm on a just python script, back to basics, I started yesterday, reading the usb rfid number works,
have less time but will be ready hopefully soon

A few words about the future3/spotify branch: This is not just adding Spotify. This branch massively changes (and improves) the way the Jukebox interfaces with the backend players. Previously there has only been one: MPD, and now there need to be multiple. So even future3/develop and future3/spotify are not compatible at the moment and need to be merged, which is a bit of work.

hmm here are some thoughts from my side: Instead of trying to create an Eierlegende Wollmilchsau, maybe be should take a step back and aim for a simple back-to-the-roots version: A codebase that allows playing of spotify based on RFID cards.

oh deer ;)
it kind of works, but not really ;)
daughter is happy I converted her box to a just Spotiy Connect Client with raspotify
she's using her laptop to start an album and closes it after it's playing through the pi -> audio jack -> partybox
works flawless since 2 days ;) ... she's old enough to get in touch to the whole spotify world...
for her little brother -> rfid cards kind of work ...
see the gist, feel free to do any better ;) I'm not a soo experienced python guy ...
https://gist.github.com/sonicdee/bf5f655669ef6900b72c54f0c7696d32
it's using raspotify also, and spotipy to control it,
but
I'm running in an issue the raspotify device is not active on next day, so it can't be controlled anymore ;(
^^ maybe it can be done all inside librespot better !?
I stuck on this device loosing problem - reboot seems to work
also haven't figured out how to use py asyncio, but using screen with crontab to start both - works also ;) ..
you need to start gpio and Rfspoty side by side
also -> sudo is needed for usb rfid, can't find the right stuff to change udev rules...

https://www.heise.de/news/Abgeschaltet-libspotify-Aus-legt-selbstgebastelte-Musikboxen-fuer-Kinder-lahm-7124231.html

After getting an glimpse overview of why Spotify stopped working, I quit my Premium subscription right away (as this was the only reason to have a subscription in the first place). I cannot imagine that they will revive this API — ever. Guess this is expected to happen if you have the monopoly on audio-streaming?!
Has anyone got their box working with providers other than Spotify?

I'll stick with spotify and converted all my stuff to mp3. Slightly more effort but it works even offline.

I switched to MuPiBox and bought touchscreens as adviced... but it only worked one time to play spotify. Now I have a problem.. I hope it will be solved

@oswaldo-be Could you please share more of your migration experiences with MuPiBox ? Given the time frame of a possible fix for Phoniebox I guess it's a viable alternative to many of us, as sad as it is.

After getting an glimpse overview of why Spotify stopped working, I quit my Premium subscription right away (as this was the only reason to have a subscription in the first place). I cannot imagine that they will revive this API — ever. Guess this is expected to happen if you have the monopoly on audio-streaming?!
Has anyone got their box working with providers other than Spotify?

In our new version 3 we use a different implementation of the Spotify API, but the branch future3/spotify is not ready for production yet, see https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1815#issuecomment-1132774819

I'll stick with spotify and converted all my stuff to mp3. Slightly more effort but it works even offline.

I did this in the first place, had some connectivity issues. But its realy sad, i hope there will be a alternative too. Maybe with offline playlists? (i hope)

I stuck on this device loosing problem - reboot seems to work ^^ I'm investigating these days, when it works I'll load it to github with better docs...
I've added "sudo systemctl restart raspotify" to cronjob and this seems to work... for a couple of days now ;) happy kids

Please follow the discussion about the future of Spotify integration in #1835

As you already all know spotify discontinued libspotify library (see README.md) and lobrespot-java added a disclaimer.
For this very reason, we had to delete the branch future3/spotify, since we are now searching for new solution approaches to integrate spotify API into the future3 phoniebox.
Feel free to propose new ways of integrating supported spotify API into the phoniebox in the discussion forum #1835

Which tool did you use to convert it?
lenlennart @.***> schrieb am Do., 2. Juni 2022, 18:51:

I'll stick with spotify and converted all my stuff to mp3. Slightly more
effort but it works even offline.
i just did the same and frankly, this wasnt too much work - roughly 2min
for each of the 20 cards.
Me - and more importantly my daughter - is happy again.
looking forward to see a new spotify integration, but the immediate pain
is gone.
—
Reply to this email directly, view it on GitHub
https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1815#issuecomment-1145087025,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AJNPPUJ4MWD5GWBUE3K2L73VNDRAXANCNFSM5WCISTNA
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

Hi phonieboxers.
I would like to share two solutions/workarounds to satisfy our children until the ultimate Phoniebox release.

Download albums/playlists as MP3 and move them to the phoniebox SD-card. In my opinion the best way to achieve this is using https://github.com/SathyaBhat/spotify-dl/ and following the description there.
And the solution I prefer: Delete the premium account of spotify and create one with TIDAL. The look and feel is almost the same as with spotify and works for all of my setups (Sonos integration, android cell phone incl. offline mode and locally on a Windows PC). Moreover, I was able to move my playlists and favorites from Spotify over to Tidal using this service. On the Phoniebox you need to do the following steps:
2.1. Install mopidy-tidal according to the Readme. Follow the procedures to for configuration and Oauth authentification (see log files for link and authentificate).
2.2. In the Phoniebox webinterface go to Iris (by clicking "Spotify" in the top menu)
2.3. You can search for whatever album/playlist you would like to link to an RFID card. Tidal streams should be coming up then! Copy that URL (something like tidal:album:163359476). (Note the link must come from the Iris webinterface, not from the Tidal app!)
2.4. Link the card to that URL in the Phoniebox webinterface as you would have done previously with any spotify album/playlist. Create a new folder with a specific name and select "Spotify" as stream type (this is important!).
2.5. Done. This should work then. Check the log files of mopidy if you experience issues (journalctl -u mopidy)

Hope this helps you as well!
Best,
rmk

Which tool did you use to convert it?

i used tunefab, 30 day trail with 3min limit per song.
So not really usable for audio books, but fine for songs.

* And the solution I prefer: Delete the premium account of spotify and create one with [TIDAL](https://tidal.com). The look and feel is almost the same as with spotify and works for all of my setups (Sonos integration, android cell phone incl. offline mode and locally on a Windows PC). Moreover, I was able to move my playlists and favorites from Spotify over to Tidal using [this service](https://tidal.com/import-playlist). On the Phoniebox you need to do the following steps:

  1. Install [mopidy-tidal](https://github.com/tehkillerbee/mopidy-tidal) according to the Readme. Follow the procedures to for [configuration](https://github.com/tehkillerbee/mopidy-tidal) and [Oauth authentification](https://github.com/tehkillerbee/mopidy-tidal) (see log files for link and authentificate).
  2. In the Phoniebox webinterface go to Iris (by clicking "Spotify" in the top menu)
  3. You can search for whatever album/playlist you would like to link to an RFID card. Tidal streams should be coming up then! Copy that URL (something like tidal:album:163359476). (Note the link must come from the Iris webinterface, not from the Tidal app!)
  4. Link the card to that URL in the Phoniebox webinterface as you would have done previously with any spotify album/playlist. Create a new folder with a specific name and select "Spotify" as stream type (this is important!).
  5. Done. This should work then. Check the log files of mopidy if you experience issues (`journalctl -u mopidy`)

@rmk-ch That sounds great! Could you please share what Phoniebox version you use ? I guess it's v2, because I don't see any mopidy in current future3 branch/v3.2.0 release, or am I wrong ?
Is there any chance to easily add mopidy to future3 ?

@varac I am running v2 with spotify enabled.
@passuff ouu i see you're right about this. This is not a spotify download. Sorry for the confusion. Thought it was mich better due zo lower wait times compared to many other tools. I haven't tested this thoroughly due to switching to tidal.

Which tool did you use to convert it?

I can recommend DownOnSpot for this purpose. It is based on librespot and requires a nightly Rust toolchain for building, but overall the process is fairly straightforward. They claim it will also work with a free Spotify account, I did not verify this, but it definitely worked well with my premium account.
Actually now I like this solution more than the streaming version, it is more reliable and Spotify can no longer mess with my custom playlists (which they did a couple of times in the past). Not sure if its covered by their TOS but as long as you have a premium account, it could be argued this falls under fair use.

Thx. Will have a deep look into it.
usernameAXZ @.***> schrieb am Di., 7. Juni 2022, 23:09:

Which tool did you use to convert it?
I can recommend DownOnSpot https://github.com/oSumAtrIX/DownOnSpot for
this purpose. It is based on librespot and requires a nightly Rust
toolchain for building, but overall the process is fairly straightforward.
They claim it will also work with a free Spotify account, I did not verify
this, but it definitely worked well with my premium account.
Actually now I like this solution more than the streaming version, it is
more reliable and Spotify can no longer mess with my custom playlists
(which they did a couple of times in the past). Not sure if its covered by
their TOS but as long as you have a premium account, it could be argued
this falls under fair use.
—
Reply to this email directly, view it on GitHub
https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1815#issuecomment-1149169573,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AJNPPULKXKGPT7AXCXVXQLDVN627PANCNFSM5WCISTNA
.
You are receiving this because you were mentioned.Message ID:
@.***>

Hi guys, I just wanted to say a couple of things.
It sucks Spotify have turned libspotify off and they've no interest in supporting projects like this. I assume some of the comments on the Spotify dev forum are from (rightly) unhappy Phoniebox users and although I don't think Spotify will reverse this move, it's still good to demonstrate there is demand for a real libspotify replacement. So thanks to everyone who posted.
Secondly, I am working on a fixed version of Mopidy-Spotify but I don't have much free time so it's sporadic development. And it's a fair bit of work. But progress is being made and I hope to get it working again soon. I can't make any specific timescale promises. I would understand if Phoniebox was to move to another software solution, it's important to find the best fit for your project and get things working for users. But I would hope you avoid projects that circumvent Spotify's Premium subscription requirement as I think that'll just end in everyone losing access. Alternatives services like Tidal are an option but they have even worse developer support (it's non-existent). No good options out there, sadly.
I also want to mention it was my colleague that randomly reminded me of Phoniebox when suggesting it as a cool project for me, now I'm a father. Hopefully this explains why dev is slow but at least I've got a vested interest now!

Hi Guys, just wanted to catch up on the last activities since June. What is the actual status? Is there a workaround in place for the libspotify workaround?
Many thanks!

283 cards and 2 Phonieboxes deep into this project ... It would be REALLY great if a working release, at least with RFID card reader + working Spotify support, would be released. Even as pre-pre-pre-alpha without any working Web-Interface or anything would be highly appreciated. RFID + Spotify are the only features we use anyways.
Any roadmap there?

Hi, discussion of Spotify feature in Phoniebox should be done in #1835.
As of today there’s no solution yet.
The previously used mopidy-spotify implementation seems to make some progress, but no solution yet:
https://github.com/mopidy/mopidy-spotify/issues/110

Hey all,
while this is not yet a perfect solution I got spotify working again on phoniebox.
The solution is based on the thread referenced by @s-martin.
Major thanks goes to all the contributors in the https://github.com/mopidy/mopidy-spotify/issues/110 thread.
be advised: The solution requires some minor code changes and compilation of one software module , so you should have some basic Linux knowledge to apply the workaround.
I've applied the solution on a Raspberry Pi 4 and slight adjustments might be necessary on older PIs due to the different ARM-architecture.
What did I do to get the solution working:

Download and install a precompiled version of the so-called spotify url handler for gstreamer. This is a specific version of the handler as it was adjusted to be mopidy compliant.

wget https://github.com/mopidy/mopidy-spotify/files/9176522/gst-plugin-spotify_0.9.0_armhf.deb.zip
unzip https://github.com/mopidy/mopidy-spotify/files/9176522/gst-plugin-spotify_0.9.0_armhf.deb.zip
sudo dpkg -i gst-plugin-spotify_0.9.0_armhf.deb
sudo ln -s /usr/lib/libgstspotify.so /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstspotify.so

A restart may be needed to get the plugin working.

Now you should be able to test the gstreamer spotify implementation using the commandline interface:
gst-launch-1.0 spotifyaudiosrc username=<Username> password=<Password> track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink

You need your regular credentials here not any API or application keys.

Download and extract the source code of the mopidy-spotify version created by Kingosticks. Here i used the branch gstspotifysrc-hack. Please be aware this is work in progress and implementation may not be stable yet

wget https://github.com/kingosticks/mopidy-spotify/archive/refs/heads/gstspotifysrc-hack.zip
unzip gstspotifysrc-hack.zip
cd mopidy-spotify-gstspotifysrc-hack

Modify the source code you just downloaded to hardcode the credentials
`vi ./mopidy_spotify/backend.py``

Almost at the end of the file you will find the following code:
class SpotifyPlaybackProvider(backend.PlaybackProvider):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        username = self.backend._config["spotify"]["username"]
        password = self.backend._config["spotify"]["password"]
        self._auth_string = f"username={username}&password={password}"

I simply replaced the username and password logic with hardcoded values:
class SpotifyPlaybackProvider(backend.PlaybackProvider):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        username = MySpotify@email.com
        password = MyHardToBreakPassword123!
        self._auth_string = f"username={username}&password={password}"

Remove the exising installation of mopidy-spotify which is no longer working
`sudo apt-get remove mopidy-spotify'

Compile and install the new mopidy-spotify

cd..
sudo python3 -m pip install .

You may need to install pip to execute the compile command.
This can be done via apt:
sudo apt-get install python3-pip
That's it. After applying all this changes I was able to use the spotify feature of the phoniebox again.
Even though there are some limitations right now which may especially affect those of you using phoniebox for Audiobooks.
Currently the implementation only supports Play and Pause you cannot fast forward within a track and you cannot resume a track where you stopped. This hopefully comes at a later stage.
My little boy is very happy now as the PhonieBox is back in action...
I appreciate any feedback if this was helpful and if the approach worked for you as well.

Hey all,
while this is not yet a perfect solution I got spotify working again on phoniebox. The solution is based on the thread referenced by @s-martin. Major thanks goes to all the contributors in the https://github.com/mopidy/mopidy-spotify/issues/110 thread.
be advised: The solution requires some minor code changes and compilation of one software module , so you should have some basic Linux knowledge to apply the workaround. I've applied the solution on a Raspberry Pi 4 and slight adjustments might be necessary on older PIs due to the different ARM-architecture.
What did I do to get the solution working:

Download and install a precompiled version of the so-called spotify url handler for gstreamer. This is a specific version of the handler as it was adjusted to be mopidy compliant.

wget https://github.com/mopidy/mopidy-spotify/files/9176522/gst-plugin-spotify_0.9.0_armhf.deb.zip
unzip gst-plugin-spotify_0.9.0_armhf.deb.zip
sudo dpkg -i gst-plugin-spotify_0.9.0_armhf.deb
sudo ln -s /usr/lib/libgstspotify.so /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstspotify.so

A restart may be needed to get the plugin working.

Now you should be able to test the gstreamer spotify implementation using the commandline interface:
gst-launch-1.0 spotifyaudiosrc username=<Username> password=<Password> track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink

You need your regular credentials here not any API or application keys.

Download and extract the source code of the mopidy-spotify version created by Kingosticks. Here i used the branch gstspotifysrc-hack. Please be aware this is work in progress and implementation may not be stable yet

wget https://github.com/kingosticks/mopidy-spotify/archive/refs/heads/gstspotifysrc-hack.zip
unzip gstspotifysrc-hack.zip
cd mopidy-spotify-gstspotifysrc-hack

Modify the source code you just downloaded to hardcode the credentials
vi ./mopidy_spotify/backend.py

Almost at the end of the file you will find the following code:
class SpotifyPlaybackProvider(backend.PlaybackProvider):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        username = self.backend._config["spotify"]["username"]
        password = self.backend._config["spotify"]["password"]
        self._auth_string = f"username={username}&password={password}"

I simply replaced the username and password logic with hardcoded values:
class SpotifyPlaybackProvider(backend.PlaybackProvider):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        username = MySpotify@email.com
        password = MyHardToBreakPassword123!
        self._auth_string = f"username={username}&password={password}"

Remove the exising installation of mopidy-spotify which is no longer working
sudo apt-get remove mopidy-spotify
Compile and install the new mopidy-spotify

sudo python3 -m pip install .

You may need to install pip to execute the compile command. This can be done via apt: sudo apt-get install python3-pip
That's it. After applying all this changes I was able to use the spotify feature of the phoniebox again. Even though there are some limitations right now which may especially affect those of you using phoniebox for Audiobooks. Currently the implementation only supports Play and Pause you cannot fast forward within a track and you cannot resume a track where you stopped. This hopefully comes at a later stage.
My little boy is very happy now as the PhonieBox is back in action...
I appreciate any feedback if this was helpful and if the approach worked for you as well.

Thanks for this! Has anyone tried if this works on a pi 3B?

Thanks for this! Has anyone tried if this works on a pi 3B?

Yep. Did this earlier today. Works!

Many thanks for all to all the contributors! :-)
3 additional Points:

I had some porblems cause i used the Spotify User Name and not the E-Mail.

the Email and Password must be in " "

the Spotify password is not allowed to have # in it cause of fstring.

It runs and i hope somebody will find a solution for playing playlists... At the moment there is a long time gab between the songs.

Has anyone tested this for the raspberry zero? My phonieboxes both sadly need the small version.

Also working for me on a raspi 3b on buster. Trying this on some older phoniebox which still runs on stretch sent me directly into the dependency hell. Guess I will need to perform a dist upgrade first.
Thanks to all contributers!

Glad to see the community came up with a workaround.
We will look into it and check, if that can be integrated and how stable it is.

Modify the source code you just downloaded to hardcode the credentials
vi ./mopidy_spotify/backend.py

Almost at the end of the file you will find the following code:
class SpotifyPlaybackProvider(backend.PlaybackProvider):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        username = self.backend._config["spotify"]["username"]
        password = self.backend._config["spotify"]["password"]
        self._auth_string = f"username={username}&password={password}"

I simply replaced the username and password logic with hardcoded values:
class SpotifyPlaybackProvider(backend.PlaybackProvider):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        username = “MySpotify@email.com”
        password = “MyHardToBreakPassword123!”
        self._auth_string = f"username={username}&password={password}"

I'm not sure why this is necessary, though.
From my point of view the modified plugin should be able to grab the Spotify credentials from the usual config location. Maybe worth to look into that.

From my point of view the modified plugin should be able to grab the Spotify credentials from the usual config location. Maybe worth to look into that.

Guess I can confirm this, s-martin! I followed the steps of the workaround as described, but still phoniebox was not able to playback from spotify until I changed the credentials in the mopidy conf.

It runs and i hope somebody will find a solution for playing playlists... At the moment there is a long time gab between the songs.

I read about delays before playback starts in the mopidy-spotify issue thread as well. At least for my RPI4 / RPI3B installation I can confirm playback, skip forward and skip back are working without any delay.

From my point of view the modified plugin should be able to grab the Spotify credentials from the usual config location. Maybe worth to look into that.

Would be super if we could get it working like this. I gave it a lot of trial and error attempts to but always ended up with an mopidy error:
error=GLib.Error('Could not get/set settings from/on resource.', 'gst-resource-error-quark', 13) debug='audio/spotify/src/spotifyaudiosrc/imp.rs(280): gstspotify::spotifyaudiosrc::imp (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstSpotifyAudioSrc:source:\nLogin failed with reason: Bad credentials'
I also spent hours and hours in compiling a new version of gstreamer (1.20) as this is not shipped with buster and build process has a mass of dependencies. Finally I gave the credential overwrite a try and it worked immediatly.
Some of you with more insights on architecture should get into this to find a better approach.

A hash in the config file denotes a comment, i.e the text following the hash character is ignored. If I remember correctly, you can avoid that by surrounding your value in quotes:
password = "my#password"

There's no reason this would be different between the old (broken) version of Mopidy-Spotify and this hacked-up workaround version.

Works like a charme! Many thanks to @MrStrategy !!!
I just followed the steps, used my "USERNAME" not Email and "Password". I just was able to use the existing Phoniebox installation with all the associated cards, with no issues and no degradation of functions!
The only hint.. I'd like to recommend to be prepared while using part 2:
_```
Now you should be able to test the gstreamer spotify implementation using the commandline interface:
gst-launch-1.0 spotifyaudiosrc username= password= track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink

The test went ok, but with FULL volume and basically caused injuries while neighbors were falling out of their bed! ;-)

Cheers!

Modifying the 2nd Phoniebox also turned out to have a problem playing from Spotify until I changed mopidy.conf with the correct authentication credentials!

Guess I can confirm this, s-martin! I followed the steps of the workaround as described, but still phoniebox was not able to playback from spotify until I changed the credentials in the mopidy conf.

If  you need to re-authenticate, here is the mopidy authentication link: https://mopidy.com/ext/spotify/#authentication
Just put in your client_id and client_secret, plus username and password and it should work!

Hey all,
while this is not yet a perfect solution I got spotify working again on phoniebox. The solution is based on the thread referenced by @s-martin. Major thanks goes to all the contributors in the https://github.com/mopidy/mopidy-spotify/issues/110 thread.
be advised: The solution requires some minor code changes and compilation of one software module , so you should have some basic Linux knowledge to apply the workaround. I've applied the solution on a Raspberry Pi 4 and slight adjustments might be necessary on older PIs due to the different ARM-architecture.
What did I do to get the solution working:

Download and install a precompiled version of the so-called spotify url handler for gstreamer. This is a specific version of the handler as it was adjusted to be mopidy compliant.

wget https://github.com/mopidy/mopidy-spotify/files/9176522/gst-plugin-spotify_0.9.0_armhf.deb.zip
unzip gst-plugin-spotify_0.9.0_armhf.deb.zip
sudo dpkg -i gst-plugin-spotify_0.9.0_armhf.deb
sudo ln -s /usr/lib/libgstspotify.so /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstspotify.so

A restart may be needed to get the plugin working.

Now you should be able to test the gstreamer spotify implementation using the commandline interface:
gst-launch-1.0 spotifyaudiosrc username=<Username> password=<Password> track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink

You need your regular credentials here not any API or application keys.

Download and extract the source code of the mopidy-spotify version created by Kingosticks. Here i used the branch gstspotifysrc-hack. Please be aware this is work in progress and implementation may not be stable yet

wget https://github.com/kingosticks/mopidy-spotify/archive/refs/heads/gstspotifysrc-hack.zip
unzip gstspotifysrc-hack.zip
cd mopidy-spotify-gstspotifysrc-hack

Modify the source code you just downloaded to hardcode the credentials
vi ./mopidy_spotify/backend.py

Almost at the end of the file you will find the following code:
class SpotifyPlaybackProvider(backend.PlaybackProvider):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        username = self.backend._config["spotify"]["username"]
        password = self.backend._config["spotify"]["password"]
        self._auth_string = f"username={username}&password={password}"

I simply replaced the username and password logic with hardcoded values:
class SpotifyPlaybackProvider(backend.PlaybackProvider):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        username = “MySpotify@email.com”
        password = “MyHardToBreakPassword123!”
        self._auth_string = f"username={username}&password={password}"

Remove the exising installation of mopidy-spotify which is no longer working
sudo apt-get remove mopidy-spotify
Compile and install the new mopidy-spotify

sudo python3 -m pip install .

You may need to install pip to execute the compile command. This can be done via apt: sudo apt-get install python3-pip
That's it. After applying all this changes I was able to use the spotify feature of the phoniebox again. Even though there are some limitations right now which may especially affect those of you using phoniebox for Audiobooks. Currently the implementation only supports Play and Pause you cannot fast forward within a track and you cannot resume a track where you stopped. This hopefully comes at a later stage.
My little boy is very happy now as the PhonieBox is back in action...
I appreciate any feedback if this was helpful and if the approach worked for you as well.

Wow, thank you very much for that workaround and sharing it here with lots of deperate parents, who had sad kids from the day on their boxes did not work anymore like they used to do.
When I followed your walkthrough, I noticed, that the following section was not in the code anymore:

class SpotifyPlaybackProvider(backend.PlaybackProvider):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
username = self.backend._config["spotify"]["username"]
password = self.backend._config["spotify"]["password"]
self._auth_string = f"username={username}&password={password}"

I simply replaced the username and password logic with hardcoded values:

class SpotifyPlaybackProvider(backend.PlaybackProvider):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
username = “MySpotify@email.com”
password = “MyHardToBreakPassword123!”
self._auth_string = f"username={username}&password={password}"

I still tried to set it up following the other steps and also updated the mopidy.conf at "/etc/mopidy/mopidy.conf" via new authentication details. It did not work out.
I noticed, that the developer kingosticks has just worked on his project, you are pulling the source code from, and exactly that crucial piece of code changed. With that change, you cannot hardcode the username and password as described in your guide by pulling the newest branch commit.
So in order to follow the procedure of you, which results in a working setup, you need to change step 4 from :

Download and extract the source code of the mopidy-spotify version created by Kingosticks. Here i used the branch gstspotifysrc-hack. Please be aware this is work in progress and implementation may not be stable yet

wget https://github.com/kingosticks/mopidy-spotify/archive/refs/heads/gstspotifysrc-hack.zip
unzip gstspotifysrc-hack.zip
cd mopidy-spotify-gstspotifysrc-hack

to

Download and extract the source code of the mopidy-spotify version created by Kingosticks. Here i used the branch gstspotifysrc-hack. Please be aware this is work in progress and implementation may not be stable yet

wget https://github.com/kingosticks/mopidy-spotify/archive/ed98d03e47d3b9c008d7463612124a90af5cf017.zip
unzip ed98d03e47d3b9c008d7463612124a90af5cf017.zip
cd mopidy-spotify-unzip ed98d03e47d3b9c008d7463612124a90af5cf017

This will pull the commit that was the leading one, when the workaround guide was published.
With that special commit everything worked like a charm.
So thank you very much!!!
Kind regars
Eric

Hello people,
I have a question about the hack written here by @CallMeErc  and @Hamsert.
I can't get the hack to work for me. I can not play Spotify songs or album in Mopidy as well as in Phoniebox.
I can only call it from the command line with gst
gst-launch-1.0 spotifyaudiosrc username=<Username> password=<Password> track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink
Which Mopidy and Phoniebox versions do you use that it works?
And can you play whole albums with gst?
My version is:
Pi 3B
Phoniebox - 2.2 - 305325d - master
thanks a lot

Hello people,
I have a question about the hack written here by @CallMeErc and @Hamsert. I can't get the hack to work for me. I can not play Spotify songs or album in Mopidy as well as in Phoniebox. I can only call it from the command line with gst:
gst-launch-1.0 spotifyaudiosrc username=<Username> password=<Password> track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink
Which Mopidy and Phoniebox versions do you use that it works? And can you play whole albums with gst? My version is: Pi 3B Phoniebox - 2.2 - 305325d - master
thanks a lot

for me the above mentioned guide does also not work. i think i have a similar issue like @tulpenwase
i followed the tip from @CallMeErc as well.
Mopidy seems not to run, even after the installation of the new mopidy hack. In Iris, i see the following info-box.

Maybe an idea for instruction could be:
`pi@raspberrypi:~/mopidy-spotify-ed98d03e47d3b9c008d7463612124a90af5cf017 $ sudo systemctl restart mopidy.service
pi@raspberrypi:~/mopidy-spotify-ed98d03e47d3b9c008d7463612124a90af5cf017 $ sudo journalctl -f -u mopidy
-- Logs begin at Sun 2022-10-09 05:52:58 BST. --
Oct 09 06:04:01 raspberrypi systemd[1]: Stopping Mopidy music server...
Oct 09 06:04:01 raspberrypi mopidy[10478]: INFO     [IrisFrontend-10] mopidy_iris.core Stopping Iris
Oct 09 06:04:01 raspberrypi mopidy[10478]: INFO     [MainThread] mopidy.commands Stopping Mopidy core
Oct 09 06:04:01 raspberrypi mopidy[10478]: INFO     [MainThread] mopidy.commands Stopping Mopidy backends
Oct 09 06:04:01 raspberrypi mopidy[10478]: INFO     [MainThread] mopidy.commands Stopping Mopidy audio
Oct 09 06:04:01 raspberrypi mopidy[10478]: INFO     [MainThread] mopidy.commands Stopping Mopidy mixer
Oct 09 06:04:01 raspberrypi systemd[1]: mopidy.service: Succeeded.
Oct 09 06:04:01 raspberrypi systemd[1]: Stopped Mopidy music server.
Oct 09 06:04:01 raspberrypi systemd[1]: Starting Mopidy music server...
Oct 09 06:04:01 raspberrypi systemd[1]: Started Mopidy music server.
Oct 09 06:04:05 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.main Starting Mopidy 3.1.1
Oct 09 06:04:05 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.config Loading config from builtin defaults
Oct 09 06:04:05 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf
Oct 09 06:04:05 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy-local.conf
Oct 09 06:04:05 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf
Oct 09 06:04:05 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.config Loading config from command line options
Oct 09 06:04:05 raspberrypi mopidy[14746]: ERROR    [MainThread] mopidy.internal.log Loading logging config '/etc/mopidy/logging.conf' failed. 'formatters'
Oct 09 06:04:07 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.main Enabled extensions: file, mpd, http, iris, spotify, local, stream, m3u, softwaremixer
Oct 09 06:04:07 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.main Disabled extensions: none
Oct 09 06:04:07 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer
Oct 09 06:04:07 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.commands Mixer volume set to 30
Oct 09 06:04:07 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.commands Starting Mopidy audio
Oct 09 06:04:07 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.commands Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, SpotifyBackend, LocalBackend
Oct 09 06:04:07 raspberrypi mopidy[14746]: ERROR    [MainThread] mopidy.commands Got un-handled exception from SpotifyBackend
Oct 09 06:04:07 raspberrypi mopidy[14746]: Traceback (most recent call last):
Oct 09 06:04:07 raspberrypi mopidy[14746]:   File "/usr/local/lib/python3.7/dist-packages/mopidy/commands.py", line 241, in _actor_error_handling
Oct 09 06:04:07 raspberrypi mopidy[14746]:     yield
Oct 09 06:04:07 raspberrypi mopidy[14746]:   File "/usr/local/lib/python3.7/dist-packages/mopidy/commands.py", line 406, in start_backends
Oct 09 06:04:07 raspberrypi mopidy[14746]:     config=config, audio=audio
Oct 09 06:04:07 raspberrypi mopidy[14746]:   File "/usr/local/lib/python3.7/dist-packages/pykka/_actor.py", line 91, in start
Oct 09 06:04:07 raspberrypi mopidy[14746]:     obj = cls(*args, **kwargs)
Oct 09 06:04:07 raspberrypi mopidy[14746]:   File "/usr/local/lib/python3.7/dist-packages/mopidy_spotify/backend.py", line 24, in init
Oct 09 06:04:07 raspberrypi mopidy[14746]:     self.playback = SpotifyPlaybackProvider(audio=audio, backend=self)
Oct 09 06:04:07 raspberrypi mopidy[14746]:   File "/usr/local/lib/python3.7/dist-packages/mopidy_spotify/backend.py", line 46, in init
Oct 09 06:04:07 raspberrypi mopidy[14746]:     username = self.backend._config["spotify"]["vitaminrv@gmx.de"]
Oct 09 06:04:07 raspberrypi mopidy[14746]:   File "/usr/local/lib/python3.7/dist-packages/mopidy/config/init.py", line 312, in getitem
Oct 09 06:04:07 raspberrypi mopidy[14746]:     item = self._data.getitem(key)
Oct 09 06:04:07 raspberrypi mopidy[14746]: KeyError: 'vitaminrv@gmx.de'
Oct 09 06:04:07 raspberrypi mopidy[14746]: INFO     [Audio-2] mopidy.audio.actor Audio output set to "alsasink"
Oct 09 06:04:07 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.commands Starting Mopidy core
Oct 09 06:04:08 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.commands Starting Mopidy frontends: HttpFrontend, IrisFrontend, MpdFrontend
Oct 09 06:04:08 raspberrypi mopidy[14746]: INFO     [HttpFrontend-9] mopidy.http.actor HTTP server running at [::ffff:0.0.0.0]:6680
Oct 09 06:04:08 raspberrypi mopidy[14746]: INFO     [IrisFrontend-10] mopidy_iris.core Starting Iris 3.45.0
Oct 09 06:04:08 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy_mpd.actor MPD server running at [::ffff:0.0.0.0]:6600
Oct 09 06:04:08 raspberrypi mopidy[14746]: INFO     [MainThread] mopidy.commands Starting GLib mainloop
Oct 09 06:04:09 raspberrypi mopidy[14746]: INFO     [MpdSession-12] mopidy_mpd.session New MPD connection from [::ffff:127.0.0.1]:56862
`
Many thanks!

I made it work again, many thanks for the instructions @MrStrategy
I solved my own mentioned issue some (see last post) by getting new credentials from mopidy from https://www.mopidy.com/authenticate  and entering these credentials in /etc/mopidy/mopidy.conf under spotifysection.
Cheers!

After all the positive feedback I tried the fix from @MrStrategy today but unfortunately my box still isn't playing Spotify content (I installed the version mentioned by @CallMeErc).
All the steps were successful. Is there any log I can provide so you could assist me?
apt list --installed doesn't show a mopidy-spotify, is that normal?
Thanks in advance!

@Hamsert have you tried to re-authenticate? I jut had an issue too and it worked for me like this: https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1815#issuecomment-1232808806

@Hamsert have you tried to re-authenticate? I jut had an issue too and it worked for me like this: #1815 (comment)

Yes I've tried that, didn't work.

@Hamsert Did the command line test work playing form Spotify? Step 2

@Hamsert Did the command line test work playing form Spotify? Step 2

Yes that worked.

Hey,
while trying to get spotify working i made two observations regarding the sollution posted b @MrStrategy and @CallMeErc
When i first tried to get the test command to run, i got the following error messagen:

WARNING: erroneous pipeline: no element "spotifyaudiosrc"
I figured out that this was caused by the gst-plugin-spotify_0.9.0_armhf.deb package installing the library libgstspotify.so to /usr/lib/ rather than /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/ where at least in my system gstreamer expects its plugins. A symbolic link fixed the issue

After getting this to work i made another observation regarding user authentification: the test command worked, but phoniebox sill did not play anything. I figured out that the mopidy-spotify lib uses the URI handler to command gstreamer and therefore checked the other test command mentioned here https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/audio/spotify
gst-launch-1.0 playbin3 uri=spotify:track:3i3P1mGpV9eRlfKccjDjwi?username=$USERNAME\&password=$PASSWORD\&cache-credentials=cache\&cache-files=cache
This failed as well, but i was able to make it run by changing my password to a password without # characters. These characters seem to be handled incorrect using the URI API.
Hope this may be help some other guys getting spotify back to work on their boxes.

URI parameters must always be urlencoded.

After doing the fix, apt list --installed doesn't show a mopidy-spotify, is that normal?
Unfortunately my Box still isn't working, test command worked. Is there anything I can provide so you could assist me?
Thanks in advance!

My Suggestion: Use Version 2 with DownOnSpot to download mp3s until there is a reliable fix available... and i doubt this will be soon

After doing the fix, apt list --installed doesn't show a mopidy-spotify, is that normal? Unfortunately my Box still isn't working, test command worked. Is there anything I can provide so you could assist me? Thanks in advance!

I also have no mopidy spotify in this list. Maybe its because of the manual install via pip? Can you check if mopidy is running in the phoniebox info? For me it seems I have to start it by hand. And when its started everything works. But I'm still investigating.

After doing the fix, apt list --installed doesn't show a mopidy-spotify, is that normal? Unfortunately my Box still isn't working, test command worked. Is there anything I can provide so you could assist me? Thanks in advance!

I also have no mopidy spotify in this list. Maybe its because of the manual install via pip? Can you check if mopidy is running in the phoniebox info? For me it seems I have to start it by hand. And when its started everything works. But I'm still investigating.

Can you please explain me how to check it it is running and how to start it?
Thanks in advance.

I'm running an older Version of the Phoniebox set up 2020
Version2.0 rc7
EditionPlus Edition (feat. Spotify Integration)
on
Raspbian GNU/Linux 10 (buster)
Release10
SInce then, I (and my kids) were happy with a working phoniebox with spotify.
Up until this bad day...
So I followed the suggested fix.
When I came to step
sudo apt-get remove mopidy-spotify
I got:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'mopidy-spotify' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 16 not upgraded.
Nevertheless, I continued with the
sudo python3 -m pip install .
which did something and there was no error.
Unfortunatly, it is not working.
on my dir /home/pi
I find 2 mopidy-spotify folders:
mopidy-spotify (the old one)
mopidy-spotify-ed98d03e47d3b9c008d7463612124a90af5cf017 (the new one)
I have no idea which one is the "active" one and how I can tell, if the phoniebox uses the right, new one.
sudo systemctl status mopidy
gets me
Loaded: loaded (/lib/systemd/system/mopidy.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2022-11-01 19:56:36 GMT; 6min ago
  Process: 545 ExecStartPre=/bin/mkdir -p /var/cache/mopidy (code=exited, status=0/SUCCESS)
  Process: 560 ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy (code=exited, status=0/SUCCESS)
Main PID: 561 (mopidy)
    Tasks: 17 (limit: 2200)
  Memory: 54.6M
   CGroup: /system.slice/mopidy.service
           └─561 /usr/bin/python2 /usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf
Any help would be much appreciated.

After doing the fix, apt list --installed doesn't show a mopidy-spotify, is that normal? Unfortunately my Box still isn't working, test command worked. Is there anything I can provide so you could assist me? Thanks in advance!

I also have no mopidy spotify in this list. Maybe its because of the manual install via pip? Can you check if mopidy is running in the phoniebox info? For me it seems I have to start it by hand. And when its started everything works. But I'm still investigating.

Can you please explain me how to check it it is running and how to start it?
Thanks in advance.

you can see it in the info section on the phoniebox web intercace or type
sudo service mopidy status
if its not running type
sudo dpkg-reconfigure mopidy
and chose yes to make sure its running at start (for me it was the problem it somehow didnt start automatically anymore)
then reboot

I'm running an older Version of the Phoniebox set up 2020 Version2.0 rc7 EditionPlus Edition (feat. Spotify Integration) on Raspbian GNU/Linux 10 (buster) Release10
SInce then, I (and my kids) were happy with a working phoniebox with spotify. Up until this bad day... I am kind of new to all this Pi and GitHub and was happy not to touch the running system.
However, I followed the suggested fix. When I came to step sudo apt-get remove mopidy-spotify I got: Reading package lists... Done Building dependency tree Reading state information... Done Package 'mopidy-spotify' is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 16 not upgraded.
Nevertheless, I continued with the sudo python3 -m pip install . which did something and there was no error.
Unfortunatly, it is not working. on my dir /home/pi I find 2 mopidy-spotify folders: mopidy-spotify (the old one) mopidy-spotify-ed98d03e47d3b9c008d7463612124a90af5cf017 (the new one) I have no idea which one is the "active" one and how I can tell, if the phoniebox uses the right, new one.
sudo systemctl status mopidy gets me Loaded: loaded (/lib/systemd/system/mopidy.service; enabled; vendor preset: enabled)  Active: active (running) since Tue 2022-11-01 19:56:36 GMT; 6min ago  Process: 545 ExecStartPre=/bin/mkdir -p /var/cache/mopidy (code=exited, status=0/SUCCESS)  Process: 560 ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy (code=exited, status=0/SUCCESS) Main PID: 561 (mopidy)  Tasks: 17 (limit: 2200)  Memory: 54.6M  CGroup: /system.slice/mopidy.service  └─561 /usr/bin/python2 /usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf
Any help would be much appreciated.

I have no idea what is wrong at your end. The test command does work and play the music?
In your log I see mopidy is running on python2. Maybe you need to use python2 also in the pip install command.
But this is just a thought I'm not really deep into python stuff.

Has anyone tested this for the raspberry zero? My phonieboxes both sadly need the small version.

Didn't work for me on raspberrypiZero. I have the Raspberry Pi Zero W Rev 1.1.
After downloading and installing the gstreamer-plugin from

https://github.com/mopidy/mopidy-spotify/files/9176522/gst-plugin-spotify_0.9.0_armhf.deb.zip
it is blacklisted.

Checking the plugin with GST_DEBUG=4 gst-inspect-1.0 /usr/lib/libgstspotify.so shows the following output:

Does anyone have an idea?

Thanks a lot for everyone that put a lot of work into this project. I wish I would not have to write here but my coding skills are limited.
I tried installing Jukebox 2.3 (because I want to have Spotify included) through the installation command as described the wiki
cd; rm buster-install-*; wget https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/master/scripts/installscripts/buster-install-default.sh; chmod +x buster-install-default.sh; ./buster-install-default.sh
Tried it on a clean install of Buster lite on a 3B+ with the workaround described from @CallMeErc but did not have any success and getting problems already at Step 2.
Testing the following command:
gst-launch-1.0 spotifyaudiosrc username=<Username> password=<Password> track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink
Running into the error:
gst-launch-1.0: command not found
which indicates that gstreamer is not installed, right?
when I ran the installation I ran into a lot of mopidy errors, which I was expecting upfront.
I was really looking forward to building a phoniebox, had it on my to-do list for quite some time :(
So sad that the Spotify integration is not working out of the box anymore.
Not a big fan of the screen interface of the Mupibox (which has a working Spotify integration) and was looking for a no screen version with simple buttons instead.
Does anyone have a solution for a fresh install of Jukebox2.3 (or even 3.0) with a working Spotify integration?

It has been silent in this thread for a while. I just want to encourage anyone who is missing the spotify integration to give the manual installation a try, it works for me:

Perform the "regular" "one-line-install" of Jukebox 2.* as described in the wiki
Uninstall the mopidy-spotify extension that (probably?) was installed, with sudo apt-get remove mopidy-spotify
Follow the steps described in the readme of mopidy-spotify to manually build gst-plugins-spotify on your raspberry pi: https://github.com/mopidy/mopidy-spotify#dependencies

It may look intimidating, but you just copy-and-paste the commands and it worked for me (finished the build process in something like 30 minutes)
I had to perform sudo apt-get update before running the apt install command
I only changed one other thing from the steps in the readme: I used the command cargo build --package gst-plugin-spotify --release -j1 , as was recommended in disussions here

Install the current master version of mopidy-spotify with sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/master.zip
Reboot your raspberry pi

Now spotify integration seems to work fine on my raspberry pi 3b with raspbian bullseye!

Thanks @jnettels for your nice guide, unfortunately I still ran into some issue. As I always find it easier to follow a complete guide, I decided to create one and post it here. So you don't have to jump between different guides/wikis etc.
1. Raspberry Pi OS Bullseye
Use Bullseye, as this ships with Python 3.9, which is needed to build the mopidy-spotify extension. And manually upgrading Python is just a pain in the ass.
2. Add mopidy GPG key
If you don't add the mopidy GPG key, the Phoniebox installation will throw some errors (which actually may get unnoticed) and you'll probably end up with a broken installation.
sudo mkdir -p /etc/apt/keyrings
sudo wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/bullseye.list
sudo apt update

Source: https://docs.mopidy.com/en/latest/installation/debian
3. Install Phoniebox
cd; rm buster-install-*; wget https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/master/scripts/installscripts/buster-install-default.sh; chmod +x buster-install-default.sh; ./buster-install-default.sh

Source: https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/INSTALL-stretch#one-line-install-command
4. Remove default mopidy installation
sudo apt remove mopidy-spotify
5. Install mopidy-spotify extension
5.1. Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Don’t forget to source it (see last line of install output)
source "$HOME/.cargo/env"
5.2. Install GStreamer dependencies
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gcc pkg-config git
5.3. Install gst-plugins-spotify
git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
cd gst-plugins-rs
cargo build --package gst-plugin-spotify --release -j1
sudo install -m 644 target/release/libgstspotify.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/

5.4. Verify installation
gst-inspect-1.0 spotify
5.5. Install latest version of mopidy-spotify extension
sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/master.zip
Source: https://github.com/mopidy/mopidy-spotify#dependencies

Troubleshooting
Check mopidy config/extensions
sudo mopidyctl config
If mopidy-spotify could not be loaded, you'll see this line

WARNING  [MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found

Display logs for debug
Will display e.g. Spotify authentication issues, so just keep this running while (re)starting mopidy.
journalctl -u mopidy -f
Restart mopidy
Make changes from mopidy.conf take effect.
systemctl restart mopidy
mopidy.conf
You definitely want to use /etc/mopidy/mopidy.conf file. The one inside your users dir is not being used when mopidy runs as a service (which it does here).
Make sure to have the correct credentials set. You absolutely need username, password, client_id and client_secret.
It will look like it is working with client_id and client_secret alone, but won't play any songs (no error in the GUI, just won't work).

Kudos to you @d4rkd3v1l ! I startet with a fresh, empty SD Card and it works!

Anyone interested in writing a PR, which integrates these steps in https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/develop/scripts/installscripts/buster-install-default.sh ?
Be aware there are multiple places in this script, which handle Spotify specific stuff.

Awesome, finally it works again! Thank you to everyone involved in this solution. So is this a way of integrating Spotify suitable for the future Phoniebox versions?

Thanks, @d4rkd3v1l ! Unfortunately, https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs is offline at the moment. Is there another source for the plugin e.g. https://github.com/sdroege/gst-plugin-rs or is this something different?
Thanks in advance!

Everything at https://gitlab.freedesktop.org is down, supposedly for maintenance. Even if you had a copy of gst-plugin-rs, you'd be unable to fetch the dependencies that are also hosted there e.g. https://gitlab.freedesktop.org/gstreamer/gstreamer-rs. Hopefully it'll all be back tomorrow and I'll finally get some RPi-compatable gst-plugin-spotify binaries uploaded this week, it's long overdue.

FYI it's back online.

Same here!
I have tried on a fresh Bullseye install with a Pi4. After installing with the phoniebox install-script, the mopidy-spotify integration was missing, so there was nothing to remove actually.
I was not able to get it work following the other steps.
Still trying further to get it solved!

I'm currently going through it step by step since it is clear what is failing there and most of it should be easy to fix. Just filed my findings here interim.
I will work through the setup script today and come up with a merge request once done and working.

If someone would review and merge #2063, I would continue with the Spotify/bullseye changes/fixes discussed here, based on that.
Did not want to change too much in a single MR though ...

In the meantime, I looked into the issues further. There are surprisingly few of the workarounds once introduced by the buster-script still required in bullseye - I introduced some changes (in ADDITION to #2063, which is absolutely required on my Raspberry Pi 3B with 1GB RAM) to the buster-* script. Now, it is running for several hours (Rust and GST plugin compile takes a lot of time!) but it is working for me now!
Please Review (and merge) #2064 to fix the issues found.
In the meantime, if you want to test the install on your own before #2063 and #2064 were merged, please follow these steps for testing:
On a freshly installed Raspberry Pi OS bullseye, execute the following script:
#!/usr/bin/env bash
sudo apt update
sudo apt install -y locales-all

BRANCH="1815_merged_NO_PUSH"
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

sudo apt dist-upgrade -y
sudo apt install -y screen vim git

if [ ! -e "${HOME}/.RPi-Jukebox-RFID" ]; then
    git clone -b "${BRANCH}" https://github.com/The-Judge/RPi-Jukebox-RFID.git "${HOME}/.RPi-Jukebox-RFID"
fi

echo ""
echo "#####################################################################################"
echo ""

export GIT_BRANCH="develop"
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
"${HOME}/.RPi-Jukebox-RFID/scripts/installscripts/buster-install-default.sh"

Feedback welcome!

Thank you!
I have tried your script and get a permission error:

-bash: /home/pi/.RPi-Jukebox-RFID/scripts/installscripts/buster-install-default.sh: Permission denied
I could not find

/home/pi/.RPi-Jukebox-RFID

Thx!
U

Thank you!
I have tried your script and get a permission error:

-bash: /home/pi/.RPi-Jukebox-RFID/scripts/installscripts/buster-install-default.sh: Permission denied

I also could not find the folder:

/home/pi/.RPi-Jukebox-RFID

Thx! U PS: I have changed user rights for the /home folder and was able to execute the phoniebox installer now!

Thx, I added a chmod to my execution instruction before.
The folder you are missing is created by the Git clone.

There's a typo.
Remove the . before RPi

There's a typo.
Remove the . before RPi

No, that's actually on purpose. I do not want that branch to get in conflict with the "real" Repo which is checked out during install. That is why I check the repo out to the "dotted" folder interim-wise, until the Pull Requests are reviewed an merged.

@The-Judge : It works perfectly fine! :-)
I just had the issue with the permission at the first place but then everything ran through! I think this is the new "one_line-installer" of Phoniebox with the Spotify fix everybody was waiting for!
I just added the GPIO/OLED controls and the ON/OFF Shim, copied back my old audio folders and there it is - back in business! :-)
Thank you so much!!!

Thanks for testing and the feedback! 🫶

No, script hasn't changed with the RFID readers section. Must be something else.

Hi Streuerei.
Check out this post I wrote some time ago and even found it's way into the Spotify FAQ.
I too had a funny issue after a completing the fresh install with the new Phoniebox scripts to get Spotify working again.  Similar to your description, everything worked fine basically, but the player wouldn't start after swipping a card. What helped was simply the following: I swipped the card with a Spotify conent, I switched to the "Player" section in the webinterface and hit "Play". The track started, after that, it just worked fine.

@Streuerei  I recently completed the new install with the one line installer from @The-Judge . I am also using the Neuftech RFID reader, GPIO-switches (without illumination) + ON/OFF Shim and an I2C-Display.
You can just follow the original installation process, the Phoniebox installation has not been changed from its original script.
Make sure that the RFID reader and the GPIO controls are activated in the Phoniebox UI and probably reinstall it while selecting the right features - pre-installation. This was  „0“ for „0 HXGCoLtd Keyboard“ which is the Neuftech RFID reader... Modify and activate your controls within: ~/RPi-Jukebox-RFID/settings/gpio_settings.ini  in gpio_settings.ini you just need to "enable" the controls dependent which pins you are using.
Good luck! :-)

Thank you @The-Judge for your efforts :)
Spotify with Iris is running and playing music. I am struggling with GPIO and the RFID Reader. It is the neuftech reader. As there are multiple threads about the issue, I assume it has nothing to do with the updated installation script? It there a way for me to identify if the issue is with the new script or something else?
Reader is making noises and card is shown in command line.

If you still having problems with GPIO and RFID reader, I suggest to open a new issue for that. Otherwise this issue gets cluttered with different problems.

I updated and enhanced the script pasted in https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1815#issuecomment-1709049221 a bit, so it will execute all the long-running things in a detached screen session, automatically.

Thank you @The-Judge for your efforts :)
Spotify with Iris is running and playing music. I am struggling with GPIO and the RFID Reader. It is the neuftech reader. As there are multiple threads about the issue, I assume it has nothing to do with the updated installation script? It there a way for me to identify if the issue is with the new script or something else?
Reader is making noises and card is shown in command line.

If you still having problems with GPIO and RFID reader, I suggest to open a new issue for that. Otherwise this issue gets cluttered with different problems.

Thank you for the feedback.the issue was (of course) with me. I changed the user name to something else than pi. Now I did a fresh install and installation is there with activated RFID reader. Cards are recognised and album cover is loaded.
There is no sound and the track is not loaded (and no error message), but hey: step by step :D

I sincerely have no idea how you're getting this to work. I've tried the 1 line installer on a fresh PI (Buster and Bullseye). I've tried @d4rkd3v1l  method as well with 64 and 32 bit Bullseye with no luck. Help :)
This is from the 1 liner while installing:
"Unable to locate package moped-mpd"
"Unable to locate package moped-local"
"Unable to locate package moped-spotify"
"Unable to locate package libspotify12"
"Unable to locate package python3-spotify"

My script is for Bullseye. As an Image, I used "Raspberry Pi OS 64 Bit Lite" with my Raspberry Pi 3B.
I have a hard time thinking of reasons why this should behave differently from when you execute it versus someone else does. Especially since you share very little context and exact errors.

After 5.3. Install gst-plugins-spotify, I am trying to execute 5.4 gst-inspect-1.0 spotify:
bash: gst-inspect-1.0: command not found.
I'm on raspberry pi 4 with 64bit bullseye

After 5.3. Install gst-plugins-spotify, I am trying to execute 5.4 gst-inspect-1.0 spotify:
bash: gst-inspect-1.0: command not found.
I'm on raspberry pi 4 with 64bit bullseye

Please provide your ~/phoniebox_logs/buster-install-default.sh_*.log in a Gist or similar.

Unfortunately I can't get Spotify to work either.
During the installation I stumbled a bit with the command "5.1. Install rust". Here I had to manually enter the value for “Default host triple” and was then able to complete the installation.
But at point "5.4. Verify installation" the output is "No such element or plugin 'spotify'"
I can play local files in the Phoniebox player.
On the Iris site I am connected to my Spotify account and can also find playlists and tracks. But playing is not possible.
I also get the error "Mopidy: Failed to add some tracks"
Output from "sudo mopidyctl config":
...
[iris]
enabled = true
country = DE
locale = de_DE
spotify_authorization_url = https://jamesbarnsley.co.nz/iris/auth_spotify.php
lastfm_authorization_url = https://jamesbarnsley.co.nz/iris/auth_lastfm.php
genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php
data_dir = $XDG_DATA_DIR/iris
[spotify]
enabled = true
username = XXXXXXX
password = ********
client_id = XXXXXXXXXXXX
client_secret = ********
bitrate = 160
volume_normalization = true
timeout = 10
allow_cache = true
cache_size = 8192
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
...

@The-Judge Thanks for your effort! Spotify stopped working for me a while back. While it might have been an option to reauthenticate via the Iris frontend, I didn't think about that and used your script! I ran into some small issues (nothing related to spotify: gpio not stable --> had to enable the GPIO base service, files not playing --> rescan of library via GUI, RFID shortcuts had spotify link in there before, now it looks like it has to be the path to the folder, ... ).
But: I didn't have to do anything special to get spotify to work! So, thanks a lot for that!
Do you see any chance to support the implementation in V3? I would like to update because stability is not quite that good with V2 for me. I just made a Reboot RFID card because sometimes stuff just stops working and you can only solve it by restarting. Would be great if V3 had spotify, that would be enough for me to try it out! 🎉

In the meantime, I looked into the issues further. There are surprisingly few of the workarounds once introduced by the buster-script still required in bullseye - I introduced some changes (in ADDITION to #2063, which is absolutely required on my Raspberry Pi 3B with 1GB RAM) to the buster-* script. Now, it is running for several hours (Rust and GST plugin compile takes a lot of time!) but it is working for me now!
Please Review (and merge) #2064 to fix the issues found.
In the meantime, if you want to test the install on your own before #2063 and #2064 were merged, please follow these steps for testing:
On a freshly installed Raspberry Pi OS bullseye, execute the following script:
#!/usr/bin/env bash
sudo apt update
sudo apt install -y locales-all screen mawk

# Start the long-running stuff in a screen session, if we are not in one already
#
# We are in a screen session
if test -n "$STY"; then
    BRANCH="1815_merged_NO_PUSH"
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8

    sudo apt dist-upgrade -y
    sudo apt install -y vim git

    if [ ! -e "${HOME}/.RPi-Jukebox-RFID" ]; then
        git clone -b "${BRANCH}" https://github.com/The-Judge/RPi-Jukebox-RFID.git "${HOME}/.RPi-Jukebox-RFID"
    fi

    echo ""
    echo "#####################################################################################"
    echo ""

    export GIT_BRANCH="develop"
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    chmod +x "${HOME}/.RPi-Jukebox-RFID/scripts/installscripts/buster-install-default.sh"
    "${HOME}/.RPi-Jukebox-RFID/scripts/installscripts/buster-install-default.sh"
# We are not in a screen session yet
else
    screen -dmS phonieboxSetup
    SCREEN_SESSION="$(screen -ls | grep phonieboxSetup | head -n 1 | awk '{print $1}')"
    screen -S "${SCREEN_SESSION}" -p 0 -X stuff "$(realpath "${0}") $*$(printf \\r)"
    echo ""
    echo "Install script launched in a new screen session (${SCREEN_SESSION})."
    echo "If you wish to see the scripts output or check the execution status,"
    echo "please attach to the scripts screen session by executing:"
    echo ""
    echo "    screen -r ${SCREEN_SESSION}"
    echo ""
fi

Since the Rust and GST plugin compilation takes a LONG TIME (around 3 hours on my Raspberry Pi 3B 1 GB RAM), please consider starting the script in a screen session, so SSH session interruptions do not cause the process to be interrupted.
Feedback welcome!

Thanks a lot for providing this. Do I need to run this as root / su?

Do you see any chance to support the implementation in V3? I would like to update because stability is not quite that good with V2 for me. I just made a Reboot RFID card because sometimes stuff just stops working and you can only solve it by restarting. Would be great if V3 had spotify, that would be enough for me to try it out! 🎉

To be honest: I am not in this project, really. I just hopped in here to provide a clean way to have v2 installed fine.
Maybe if someone who is just a bit deeper into the project has a different impression, but for me, this project turned more and more chaotic with the start of V3. Docs are timed out, V2 falls apart more and more, and still, no V3 is available with a working Spotify integration (Spotify is an absolute must-have for me!).
Also, since they seem to de-facto re-build this project and not only porting everything to Python and I have a lot of custom integrations with the boxes created already which would break by these changes, I looked into V2, only.
And for the same reasons, I am not planning for V3 support before I even think this might work ...

I have a working spotify installation with a raspberry pi by using https://spotifyd.rs/
I can control it via the gpio pins and buttons in a small python script or via Spotify on a smartphone. The project has build binaries for the raspberry pi, so avoid compiling it on the rpi.

@The-Judge got ya! Thanks anyway! 👍🏻😊

Tried your installation script on a fresh Bullseye 64 bit image, @The-Judge . Thanks a lot for providing it, btw. Installation script went through successfully (as far as I can judge), the rust part took a while but finished. However, I cannot play any spotify sources, nor can I use Iris in order to add tracks to the current playlist ("Mopidy: Failed to add some tracks").
I am refusing to give up at this point, but could use a little help... where would I search for librespot logs?

Have a look at journalctl -u mopidy for logs.
With the switch -n you can define how many lines you want to show.
Feel free to post the logs here as well.
I assume there are some issues with login to mopidy.

I tried to modify the credentials in /etc/mopidy/mopidy.conf, now it gives me
mopidy_spotify.web OAuth token refresh failed: invalid_client Client not known.
Clearly indicating a credential issue here. Which is kind of strange, because I retrieved those values freshly from the spotify developer portal. Will try again later with new creds.

because I retrieved those values freshly from the spotify developer portal.

Those credentials won't work. Get credentials from https://mopidy.com/ext/spotify/

Thanks @jnettels for your nice guide, unfortunately I still ran into some issue. As I always find it easier to follow a complete guide, I decided to create one and post it here. So you don't have to jump between different guides/wikis etc.
1. Raspberry Pi OS Bullseye
Use Bullseye, as this ships with Python 3.9, which is needed to build the mopidy-spotify extension. And manually upgrading Python is just a pain in the ass.
2. Add mopidy GPG key
If you don't add the mopidy GPG key, the Phoniebox installation will throw some errors (which actually may get unnoticed) and you'll probably end up with a broken installation.
sudo mkdir -p /etc/apt/keyrings
sudo wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/bullseye.list
sudo apt update

Source: https://docs.mopidy.com/en/latest/installation/debian
3. Install Phoniebox
cd; rm buster-install-*; wget https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/master/scripts/installscripts/buster-install-default.sh; chmod +x buster-install-default.sh; ./buster-install-default.sh

Source: https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/INSTALL-stretch#one-line-install-command
4. Remove default mopidy installation
sudo apt remove mopidy-spotify
5. Install mopidy-spotify extension
5.1. Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Don’t forget to source it (see last line of install output) source "$HOME/.cargo/env"
5.2. Install GStreamer dependencies
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gcc pkg-config git
5.3. Install gst-plugins-spotify
git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
cd gst-plugins-rs
cargo build --package gst-plugin-spotify --release -j1
sudo install -m 644 target/release/libgstspotify.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/

5.4. Verify installation
gst-inspect-1.0 spotify
5.5. Install latest version of mopidy-spotify extension
sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/master.zip
Source: https://github.com/mopidy/mopidy-spotify#dependencies
Troubleshooting
Check mopidy config/extensions
sudo mopidyctl config
If mopidy-spotify could not be loaded, you'll see this line

WARNING  [MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found

Display logs for debug
Will display e.g. Spotify authentication issues, so just keep this running while (re)starting mopidy. journalctl -u mopidy -f
Restart mopidy
Make changes from mopidy.conf take effect. systemctl restart mopidy
mopidy.conf
You definitely want to use /etc/mopidy/mopidy.conf file. The one inside your users dir is not being used when mopidy runs as a service (which it does here).
Make sure to have the correct credentials set. You absolutely need username, password, client_id and client_secret. It will look like it is working with client_id and client_secret alone, but won't play any songs (no error in the GUI, just won't work).

Hi, I followed the guide by d4rkd3v1l.
Thanks for the great guide, I'm amazed that I got Spotify to work again :- )
I have one issue: Spotify Tracks don't play until I manually restart the service via
systemctl restart mopidy (as shown in trouble shooting).
I have to give my login credentials (pi+password), then the service restarts; then RFID cards and Iris work perfectly.
What am I missing?
I tried to activate wait for network to boot in raspi-config.
I also tried
sudo systemctl enable mopidy
to make sure mopidy starts as service on boot.
But I'm a little lost here as an total beginner. Help would be great.

Thanks @jnettels for your nice guide, unfortunately I still ran into some issue. As I always find it easier to follow a complete guide, I decided to create one and post it here. So you don't have to jump between different guides/wikis etc.
1. Raspberry Pi OS Bullseye
Use Bullseye, as this ships with Python 3.9, which is needed to build the mopidy-spotify extension. And manually upgrading Python is just a pain in the ass.
2. Add mopidy GPG key
If you don't add the mopidy GPG key, the Phoniebox installation will throw some errors (which actually may get unnoticed) and you'll probably end up with a broken installation.
sudo mkdir -p /etc/apt/keyrings
sudo wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/bullseye.list
sudo apt update

Source: https://docs.mopidy.com/en/latest/installation/debian
3. Install Phoniebox
cd; rm buster-install-*; wget https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/master/scripts/installscripts/buster-install-default.sh; chmod +x buster-install-default.sh; ./buster-install-default.sh

Source: https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/INSTALL-stretch#one-line-install-command
4. Remove default mopidy installation
sudo apt remove mopidy-spotify
5. Install mopidy-spotify extension
5.1. Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Don’t forget to source it (see last line of install output) source "$HOME/.cargo/env"
5.2. Install GStreamer dependencies
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gcc pkg-config git
5.3. Install gst-plugins-spotify
git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
cd gst-plugins-rs
cargo build --package gst-plugin-spotify --release -j1
sudo install -m 644 target/release/libgstspotify.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/

5.4. Verify installation
gst-inspect-1.0 spotify
5.5. Install latest version of mopidy-spotify extension
sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/master.zip
Source: https://github.com/mopidy/mopidy-spotify#dependencies
Troubleshooting
Check mopidy config/extensions
sudo mopidyctl config
If mopidy-spotify could not be loaded, you'll see this line

WARNING  [MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found

Display logs for debug
Will display e.g. Spotify authentication issues, so just keep this running while (re)starting mopidy. journalctl -u mopidy -f
Restart mopidy
Make changes from mopidy.conf take effect. systemctl restart mopidy
mopidy.conf
You definitely want to use /etc/mopidy/mopidy.conf file. The one inside your users dir is not being used when mopidy runs as a service (which it does here).
Make sure to have the correct credentials set. You absolutely need username, password, client_id and client_secret. It will look like it is working with client_id and client_secret alone, but won't play any songs (no error in the GUI, just won't work).

i as well want to say many thanks for this great guide!! it perfectly works

I restarted the whole process from scratch; I don't know what I did differently this time; but now it worked perfectly. Thanks for the guide.

Additional info for anyone trying to build it on raspbian 32 bit legacy, but with a pi4 64 bit:
You need to do a custom installation of Rust and, when asked for the default host triple, enter
arm-unknown-linux-gnueabihf

(This is for Raspberry Pi 4. It might be different for other Pi versions)
Before that i was even unable to run cargo --version or rustc --version

Additional Questions: Will future3/develop include spotify?
If not can we somehow make this installation process streamlined for spotify?
Replace the current mopidy process, create something new.
But also something that works with a native latest raspbian os release. As i was unable to do all those steps on the latest os release

I will take some time later today or on the weekend on the status of future3 with regards to Spotify or other streaming services. There are technical boundaries and legal questions that need to be considered.

Additional info for anyone trying to build it on raspbian 32 bit legacy, but with a pi4 64 bit: You need to do a custom installation of Rust and, when asked for the default host triple, enter
arm-unknown-linux-gnueabihf

(This is for Raspberry Pi 4. It might be different for other Pi versions)
Before that i was even unable to run cargo --version or rustc --version

Does setting the kernel also to 32-bit maybe make a difference?
/boot/config.txt -> arm_64bit=0

I will take some time later today or on the weekend on the status of future3 with regards to Spotify or other streaming services. There are technical boundaries and legal questions that need to be considered.

If you have issues/questions regarding the use of Mopidy (or librespot) in the future release than feel free to raise them at the usual places (or privately if necessary). There are now some automated gst-plugin-spotify builds, I don't think there are any major blockers to having it all installable through apt again. This thread has been useful in demonstrating some rough edges that I wasn't hitting.

Thanks @jnettels for your nice guide, unfortunately I still ran into some issue. As I always find it easier to follow a complete guide, I decided to create one and post it here. So you don't have to jump between different guides/wikis etc.
1. Raspberry Pi OS Bullseye
Use Bullseye, as this ships with Python 3.9, which is needed to build the mopidy-spotify extension. And manually upgrading Python is just a pain in the ass.
2. Add mopidy GPG key
If you don't add the mopidy GPG key, the Phoniebox installation will throw some errors (which actually may get unnoticed) and you'll probably end up with a broken installation.
sudo mkdir -p /etc/apt/keyrings
sudo wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/bullseye.list
sudo apt update

Source: https://docs.mopidy.com/en/latest/installation/debian
3. Install Phoniebox
cd; rm buster-install-*; wget https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/master/scripts/installscripts/buster-install-default.sh; chmod +x buster-install-default.sh; ./buster-install-default.sh

Source: https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/INSTALL-stretch#one-line-install-command
4. Remove default mopidy installation
sudo apt remove mopidy-spotify
5. Install mopidy-spotify extension
5.1. Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Don’t forget to source it (see last line of install output) source "$HOME/.cargo/env"
5.2. Install GStreamer dependencies
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gcc pkg-config git
5.3. Install gst-plugins-spotify
git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
cd gst-plugins-rs
cargo build --package gst-plugin-spotify --release -j1
sudo install -m 644 target/release/libgstspotify.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/

5.4. Verify installation
gst-inspect-1.0 spotify
5.5. Install latest version of mopidy-spotify extension
sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/master.zip
Source: https://github.com/mopidy/mopidy-spotify#dependencies
Troubleshooting
Check mopidy config/extensions
sudo mopidyctl config
If mopidy-spotify could not be loaded, you'll see this line

WARNING  [MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found

Display logs for debug
Will display e.g. Spotify authentication issues, so just keep this running while (re)starting mopidy. journalctl -u mopidy -f
Restart mopidy
Make changes from mopidy.conf take effect. systemctl restart mopidy
mopidy.conf
You definitely want to use /etc/mopidy/mopidy.conf file. The one inside your users dir is not being used when mopidy runs as a service (which it does here).
Make sure to have the correct credentials set. You absolutely need username, password, client_id and client_secret. It will look like it is working with client_id and client_secret alone, but won't play any songs (no error in the GUI, just won't work).

Thanks a lot for the great guide!
I have one addition that took me quite a while to solve: I always got the "error: command failed: 'cargo': No such file or directory (os error 2)" when calling the cargo build command (on Raspi 4 which is a 64 bit ARM arch).
I had installed Raspi PI OS Legacy Lite (Bullseye, 32 bit!) and needed to customize the Rust installation when runningcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh. The installer selects 'stable-aarch64-unknown-linux-gnu' per default -- but the OS is on 32 bits! Therefore, I needed to ustomize installation and set the "triple" to 'armv7-unknown-linux-gnueabihf'.
Now, spotify works again - finally!
Thanks again for all your efforts!

I have one addition that took me quite a while to solve: I always got the "error: command failed: 'cargo': No such file or directory (os error 2)" when calling the cargo build command (on Raspi 4 which is a 64 bit ARM arch).
I had installed Raspi PI OS Legacy Lite (Bullseye, 32 bit!) and needed to customize the Rust installation when runningcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh. The installer selects 'stable-aarch64-unknown-linux-gnu' per default -- but the OS is on 32 bits! Therefore, I needed to ustomize installation and set the "triple" to 'armv7-unknown-linux-gnueabihf'.

https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1815#issuecomment-1816263508 ;)

For future3 PR #2164 is laying the ground work for Spotify.
Help is greatly appreciated.

For future3 PR #2164 is laying the ground work for Spotify.
Help is greatly appreciated.

Is anyone else getting errors when trying to play Spotify playlists from rfid tags or the phoniebox UI? These playlists work fine when started from the iris UI. Spotify URIs to albums work fine everywhere.
[SpotifyBackend-6] mopidy_spotify.lookup Failed to lookup Spotify playlist 'spotify:playlist:4xcdTOFwLdZb8G4c5W2h5F': Invalid playlist response

This seems to be related:
https://github.com/mopidy/mopidy-spotify/issues/373
I updated to the latest mopidy-spotify version with the following command, but it did not solve the issue:
sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/main.zip

sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/main.zip

You need also the --upgrade flag
what’s the response of this command?

You need also the --upgrade flag
what’s the response of this command?

Thanks for answering to my question. However, --upgrade does not seem to change anything.
pi@musicpi:~ $ sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/main.zip --upgrade
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting https://github.com/mopidy/mopidy-spotify/archive/main.zip
  Using cached https://github.com/mopidy/mopidy-spotify/archive/main.zip
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: requests>=2.20.0 in /usr/local/lib/python3.9/dist-packages (from Mopidy-Spotify==4.1.1) (2.31.0)
Requirement already satisfied: Mopidy>=3.4.0 in /usr/local/lib/python3.9/dist-packages (from Mopidy-Spotify==4.1.1) (3.4.1)
Requirement already satisfied: setuptools in /usr/local/lib/python3.9/dist-packages (from Mopidy-Spotify==4.1.1) (68.0.0)
Requirement already satisfied: Pykka>=2.0.1 in /usr/local/lib/python3.9/dist-packages (from Mopidy-Spotify==4.1.1) (3.1.1)
Requirement already satisfied: tornado>=4.4 in /usr/local/lib/python3.9/dist-packages (from Mopidy>=3.4.0->Mopidy-Spotify==4.1.1) (6.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/dist-packages (from requests>=2.20.0->Mopidy-Spotify==4.1.1) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests>=2.20.0->Mopidy-Spotify==4.1.1) (2.0.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.9/dist-packages (from requests>=2.20.0->Mopidy-Spotify==4.1.1) (3.1.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/dist-packages (from requests>=2.20.0->Mopidy-Spotify==4.1.1) (2023.5.7)

Afterwards I rebooted by raspberry pi, and then tail /var/log/syslog -n 200 still reveals errors like this when attempting to play playlists:
[SpotifyBackend-6] mopidy_spotify.lookup Failed to lookup Spotify playlist 'spotify:playlist:4xcdTOFwLdZb8G4c5W2h5F': Invalid playlist response

Any other hints?

I think pip wants install options before the path/name.
sudo python3 -m pip install --upgrade https://github.com/mopidy/mopidy-spotify/archive/main.zip

Thanks @jnettels for your nice guide, unfortunately I still ran into some issue. As I always find it easier to follow a complete guide, I decided to create one and post it here. So you don't have to jump between different guides/wikis etc.
1. Raspberry Pi OS Bullseye
Use Bullseye, as this ships with Python 3.9, which is needed to build the mopidy-spotify extension. And manually upgrading Python is just a pain in the ass.
2. Add mopidy GPG key
If you don't add the mopidy GPG key, the Phoniebox installation will throw some errors (which actually may get unnoticed) and you'll probably end up with a broken installation.
sudo mkdir -p /etc/apt/keyrings
sudo wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/bullseye.list
sudo apt update

Source: https://docs.mopidy.com/en/latest/installation/debian
3. Install Phoniebox
cd; rm buster-install-*; wget https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/master/scripts/installscripts/buster-install-default.sh; chmod +x buster-install-default.sh; ./buster-install-default.sh

Source: https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/INSTALL
4. Remove default mopidy installation
sudo apt remove mopidy-spotify
5. Install mopidy-spotify extension
5.1. Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Don’t forget to source it (see last line of install output) source "$HOME/.cargo/env"
5.2. Install GStreamer dependencies
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gcc pkg-config git
5.3. Install gst-plugins-spotify
git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
cd gst-plugins-rs
cargo build --package gst-plugin-spotify --release -j1
sudo install -m 644 target/release/libgstspotify.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/

5.4. Verify installation
gst-inspect-1.0 spotify
5.5. Install latest version of mopidy-spotify extension
sudo python3 -m pip install https://github.com/mopidy/mopidy-spotify/archive/master.zip
Source: https://github.com/mopidy/mopidy-spotify#dependencies
Troubleshooting
Check mopidy config/extensions
sudo mopidyctl config
If mopidy-spotify could not be loaded, you'll see this line

WARNING  [MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found

Display logs for debug
Will display e.g. Spotify authentication issues, so just keep this running while (re)starting mopidy. journalctl -u mopidy -f
Restart mopidy
Make changes from mopidy.conf take effect. systemctl restart mopidy
mopidy.conf
You definitely want to use /etc/mopidy/mopidy.conf file. The one inside your users dir is not being used when mopidy runs as a service (which it does here).
Make sure to have the correct credentials set. You absolutely need username, password, client_id and client_secret. It will look like it is working with client_id and client_secret alone, but won't play any songs (no error in the GUI, just won't work).

Hi,
i tried this, but could not install gst-plugins-spotify.

cargo build --package gst-plugin-spotify --release -j1

gives me  this error:
 Updating crates.io index     Skipping git submodulehttps://github.com/gtk-rs/gir` due to update strategy in .gitmodules
Skipping git submodule https://github.com/gtk-rs/gir-files due to update strategy in .gitmodules
Skipping git submodule https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git due to update strategy in .gitmodules
Updating git repository https://github.com/gtk-rs/gtk-rs-core
warning: spurious network error (3 tries remaining): failed to connect to github.com: No route to host; class=Os (2)
warning: spurious network error (2 tries remaining): failed to connect to github.com: No route to host; class=Os (2)
warning: spurious network error (1 tries remaining): failed to connect to github.com: No route to host; class=Os (2)
error: failed to get gio as a dependency of package gst-plugin-threadshare v0.13.0-alpha.1 (/home/pi/gst-plugins-rs/generic/threadshare)
Caused by:
failed to load source for dependency gio
Caused by:
Unable to update https://github.com/gtk-rs/gtk-rs-core?branch=master#90fc2033
Caused by:
failed to fetch into: /home/pi/.cargo/git/db/gtk-rs-core-7be42ca38bd6361c
Caused by:
failed to connect to github.com: No route to host; class=Os (2)
`
a google search told me it could be related to using a proxy, which i don't do, so I don't know what to do with it.
Can anybody help me with this?

I don't know what your problem is, it seems your pi has network issues. There was a time I'd have suggested your power supply might not be good enough but I would hope in 2024 everyone has got that sorted.
In any case, you can grab gst-plugin-spotify from https://github.com/kingosticks/gst-plugins-rs-build (there's currently a pi-compatible Debian package to download here).

There is (finally) a new pre-release version of Mopidy-Spotify. It's got some fixes due to Spotify silently breaking their Web API and new install instructions which suggest using the pre-build deb packages at https://github.com/kingosticks/gst-plugins-rs-build/releases/latest

The future PR #2315 will incorporate the necessary changes for legacy V2, so no manual changes will be necessary anymore.

If someone want to try out the changes and give feedback, that would be really helpfull before we merge it.
Please post feedback in the PR https://github.com/MiczFlor/RPi-Jukebox-RFID/pull/2315
Best install on another SDCard and use this command for the installation (no other changes needed):
cd; rm install-jukebox.sh; wget https://raw.githubusercontent.com/AlvinSchiller/RPi-Jukebox-RFID/feature/mopidy-spotify-fixes/scripts/installscripts/install-jukebox.sh; chmod +x install-jukebox.sh; GIT_URL=https://github.com/AlvinSchiller/RPi-Jukebox-RFID.git GIT_BRANCH=feature/mopidy-spotify-fixes ./install-jukebox.sh

I couldn't resist and justed installed this version. The start of mopidy needs about 3 min on my Pi 4. Playing offline files works fine, but playing Spotify songs doesn't work, it just keeps playing the last played offline file. Here is a small video, that might make things clearer.
So this doesn't really help yet.

If someone want to try out the changes and give feedback, that would be really helpfull before we merge it. Please post feedback in the PR #2315
Best install on another SDCard with Bullseye and use this command for the installation (no other changes needed):
cd; rm install-jukebox.sh; wget https://raw.githubusercontent.com/AlvinSchiller/RPi-Jukebox-RFID/feature/mopidy-spotify-fixes/scripts/installscripts/install-jukebox.sh; chmod +x install-jukebox.sh; GIT_URL=https://github.com/AlvinSchiller/RPi-Jukebox-RFID.git GIT_BRANCH=feature/mopidy-spotify-fixes ./install-jukebox.sh

authors: 84julian AlvinSchiller Baggerfahrer CallMeErc ChisSoc Dark-Tower-Coder DavidOrtmann DonPavlov Groovylein Hamsert Micharius MrStrategy Simson002 Streuerei The-Judge Vanierica b3rgschu3tz bee-eater d4rkd3v1l danielsmint derdon222 hyperbit00 ip0p jnettels jonaskor kingosticks lenlennart maahn morpheus12 nanu-c oswaldo-be pabera passuff plangenh rlndwgnr rmk-ch rvegele s-martin sebrep shinebar1001 sonicdee spisoft thisismana thomas-wolf tulpenwase usamer77 usernameAXZ varac zachfoxx

repo: MiczFlor/RPi-Jukebox-RFID