badaix/snapcast

Playback stops when Spotify playlist ends

rwjack opened this issue · 3 comments

rwjack commented

Perhaps this issue belongs here:
librespot-org/librespot#1170

Host (what you are running librespot on):

  • OS: Linux
  • Platform: Home Assistant Container
ARG BUILD_FROM
FROM $BUILD_FROM

# Add env
ENV LANG C.UTF-8

RUN \
    apk add --no-cache --virtual .build-dependencies \
        build-base=0.5-r3 \
        cargo=1.60.0-r2 \
        git \
        protobuf-dev=3.18.1-r3 \
        pulseaudio-dev=15.0-r2 \
    \
    && apk add --no-cache \
        pulseaudio=15.0-r2 \
    \
    && cargo install \
        --locked \
        --no-default-features \
        --features pulseaudio-backend \
        --root /usr \
        --bin librespot \
        --version 0.4.2 \
        --verbose \
        -- librespot \
    \
    && apk del --no-cache --purge .build-dependencies \
    && rm -fr \
        /tmp/* \
        ~/.cargo \
        /usr/.crates.toml \
        /usr/.crates2.json

#Install snapcast
RUN sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories && apk add --no-cache snapcast bash

# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh

CMD [ "/run.sh" ]

I tried adding autoplay to the config and it did not seem to work...

Here are the relevant log lines:

2023-06-01 13-46-44.492 [Info] (Snapserver) Version 0.27.0
2023-06-01 13-46-44.492 [Info] (Snapserver) Adding stream: spotify:///librespot?name=Spotify&username=xxx&password=xxx&devicename=HA_Snapcast&bitrate=320&volume=100&autoplay=on
2023-06-01 13-46-44.492 [Info] (Snapserver) Adding stream: tcp://0.0.0.0:4953?name=TTS&mode=server
2023-06-01 13-46-44.492 [Notice] (init) Settings file: "/data/snapserver/server.json"
2023-06-01 13-46-44.492 [Info] (Snapserver) Using HTTP host name: local-snapcast-server-libspot
2023-06-01 13-46-44.492 [Error] (Avahi) Failed to create client: Daemon not running
2023-06-01 13-46-44.492 [Info] (PcmStream) PcmStream: Spotify, sampleFormat: 44100:16:2
2023-06-01 13-46-44.493 [Info] (Server) Stream: {"fragment":"","host":"","path":"/librespot","query":{"autoplay":"on","bitrate":"320","chunk_ms":"20","codec":"flac","devicename":"HA_Snapcast","name":"Spotify","password":"xxx","sampleformat":"44100:16:2","username":"xxx","volume":"100"},"raw":"spotify:////librespot?autoplay=on&bitrate=320&chunk_ms=20&codec=flac&devicename=HA_Snapcast&name=Spotify&password=xxx&sampleformat=44100:16:2&username=xxx&volume=100","scheme":"spotify"}

Looking at the processes in the container, the autoplay flag isn't there. (omitted --username and -password)
image

rwjack commented
[server]
threads = -1
datadir = /data/snapserver/
[stream]
stream = spotify:///librespot?name=Spotify&username=xxx&password=xxx&devicename=HA_Snapcast&bitrate=320&volume=100&autoplay=on
stream = tcp://0.0.0.0:4953?name=TTS&mode=server
buffer = 1000
codec = flac
send_to_muted = true
sampleformat = 48000:32:2
[http]
enabled = true
bind_to_address = 0.0.0.0
doc_root = /usr/share/snapserver/snapweb/
[tcp]
enabled = true
[logging]
debug = false

Hi @rwjack

I think the problem comes from your config. I believe it is autoplay=true instead of autoplay=on

rwjack commented

Hey, you are correct.
I managed to fix this, but forgot to close the issue.