Spotify Connect Web

  • So I have been playing around with a USB DAC that I just bought HiFime Sabre 9018 USB DAC

    It works fine with Kodi and Spotify after first setting it up and booting. I chose sysdefault:CARD=Audio from the Spotify Connect Web app and then PCM etc. Shows up instantly and doesn't even have to be connected during before you boot up LibreElec.

    Here's the annoying part: if I reboot the LibreElec from the menu, it stops working. When I try to select a different audio device to use from the Spotify app i just get an error. I tried selecting the HDMI/Analog for Kodi in case they were having issues sharing the same output device, but this doesn't resolve the issue.

    It works if I unplug the USB DAC and then do the following:
    1. Reselect the integrated HDMI/ANALOG output device while the DAC is disconnected. Select OK
    2. Insert the USB DAC again and go back to output device selection, then it will let me pick the DAC again and LibreElec almost instantly shows up on my Spotify app and works again.

    I've taken a snippet of the log, the first is the device which seems to register as the default audio device for Spotify, hw:0. The next is the error after rebooting the Pi and it tries to use the USB DAC again and can't find it.


    I'm at a loss here and I realize this is probably not a priority, though I wanted to be able to use LibreElec hooked up to a sound system to stream spotify headlessly (no HDMI), so this kinda sucks :(

  • awiouy:

    I've been trying to get spotifyconnectweb app working seperately on a headless installation and had quite a bit of problems creating a systemd service without a seperate script... What I've learned with help from your script and trial and error is that unless you create a sepearte script, it seems to be very picky about accepting arguments such as --username, --password, --key etc. It just produces an error when starting the service. It works fine if i use the chrooted version, but not the smaller one with built-in dependencies, which is preferrable.

    So I solved this by specifying the locations manually, which worked perfectly.

    Code
    ExecStart=/pathto/spotifyconnectweb -k /pathto/spotify_appkey.key -n "Spotify Connect" -b 320 -c /pathto/credentials.json

    Just wanted to share this in case it helps anyone else.. Thank you again for your great implementation, my next issue to tackle will be starting avahi.

    Would it be recommended to just add this line of code to /etc/rc.local ?

    Code
    avahi-publish-service TestConnect _spotify-connect._tcp 4000 VERSION=1.0 CPath=/login/_zeroconf
  • Hi

    I am in trouble getting the addon started.
    Pi2 Libreelec 7.95.1
    In the addon Configuration wizard I do see 2 Alsa devices and Mixer PCM.
    The addon does not start. ip:4000 not working also. Console says something with device not found.
    But if i open putty cd to addon and typing ./spotify-connect-web -u USERNAME -p PASSWORD -o hw:0,1
    then everything is running like a charm.
    I think the problem is -o hw=0,1
    what syntax is needed within the Addon Configuration to tell the addon that it should use hw=0,1 ?


  • Weird, ALSA/PCM are known to work.
    If not, try to set playback device manually to hw=0,1

  • Hello and thank you awiouy for this plugin.
    I had similiar problems to HelpMeSpotify getting it to work with a USB soundcard. I'm on LE8, milhouse build from 10.02.2017 on a raspi 2 with a miniDSP 2x4HD.
    'amixer' showed "amixer: Mixer attach default error: No such file or directory". The problem was that the soundcard was recognized as card 1 not card 0 and executing amixer without the specification of the device with the '-c 1' flag resulted in this error. I fixed this by making the USB device the default in /storage/.config/asound.conf :

    Code
    pcm.!default {
        type hw
        card m2x4HD
    }
    ctl.!default {
        type hw
        card m2x4HD
    }


    The name of the card is found out with 'aplay -L'. For me the output containes lines like this: "sysdefault:CARD=m2x4HD". So the card name is 'm2x4HD'.

    Now I tested the connect server and worked out the correct parameters by starting it from the command line. The working command for me was

    Code
    ./spotify-connect-web --key /storage/.kodi/userdata/addon_data/service.spotify-connect-web/spotify_appkey.key --playback_device sys
    default:CARD=m2x4HD --mixer_device_index 0 --mixer 'miniDSP 2x4HD ' -u myusername -p mypassword

    The name of the mixer is obtained by the output of 'amixer'. The other parameters were chosen like descriped in the projects repo.
    By inspecting 'journalctl -u service.spotify-connect-web' I noticed that the passed name of the mixer 'miniDSP 2x4HD ' was truncated to 'miniDSP'. Also notice the trailing space in the name. Thanks miniDSP.... Spaces in names never bring any luck.
    I followed the passing of the argument through the sources. The truncation happens at the calling of spotify-connect-web in bin/spotify-connect-web.start. Changing it in the following way made it work correctly:

    I guess there is a more clever way to do this which preserves your check if $scw_m is specified. I don't need it for now. Maybe this is something for the next update.
    Also the integration of the "--dbrange " option in the gui would be nice. Thanks.

    I hope this helps people with the same issues.

  • How long does ot take to get a spotify app key?

    I send a request a couple of days ago but still nothing...

  • Hello, first of all, THANKS! Great Idea to bring SC to LE. Have a original Pi2, fresh LE 8.00, installed from repo ... set BitRate to 320, Playback Device: hw:0,1 (also hw:0,0), Mixer PCM... no sound and addon does not startup automatic; can start from shell so it appears on other devices .. controls on webinterface are working then if i select the device .. but bad silence :(

    Got this from terminal:

    ALSA lib /home/chewitt/LibreELEC.80-official/build.LibreELEC-RPi2.arm-8.0.0/alsa-lib-1.1.2/src/confmisc.c:767:(parse_card) cannot find card 'default'
    ALSA lib /home/chewitt/LibreELEC.80-official/build.LibreELEC-RPi2.arm-8.0.0/alsa-lib-1.1.2/src/conf.c:4371:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device
    ALSA lib /home/chewitt/LibreELEC.80-official/build.LibreELEC-RPi2.arm-8.0.0/alsa-lib-1.1.2/src/confmisc.c:392:(snd_func_concat) error evaluating strings
    ALSA lib /home/chewitt/LibreELEC.80-official/build.LibreELEC-RPi2.arm-8.0.0/alsa-lib-1.1.2/src/conf.c:4371:(_snd_config_evaluate) function snd_func_concat returned error: No such device
    ALSA lib /home/chewitt/LibreELEC.80-official/build.LibreELEC-RPi2.arm-8.0.0/alsa-lib-1.1.2/src/confmisc.c:1246:(snd_func_refer) error evaluating name
    ALSA lib /home/chewitt/LibreELEC.80-official/build.LibreELEC-RPi2.arm-8.0.0/alsa-lib-1.1.2/src/conf.c:4371:(_snd_config_evaluate) function snd_func_refer returned error: No such device
    ALSA lib /home/chewitt/LibreELEC.80-official/build.LibreELEC-RPi2.arm-8.0.0/alsa-lib-1.1.2/src/conf.c:4850:(snd_config_expand) Evaluate error: No such device
    ALSA lib /home/chewitt/LibreELEC.80-official/build.LibreELEC-RPi2.arm-8.0.0/alsa-lib-1.1.2/src/pcm/pcm.c:2450:(snd_pcm_open_noupdate) Unknown PCM default:CARD=default

    HowTo?

    Thanks in advance for serving me :)

    • Official Post


    Just use the Spotify Connect Web add-on ;)