Thank you for your donation!


[HOW-TO] Spotify Connect Web for Moode
#1
[Note: this excellent work by Rafa was done before the integration of a Spotify Connect renderer in moOde in the fall of 2018. For most users, the integrated renderer is sufficient. Be forewarned that following Rafa's procedure may prevent the integrated renderer from working. As well, moOde has underdone continuous development which may well necessitate adjustments to Rafa's procedure.]

Hello friends,

As many Moode fans out there, I enjoy the amazing sound MoOde brings to the table.  Also, I enjoy using Spotify and my family and I have created nice playlists we share.

For that, having a Spotify Connect service is much nicer than just streaming the Spotify audio to Moode.  The advantages range from freeing up your device (if a call comes through you don't have to leave everyone music-less, or if you are doing something else that produces sound you don't want that going through your main speakers) to possible better integration to Moode.

I am sure some of you will post a link to the "Spotify that just works" repository, which will be enough for most users.  So please do so!  The problem is that that repository has one issue missing for me at the time of writing: Gapless Playback.

Until that is fixed, I have compiled some instructions to run spotify-connect-web inside moode, with some candy on top to make it sweeter.  I have improved my instructions to reflect newer versions of moode and simplified flows.  You can find them here if you are interested:

https://github.com/RafaPolit/moode-spotify-connect-web

Any feedback (inside the repo issues would be better, but here could work as well) is encouraged.

Hope to read other's implementations of Spotify in Moode.

Best regards,
Rafa.

---------------
IMPORTANT!  This is a complex procedure and will involve trial and error while you wrestle with different Moode versions, packages and tool versions, hardware cards, etc.  This is MOST CERTAINLY NOT a straightforward and easy procedure.  If you are not really confortable with that, this is perhaps not the best approach for you.

There are other Spotify instructions that are easier and that are more universally reported as working.  With this one, there is a good 40% chance that you will run into trouble, as you can read from the posts that follow.  This is only worth it if you absolutely need gapless Playback.  If not, please look elsewhere.

If after all this you still decide to try, please read through this thread and all it's posts.  There is a good chance you will find others have walked that same path and found a solution.

If you still fail, post your problem, along with all the efforts you have taken to solve it: files checked, versions checked, naming conventions, etc.  Please, try to solve your problems first, then come for help.  Do not expect to just run the instructions and post a question about "how do I solve my problem".

Sorry to be so blunt, but I feel more peolple fail to get this working than those that get it to work. You have been warned, try this at your own risk!
Reply
#2
Hi Rafa,

Are u aware that some devs forked the abandoned librespot project and are working on fixing the issues in the code and producing a stable, Spotify Connect solution? I guess you could call this project the "official" librespot. Thats the codebase that I plan to integrate into moOde at some point.
https://github.com/librespot-org/librespot

-Tim
Enjoy the Music!
http://moodeaudio.org | http://twitter.com/MoodeAudio | http://github.com/moodeaudio
Reply
#3
(04-06-2018, 07:34 PM)Tim Curtis Wrote: Hi Rafa,

Are u aware that some devs forked the abandoned librespot project and are working on fixing the issues in the code and producing a stable, Spotify Connect solution? I guess you could call this project the "official" librespot. Thats the codebase that I plan to integrate into moOde at some point.
https://github.com/librespot-org/librespot

-Tim

Yes, yes... I am following their progress.  Still, no gapless Playback, but it is in the to-do list, let's hope it gets into 'on progress' soon.
Reply
#4
For the sake of completeness it should be mentioned that there is another nice alternative worth mentioned:
"spotifyd", a single file solution with a nice optional config file, available prebuilt. Unfortunately without gapless play either.
Reply
#5
That was the one I was referring to in my first post as the 'Spotify that just works', so please share links and instructions for that as well. This is not the place for 'my' solution, but options that work. So, yes, please, share the links and any other info that is relevant.

Alas, I believe that is a wrapper of the Librespot library. The one I use is a wrapper of the official Libspotify, so it has some advantages. Nice to have options.
Reply
#6
There still isn't a reliable solution to Spotify Connect. Librespot still have connection issues, it usually hangs randomly. Volumio recently released the volumio-spotify-connect2 plugin but it's only a wrapper for librespot. Raspotify has some delay (+20 secs sometimes) to start a song and also, issues with stability. Spotify-Connect-Web has this "request API KEY" thing (which is annoying) and also, mayor issues caching songs.

But hey! There is progress being done. Let's hope to have a more stable implementation in the future.
Reply
#7
Support this project https://github.com/librespot-org/librespot and the devs that are committed to an Open Source Spotify Connect :-)
Enjoy the Music!
http://moodeaudio.org | http://twitter.com/MoodeAudio | http://github.com/moodeaudio
Reply
#8
(04-09-2018, 02:08 AM)gabmartini Wrote: There still isn't a reliable solution to Spotify Connect. Librespot still have connection issues, it usually hangs randomly. Volumio recently released the volumio-spotify-connect2 plugin but it's only a wrapper for librespot. Raspotify has some delay (+20 secs sometimes) to start a song and also, issues with stability. Spotify-Connect-Web has this "request API KEY" thing (which is annoying) and also, mayor issues caching songs.

But hey! There is progress being done. Let's hope to have a more stable implementation in the future.

The current Librespot-org implementation is very solid. I installed it on Moode 3.8.4 and Moode 4.0. Both installations run without big issues. It's worth a try!

Code:
cd /home/pi
sudo apt-get install build-essential portaudio19-dev git
git clone https://github.com/librespot-org/librespot.git
cd librespot/
curl https://sh.rustup.rs -sSf | sh
#from the given options choose 1
source $HOME/.cargo/env
sudo reboot

#Login again
cd /home/pi/librespot/
cargo build --release --features alsa-backend
#this will take a while, 30 minutes plus
# after this process is done, create a spotify-connect.service

sudo su
nano /etc/systemd/system/spotify-connect.service
#add the following to the spotify-connect.service file
#change --device depending on the device you are using
#change --name to your liking
#add if needed --username <your spotify username>
#add if needed --password <your spotify password>


[Unit]
Description=Spotify Connect
Requires=network-online.target
After=network-online.target

[Service]
User=root
ExecStart=/home/pi/librespot/target/release/librespot --name MoodeSpot --initial-volume 75 --cache /tmp --bitrate 320 --backend alsa --device hw:1
Restart=always
RestartSec=10
StartLimitInterval=30
StartLimitBurst=20

[Install]
WantedBy=multi-user.target

#save and close the file by 'ctrl x' -> 'y' -> enter
#start and enable the service
systemctl enable spotify-connect.service
systemctl start spotify-connect.service

#Make sure Moode is stopped before using Librespot and vise versa.

#to update
cd /home/pi/librespot
git pull
cargo build --release --features alsa-backend
sudo reboot
Reply
#9
I'm getting confused by all these "incarnations" of Spotify Connect developments.

Out of curiosity to experiment, I found this one
https://github.com/dtcooper/raspotify
which requires a 1 line installation:
curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
I only changed a couple of lines in the "/etc/default/raspotify" configuration file:

# /etc/default/raspotify -- Arguments/configuration for librespot
# Device name on Spotify Connect
DEVICE_NAME="moodeXraspotify"
# Bitrate, one of 96 (low quality), 160 (default quality), or 320 (high quality)
BITRATE="320"

...and I was up and running in less than 10 minutes on Moode 4.0
Reply
#10
The incarnations happen because Spotify has stopped development and support for their closed Libspotify library, but provide no alternative. Still, it mostly works because the end points are the same.

Meanwhile, people are reverse engineering those end points and creating their own APIs for Linux. There are many incarnations which are mostly wrappers of two main programs.

The interesting part is the configs and how each accept ALSA, or Pulse audio...hooked to USB or i2C, so every success story counts.

What DAC are you using? Since I only have USB DACs, I have had no problems, but owners of HAT DACs have not been happy campers.

Best regards,
Rafa.
Reply


Forum Jump: