Librespot addon

  • Rockchip is hardly supported.

    Can anyone try to build the addon for this platform?

    @

  • How stable is your network connection?

    Is it wired or wireless?

    If it is wireless, then try to switch to wired.

    Hi I am on wireless and there is nothing I can do about that ... however I doubt that this is the reason for the service executable crashing.


    But I got an update on this:


    I tried deinstalling and reinstalling the addon, but with no success, same issue as before. Then I went the the hard way:


    - setup build environment within docker container on my libreelec machine

    - got the librespots sources

    - applied the patches from the Libreelec repo

    - build everything

    - and replaced the executable within the addon with the newly build one.


    Now things are back to normal, everything works.


    But some rather general questions reamain:


    Why the addon installation process repeatedly installed a corrupt binary ?

    Where is the binary coming from ?

    Is it precompiled in the addon repo ? Or is it build while installing ?
    What is the url of the libreelec official repo ?

  • The librespot binary is built with the LibreELEC toolchain and packaged in the addon that you download.

    It could be that the addon cache (/storage/.kodi/addons/packages) contains a corrupt version of the addon.

    You could try to remove it with rm /storage/.kodi/addons/packages/service.librespot* and then try to reinstall the addon.

    @

  • Hi,


    first of all, thanks for your time and work on the librespot addon.


    After I recently updated libreelec and librespot, I immediatly recognized "missing" options in the librespot addon. After google-ing the crap out of the internet, I found out, that librespot isn't supporting ALSA out of the box anymore.

    Which leads to my problem. I have no idea how to build a version with alsa enabled as backend. Probably am I just not smart enough or maybe it's tldr, but I need alsa, since I do not like to switch the playback device everytime from pulse to alsa when I stream music and vice versa when watching a film. Is there a good instruction on how to use either pipe to alsa or a good, short instruction sheet on how to build librespot with alsa on the rpi3 running libreelec?

    Please, I couldn't find it, so maybe you can bring some light into my dark ball, called head.


    Thank you in advance for your time to read my crap here and thank you even more for responding to it.


    Jan Müller, <-not the brightest bulb in the chandelier

    Edited once, last by muellersjan: forgot the system I am working with ().

  • Please provide version of LibreELEC and version Librespot.

    thanks for replying!

    I was on an older version of libreelec (8.x) and accompanying librespot.

    I took that reply as a "try updating and tell me how it goes".

    I updated to the latest version, everything works fine now. Sorry for not trying that first!


    thanks again for your work on this project

  • From LibreELEC 9.2 on, Librespot only plays via Kodi, via pulseaudio.

    Doesn't Libreelec still support alsa? The alsa option is available in Libreelec 9.2 under System?


    I am asking because using an old librespot (RPi2-service.librespot-8.2.111) doesn't seem to work with audiojack, the configuration wizard is greyed out.

  • Doesn't Libreelec still support alsa? The alsa option is available in Libreelec 9.2 under System?

    Yes it does, even out of the box since they added the drivers for the cirrus card, but, and that's in my eyes a downgrade, librespot does not support playing directly to alsa anymore. Which was somehow pretty good, because you could have a seperat HiFi System to which you could send your spotify music and a TV which takes all the other audio. That means, I didn't have to fiddle around with the system settings every time.

  • Well, I figured it out.


    My goal: Use librespot on an RPi3 running the latest Kodi/libreelec combo playing via alsa (Cirrus audio card), since the TV I have is not that good for playing music, but good enough for films and series and I have a hifi system which I use for music only


    How I got there:


    0. Install Librespot via Addons on your RPi

    I had done this way before I stumbled into the problem with the missing alsa option, so you also might have done this already. If not install the kodi nerds repository and install it from there.


    1. Setup a fresh Ubuntu VM

    For Windows users: download latest image from ubuntu website and use VMware Player with easy setup. Make sure Ubuntu has 30Gig disk space.

    2. Install Docker

    Follow the instructions here: Docker Install Guide

    For a fresh machine you can directly go to step 3 of the guide:

    Inside the ubuntu VM open a console (Win-key and type cmd)

    Code
    1. sudo su
    2. apt install docker.io
    3. systemctl start docker
    4. systemctl enable docker

    3. Install Curl, Git and dependencies

    You will need this for the next steps.


    Code
    1. apt install curl
    2. apt install git
    3. apt install libasound2-dev pkg-config

    4. Install Rust

    This is done via rustup.rs

    Or use this code directly(could be outdated!):


    Code
    1. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

    5. Get the latest version of the librespot project from github

    Make a new folder, maybe in your home directory and clone the git into it


    Code
    1. mkdir /home/libspot
    2. cd /home/libspot
    3. git clone https://github.com/librespot-org/librespot.git

    This will make a new folder: /home/libspot/librespot


    6. Make the docker image

    Source: Cross-compiling

    Code
    1. cd /home/libspot/librespot
    2. docker build -t librespot-cross -f contrib/Dockerfile .

    The last '.' is crucial!


    7. Finally Cross-Compile

    After following all preceding steps you should now be able to run following command:

    Code
    1. docker run -v /home/libspot/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features alsa-backend

    This will direct the output to /home/libspot/librespot-build/arm-unknown-linux-gnueabihf/release/


    8. Transfer your new binary to your RPi

    Locate the "old" binary of the librespot addon here: /storage/.kodi/addons/service.librespot/bin/


    Use the "Files" app of your ubuntu system to transfer the file "librespot" to your RPi. Use "Other Locations" and type in the field on the bottom of the "Files" app:


    Code
    1. ssh://ipaddress/

    User: root

    Passphrase: libreelec

    Then copy the file "librespot" to your RPi into /storage/downloads/

    From there use a ssh shell and replace the old file with your new one.


    9. Make it work...

    Last thing on the list, edit the file: /storage/.kodi/addons/service.librespot/bin/librespot.start


    I got rid of two or three options, which I don't need. Feel free to add them back in.


    After this, librespot should be started automatically at systemstart. If not you can use following command to see what's going wrong:


    Code
    1. journalctl -u service.librespot

    Good luck and good night.

  • Woa!

    It would certainly have been easier to wrap a system.d service around the binary you compiled.


    I would prefer such hacks being discussed elsewhere than in this thread. After all, my idea of the addon is to play Spotify as simply as possible on a simple device.


    Nevertheless, from revision 119 on, the addon will ship librespot with an alsa backend to support alternative uses, eg as a separate user defined system.d service.


    It is complicated to write an addon that supports both playing through alsa and playing through kodi, so decided to support only playing through kodi.

    @

  • Well, I figured it out.


    My goal: Use librespot on an RPi3 running the latest Kodi/libreelec combo playing via alsa (Cirrus audio card), since the TV I have is not that good for playing music, but good enough for films and series and I have a hifi system which I use for music only


    [...]

    Good luck and good night.

    Thanks for this guide, it works.

    Playing via Kodi also has a too high latency on each interaction in the Spotify app (next song, searching within a song). That's why I am very happy that I can use ALSA again via this hack.

  • The Librespot addon is intended to play via Kodi.


    However, revision 119 of the addon will bring back an ALSA backend to librespot.

    It will then be possible to start librespot for ALSA with a separate custom system.d service, ie skip steps 2 to 8 of @muellersjan's hack.

    This custom service will be able co-exist with the addon and to pick-up updates of librespot shipped with the addon.

    Custom services will of course be discussed in this forum but not in this thread.

    @

  • When will 119 be available? Where can I find it?

    When it is merged, built and pushed.

    If you tell me what version of LibreELEC you are running on what hardware, I might provide you with a pre-release here.

    @

  • Okay, I installed version 119 successfully. My goal is like in former times:


    - Default Playback device for KODI is HDMI (KODI Audio Settings)

    - Librespot Playback device device shall be analog stereo out


    The setting is not available any more in librespot. What can I do now?


    Edit: Done!


    /.kodi/addons/service.librespot/bin/librespot.start

    => edit backend and device


    Works awesome!! Thank you

    Edited 2 times, last by pipsen ().