wiki:mycroft_mark-2_spotify

Version 1 (modified by admin, 2 years ago) (diff)

--

Spotify

Skill

Install the regular Spotify skill from the skill marketplace (or get it from https://github.com/forslund/spotify-skill)

raspotify

To have a local spotify device on the Mark II install raspotify

  • sudo apt-get install raspotify

make raspotify use pulseaudio

raspotify can not use pulseaudio by default as it does not have a pulseaudio audio device module. To make it work with pulseaudio it has to be run as a user service and not a system service. See https://github.com/dtcooper/raspotify/issues/78 for details. Disable the system service:

  • sudo systemctl disable raspotify

Create a user service file:

  • nano ~/.config/systemd/user/myraspotify.service
    [Unit]
    Description=myraspotify
    After=network.target
    
    [Service]
    Restart=always
    RestartSec=10
    PermissionsStartOnly=true
    Environment="DEVICE_NAME=raspotify (%H)"
    Environment="BITRATE=160"
    Environment="CACHE_ARGS=--disable-audio-cache"
    Environment="VOLUME_ARGS=--enable-volume-normalisation --linear-volume --initial-volume=100"
    Environment="BACKEND_ARGS=--backend alsa"
    EnvironmentFile=-/etc/default/raspotify
    ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} $BACKEND_ARGS --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS
    
    [Install]
    WantedBy=default.target
    

Enable and start service:

  • systemctl --user daemon-reload
  • systemctl --user enable myraspotify
  • systemctl --user start myraspotify