pauloo27/tuner

Trying to make a Dockerfile but it kinda crashes

IvanTurgenev opened this issue · 9 comments

when playing a song it crashes, havent tested sound out of the container maybe docker run --device /dev/snd -it --rm tuner

FROM golang:latest as builder
RUN apt-get update && apt-get install -y --no-install-recommends git libmpv-dev
WORKDIR /app 
RUN git clone https://github.com/Pauloo27/tuner .
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags='-w -s'  .


FROM python:3-buster

RUN DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -y mpv libmpv-dev fonts-font-awesome && \
    rm -rf /var/lib/apt/lists/* && \
    apt-get clean && apt-get purge

RUN pip install youtube-dl

WORKDIR /app

COPY --from=builder /app/tuner /usr/bin/

ENTRYPOINT ["tuner"]

Running

docker run \
    -it \
    --rm \
    --device /dev/snd \
    --privileged \
    tuner:latest

I got the error:

ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
couldn't open play stream: No such file or directory

I will test some stuff. If I found a way to fix it, I will put the Dockerfile in the project.

maybe something like this --device /dev/snd:/dev/snd -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native --group-add $(getent group audio | cut -d: -f3)

baffled i could not find a way to play audio from my android to linux i found this way

FROM debian:latest

RUN apt-get update && \                                                                                                
 DEBIAN_FRONTEND=noninteractive apt-get install -y \                                                                   
 libupnp-dev \
 libgstreamer1.0-dev \
 gstreamer1.0-plugins-base \                                                                                           
 gstreamer1.0-plugins-good \                                                                                           
 gstreamer1.0-plugins-bad \                                                                                            
 gstreamer1.0-plugins-ugly \                                                                                           
 gstreamer1.0-alsa \                                                                                                   
 gstreamer1.0-libav \                                                                                                  
 gmediarender                                                                                                          


COPY dlna-render.sh /dlna-render.sh                                                                                    
RUN apt-get clean && rm -rf /var/lib/apt/lists                                                                         

ENTRYPOINT [ "/dlna-render.sh" ] 
#!/bin/sh

NAME=gmediarender
DAEMON=/usr/bin/$NAME                                                                                                  


if [ -z "$UPNP_DEVICE_NAME" ]; then                                                                                    
 UPNP_DEVICE_NAME="HomePod-$(hostname)"
fi

$DAEMON --port=49494 -f "$UPNP_DEVICE_NAME"
docker run --rm -d --name dlna_audio -e UPNP_DEVICE_NAME=dlnaaudio --net=host --device /dev/snd:/dev/snd           -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native           -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native           --group-add $(getent group audio | cut -d: -f3)  dlna_audio

simple but works, with AirMusic app and root, havent found an opensource alternative. It works but i mean could be better. Would be nice to have a chromecast like app like youtube tv or something like that

maybe something like this --device /dev/snd:/dev/snd -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native --group-add $(getent group audio | cut -d: -f3)

Worked!

I used:

docker run \
    -it \
    --device /dev/snd \
    -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
    -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \
    -v ~/.config/pulse/cookie:/root/.config/pulse/cookie \
    tuner:latest

maybe something like this --device /dev/snd:/dev/snd -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native --group-add $(getent group audio | cut -d: -f3)

Worked!

I used:

docker run \
    -it \
    --device /dev/snd \
    -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
    -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \
    -v ~/.config/pulse/cookie:/root/.config/pulse/cookie \
    tuner:latest

this might be interesting https://github.com/cbix/gotubecast, also the docker image might be a little fat, i guess python doesnt help might be room for improvement

I'm kinda lost actually. You are trying to play youtube videos on Android?

this might be interesting https://github.com/cbix/gotubecast, also the docker image might be a little fat, i guess python doesnt help might be room for improvement

True. Currently, there's too much external dependencies. I was thinking of replacing the external dependencies with Go libs.

For example, replacing youtube-dl with https://github.com/kkdai/youtube.

With that, only libmpv and mpv would be "hard" dependency. I don't think it's easy to replace mpv tho, cuz the only lib I know that can play audio is beep and none of the youtube formarts are supported.

I'm kinda lost actually. You are trying to play youtube videos on Android?

this might be interesting https://github.com/cbix/gotubecast, also the docker image might be a little fat, i guess python doesnt help might be room for improvement

True. Currently, there's too much external dependencies. I was thinking of replacing the external dependencies with Go libs.

For example, replacing youtube-dl with https://github.com/kkdai/youtube.

With that, only libmpv and mpv would be "hard" dependency. I don't think it's easy to replace mpv tho, cuz the only lib I know that can play audio is beep and none of the youtube formarts are supported.

yeah i was trying to play sound from other devices to a linux box, i found ur project and it works via commandline, but u know commandlines arent very much suited for phone, so i found the dlna solution, it works. But a youtube tv kinda way would be kinda cool also. I think there are many ways. Kinda sad there nothing like airplay on linux that works as well and on every device. Also a big part of listeniing to youtube is using ur account u know, youtube knows ur taste.

I think this is solved