From 2557834bdada429c52112a14fd1cf8d6a5bd8dcd Mon Sep 17 00:00:00 2001 From: Erwin Nindl Date: Tue, 27 Oct 2026 06:32:56 +0100 Subject: [PATCH] initial setup from hoegaarden at github.com https://gist.github.com/hoegaarden/5bf5fe4328b5eacd217658f674667b48 --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ modpidy.sh | 37 +++++++++++++++++++++++++++++++++++++ mopidy.conf | 43 +++++++++++++++++++++++++++++++++++++++++++ mopidy.service | 18 ++++++++++++++++++ requirements.txt | 27 +++++++++++++++++++++++++++ 5 files changed, 159 insertions(+) create mode 100644 Dockerfile create mode 100644 modpidy.sh create mode 100644 mopidy.conf create mode 100644 mopidy.service create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..77f4d2c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +ARG BUILD_FROM=docker.io/arm32v7/debian:bookworm-slim + +FROM $BUILD_FROM + +RUN apt-get update \ + && apt-get install -y wget \ + gstreamer1.0-alsa \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-plugins-bad \ + python3-gst-1.0 \ + python3-lxml \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + libasound2-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt requirements.txt + +RUN pip3 install --break-system-packages -r requirements.txt \ + && rm -rf ~/.cache/pip + +RUN update-ca-certificates --fresh + +RUN mkdir /root/music + +VOLUME ["/root/.cache/mopidy", "/root/.local/share/mopidy", "/root/music"] + +ENV TZ=Europe/Vienna + +EXPOSE 6600 6680 + +ENTRYPOINT ["mopidy"] \ No newline at end of file diff --git a/modpidy.sh b/modpidy.sh new file mode 100644 index 0000000..8deddc8 --- /dev/null +++ b/modpidy.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + +readonly DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd )" + +readonly IMG="github.com/hoegaarden/mopidy:latest" +readonly MUSIC_DIR="/mnt/hufi" +readonly CONF="${DIR}/mopidy.conf" +readonly CACHE_DIR="${DIR}/cache" +readonly SHARE_DIR="${DIR}/share" +readonly NAME="mopidy" + +main() { + build && run +} + +build() { + docker build -t "${IMG}" "${DIR}" +} + +run() { + docker run --rm \ + --name "${NAME}" \ + --device /dev/snd \ + -v "${CONF}:/root/.config/mopidy/mopidy.conf:ro" \ + -v "${MUSIC_DIR}:/root/music:ro" \ + -v "${CACHE_DIR}:/root/.cache/mopidy" \ + -v "${SHARE_DIR}:/root/.local/share/mopidy" \ + -p 6600:6600 \ + -p 6680:6680 \ + "${IMG}" +} + +main "$@" \ No newline at end of file diff --git a/mopidy.conf b/mopidy.conf new file mode 100644 index 0000000..ad416c6 --- /dev/null +++ b/mopidy.conf @@ -0,0 +1,43 @@ +[core] +cache_dir = ~/.cache/mopidy +config_dir = ~/.config/mopidy +data_dir = ~/.local/share/mopidy +restore_state = true + +[logging] +color = true + +[audio] +mixer = software +mixer_volume = 50 +buffer_time = 2000 + +# Soundcard +#output = alsasink device=sysdefault:CARD=IQaudIODAC +output = alsasink device=hw:CARD=Headphones,DEV=0 + +# Snapcast +# output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! tcpclientsink host=127.0.0.1 + +[m3u] +enabled = true + +# [podcast] +# enabled = true +# browse_root = + +[mpd] +enabled = true +hostname = 0.0.0.0 + +[http] +enabled = true +hostname = 0.0.0.0 + +[file] +enabled = true +media_dirs = ~/music/|Music +metadata_timeout = 10000 + +[stream] +enabled = true \ No newline at end of file diff --git a/mopidy.service b/mopidy.service new file mode 100644 index 0000000..3a2a8e1 --- /dev/null +++ b/mopidy.service @@ -0,0 +1,18 @@ +[Unit] +Description=Mopidy +After=docker.service +Requires=docker.service +After=mnt-stuff.mount +Requires=mnt-stuff.mount + +[Service] + +ExecStart=/mnt/stuff/snd/mopidy/mopidy.sh + +Restart=always +RestartSec=10s +TimeoutStartSec=120 +TimeoutStopSec=15 + +[Install] +WantedBy=multi-user.target diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..32a4b14 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,27 @@ +# https://github.com/mopidy/mopidy/releases +Mopidy==3.4.2 + +# https://github.com/mopidy/mopidy-mpd/releases +Mopidy-MPD==3.3.0 + +# https://github.com/impliedchaos/mopidy-bandcamp +Mopidy-Bandcamp==1.1.5 + +# # https://github.com/gbannerman/mopidy-pibox +# Mopidy-Pibox==3.0.6 + +# # https://github.com/cristianpb/muse +# Mopidy-Muse==0.0.41 + +# # https://github.com/mopidy/mopidy-orfradio +# mopidy-orfradio==2.3.0 + +# https://github.com/natumbri/mopidy-youtube +Mopidy-Youtube + +# https://github.com/Lesterpig/mopidy-party +Mopidy-Party + +# https://github.com/sapristi/mopidy-mowecl +Mopidy-Mowecl==0.6.1 +pylast