RPi-Jukebox-RFID: 🐛 | 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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 145 (9 by maintainers)

Most upvoted comments

Thanks for reporting this.

Looks like this is a real showstopper, we need to look into that.

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).

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:

  1. 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.

  1. 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.

  1. 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
  1. 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}"
  1. Remove the exising installation of mopidy-spotify which is no longer working
    sudo apt-get remove mopidy-spotify

  2. 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.

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:

  1. 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.

  1. 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.

  1. 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
  1. 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}"
  1. Remove the exising installation of mopidy-spotify which is no longer working sudo apt-get remove mopidy-spotify
  2. 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 :

  1. 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

  1. 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-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

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. Alternative 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!

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

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/main.zip
  • Configure mopidy with your spotify credentials (should have already happened during the one-line-install, otherwise see here
  • Reboot your raspberry pi
  • (I was tinkering a lot before getting this to work, but hopefully I did not forget any steps)

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

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 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 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

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 deb packages at https://github.com/kingosticks/gst-plugins-rs-build/releases/latest

The version of spotifyaudiosrc within the package itself is not new, so there’s no need to upgrade to it if you already have a working version.

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

Those credentials won’t work (and they never have). Get credentials from https://mopidy.com/ext/spotify/ or https://www.mopidy.com/authenticate (as per the logged error message)

This is an excellent hint which saved me hours. I believe I ran into this issue already several times because this was not clear to me. It’s working now. Thanks a lot!

@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 to setup a fresh install! I ran into some small issues but nothing related to spotify.

(I think I ran the setup kind of parallel because connecting to the screen session did not work for me, so I started the stuff manually 🙃, 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, display did not work --> cable disconnected 🤦🏻‍♂️, … ).

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! 🎉

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 phonieboxers.

I would like to share two solutions/workarounds to satisfy our children until the ultimate Phoniebox release. Neither requires coding or changes to the Phoniebox code.

  • Download albums/playlists as MP3 and move them to the phoniebox SD-card. Onr way to achieve this is using https://github.com/SathyaBhat/spotify-dl/ and following the description there. Note that this tool just downloads metadata from spotify whereas the actual content is downloaded from youtube and therefore potentially different.
  • 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:
    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. 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)

Hope this helps you as well! Best, rmk

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

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

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

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 😕)

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.

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

So after removing rust completely setting the boot/config.txt to 32 bit, and rebooting. I get a different profile even: armv7-unknown-linux-gnueabihf

after installation finishes everything works as expected: it is possible to just run cargo and rustc I assume both host profiles are correct in a way.

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

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

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

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

Those credentials won’t work (and they never have). Get credentials from https://mopidy.com/ext/spotify/ or https://www.mopidy.com/authenticate (as per the logged error message)

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.

@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!!!

hmm… Following @d4rkd3v1l method above, on a raspberry PI 4 I had to alter the 5.1 step. Installed Rust was for 64 arm linux version, and I had a 32 PI. After installing the correct version of rust everything else worked.

Starting playback (local files worked). Adding a Spotify track URI worked … for a day. Today nothing from Spotify seems to work any more. Iris web client never worked actually for playback - it just says ‘Mopidy: Failed to add some tracks’ when pressing play from it. No error messages in mopidy logs.

FYI it’s back online.

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.

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=<Username> password=<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!

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.

For what it’s worth, I’m planning to do some more work on the fixed version this week. Not sure if it’ll be release ready but I want to sort out seeking and the loading latency.

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 issue?

Many thanks!

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.

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

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

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

I think its a problem an is described 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.”

I think this is a major problem for every Phonebox/Spotify version