Mopidy + Spotify Connect / Raspotify

Hey there,

I’m wondering what the recent options are of how to get Raspberry Pi working with Mopidy AND Spotify Connect. I love both and don’t wanna miss one.

My setup consists of a Raspberry Pi 3 with the HiFiBerry Amp 2 connected. I’m running Mopidy 2.1 with Mopidy-Spotify and TuneIn backend extensions, which works like a charm. Parallel to this installation I’m running Raspotify which leverages librespot and enables the use of Spotify Connect. Raspotify also works like a charm - if I run it separately…

Once one of both is running and playing music I’m not able to start playing the other one. In order to play music using Spotify Connect I need to manually stop the mopidy server and vice versa.

Does anybody have an idea of how to get both running together seamlessly. Or is there another way of how to integrate Spotify Connect with Mopidy?

Pimusicbox uses the librespot onevent handler to issue a MPD stop command to Mopidy when librespot playback starts. You could also configure an ALSA dmix device to allow both programs to output to the soundcard at the same time (but you’d still need to remember to stop and start them both to avoid a garbled mess).

Hi all, that works perfectly well – is there a chance to display the current track from Spotify connect in Mopidy Front end? If we cannot display the current track in that view, is at least possible to display a spotify connect logo? Thanks MK

I was googling a bit and I figured it could be done some how as described here:


So the song play events can be captured and collected and we could maybe create a plugin to mopidy that just collects these events and displays it on the now playing page …
Isn’t that possible?
Best regards
MK

Very possible to use the Spotify Web API for that. Not entirely sure if the auth token used by Mopidy-Spotify has the necessary permissions (scopes) to access that part of the API. If not, you may be able to ask @adamcik to add what’s needed (if you find out). I’m not personally interested in adding this to my webclient as I think it would just be confusing, but maybe it just needs some effort in the UI department.

The current default scope is set to:

OAUTH_SCOPES = [
    'playlist-modify-private',
    'playlist-read-private',
    'playlist-read-collaborative',           
    'user-follow-read',
    'user-library-read',
    'user-read-recently-played',             
    'user-read-private',
    'user-top-read',
    'streaming',
]

Older tokens might be missing at least streaming.

Hi!
I’m new here, but I’m very interested to this post.

I’m on Pi Zero w and Pimoroni Pirate Audio line out with Mopidy and Iris installed and all work like a charm.
But if I can use the original Spotify App of Android or PC to control the streaming it would be awesome!
I’ve been setup the Raspify addon ad the spotify App on my phone view the device but after a 15 seconds of tryng to connect nothing happens and the command for streaming doesn’t works.

Can some one explain to me how to do that please?

This topic is quite old but the information remains correct. It’s not clear from your post what exactly you tried to do here in regards to playing from both programs at the same time, or if it’s just a fundamental problem getting Raspify to work. If it’s the latter then you are better off posting in their support channels.

Hi,
Sorry if I was not clear to explain the situation.
I would like to use mopidy and raspotify at the same time. Because now I can use only one service a time. There’s a simple way to do that or a little guide to how to do that?
Thanks in advance.

OK, I thought you had followed the suggestion at the top and were still having some problems. And I also see now that you meant Raspotify.

I don’t have a step-by-step guide but you need to:

You can read about dmix here. I don’t know if Raspotify has any special ALSA configuration requirements but assuming not, you need to make/edit the file at /etc/asound.conf so it contains:

pcm.!default {
        type plug
        slave.pcm "dmix"
}

Now multiple programs should be able to open the default audio device at the same time.

Then you need to come up with some way that the two programs do not both try and actually output at the same time and produce a garbled mess. You can either handle this manually by remember to stop/pause the program you are not using. Or, in my above post I said:

Maybe Raspotify exposes this, or something similar. I don’t know.

Thanks for your support @kingosticks, I’ll try to do what you sais in the previus post.

Maybe I’ve found a fresh nice post that’s perfect for what I need.
I’ll give it a try in theese days.
This use Spotify Connect and view the cover album of the song on the pimorony dislpay board.
If some one need this: