GithubHelp home page GithubHelp logo

giof71 / librespot-docker Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 1.0 68 KB

Use Librespot (Spotify Connect) with Docker (Alsa & PulseAudio supported)

License: Apache License 2.0

Dockerfile 13.39% Shell 86.61%
linux music docker librespot raspberry-pi spotify alsa arm arm64 audio-player audiophile docker-image music-player pulseaudio raspberry-pi-3 raspberry-pi-4 systemd-service spotify-connect

librespot-docker's Issues

Connection reset by peer (os error 104)

Hello,

I am trying to deploy this image in a Kubernetes cluster (K3s). The pod is running on a target node, which is a Raspberry Pi 3 with a HIFI-BERRY DAC+ plugged on it.

I have already tested several images but I always get the same error, it must be more related to the configuration than to the image itself.

I can connect via Spotify-connect, but after a few minutes the music stops and I get the following errors in the logs:

[2022-10-23T14:55:41Z ERROR librespot_playback::player] Unable to load audio item: MercuryError
[2022-10-23T14:55:41Z ERROR librespot_core::session] Connection reset by peer (os error 104)
[2022-10-23T14:55:41Z ERROR librespot_connect::spirc] subscription terminated
[2022-10-23T14:55:41Z WARN  librespot] Spirc shut down unexpectedly

And when I open a connection throught Spotify-connect, I very often get :

[2022-10-23T14:48:34Z WARN  librespot_playback::audio_backend::alsa] Error writing from AlsaSink buffer to PCM, trying to recover, ALSA function 'snd_pcm_writei' failed with error 'EPIPE: Broken pipe'
ALSA lib pcm.c:8545:(snd_pcm_recover) underrun occurred

I'm not sure if asound.conf is used in the image, but here's the configuration file I mount in the pod (/asound.conf):

pcm.!default {
  type hw card 0
}
ctl.!default {
  type hw card 0

And here are the environments variable provided to the container :

env:
  - name: DEVICE_NAME
    value: SPEAKER
  - name: DEVICE
    value: hw:0,0
  - name: DEVICE_TYPE
    value: speaker
  - name: FORMAT
    value: S24
  - name: BITRATE
    value: '320'
  - name: ENABLE_CACHE
    value: 'Y'
  - name: CACHE_SIZE_LIMIT
    value: 3G

I've already try to run without the cache. I suspect a PCM buffer problem but I would like your opinion ?

Thank you !

only build from tags

We need to create docker images only when tags are pushed.
Sample tag names:

release/2022-01-01
devel/dev-snap-2022-01-01
feature/my-feature-snap-2022-01-01
main/main-snap-2022-01-01

[Feature Request] Provide a way of creating a user level systemd service for PulseAudio mode

Is your feature request related to a problem? Please describe.
If we want an automatically starting container configured in PulseAudio mode on a desktop system, we probably cannot use a restart policy from docker, which seems to break PulseAudio (at least on my systems)

Describe the solution you'd like
As done with squeezelite-docker, a user level systemd service would solve the issue.

Describe alternatives you've considered
No alternatives that I know of, that do not require a manual interaction (like, e.g., starting an existing container from the command line or from Poirtainer)

Additional context
This applies to PulseAudio mode so basically to system with a desktop environment without auto-login. Automati login might probably mitigate the issue

Provide a few usage examples

Provide a few usage examples:

  • docker run commands

  • docker-compose.yaml files

  • pulseaudio and alsa configurations

Use cargo install in Dockerfile

Avoid to rely on raspotify (a great project of course)
This currently does not work because cargo install seem to fail for armhf architecture on GitHub workflows.

Parameters must be optional

  • Parameters must be optional (when possible)
  • Not specifying optional parameters should not break the container execution

[Maintenance] Build cleanup

Perform the following changes:

  • Remove apt proxy config
  • Remove apt cache
  • Create a second step with a scratch image, copy all data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.