This commit is contained in:
chaos 2025-02-03 12:15:19 +00:00
parent 3d3fbe5c00
commit 9d72f4397b
No known key found for this signature in database
11 changed files with 132 additions and 0 deletions

11
mpd/Dockerfile Normal file
View file

@ -0,0 +1,11 @@
ARG BUILD_FROM
FROM $BUILD_FROM
RUN apk add --no-cache \
mpc=0.35-r0 \
mpd=0.23.15-r2 \
ympd=1.3.0-r12
ENTRYPOINT [ "/init" ]
CMD []
COPY root /

6
mpd/build.yaml Normal file
View file

@ -0,0 +1,6 @@
build_from:
armhf: ghcr.io/home-assistant/armhf-base:3.21
armv7: ghcr.io/home-assistant/armv7-base:3.21
aarch64: ghcr.io/home-assistant/aarch64-base:3.21
amd64: ghcr.io/home-assistant/amd64-base:3.21
i386: ghcr.io/home-assistant/i386-base:3.21

25
mpd/config.yaml Normal file
View file

@ -0,0 +1,25 @@
name: MPD
version: dev
slug: mpd
panel_icon: mdi:music-circle
description: Music Player Daemon is a free and open source music player. It plays audio files, organizes playlists and maintains a music database
url: https://forgejo.owo.monster/chaos/hass-mpd
arch:
- armv7
- armhf
- aarch64
- amd64
- i386
init: false
audio: true
devices:
- /dev/snd
map:
- share:rw
- media:rw
ports:
6600/tcp: 6600
ports_description:
6600/tcp: MPD
options:
schema:

BIN
mpd/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
mpd/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

29
mpd/root/etc/mpd.conf Normal file
View file

@ -0,0 +1,29 @@
music_directory "/media/mpd/music"
playlist_directory "/media/mpd/playlists"
db_file "/data/database/mpd.db"
sticker_file "/data/sticker.sql"
filesystem_charset "UTF-8"
log_file "syslog"
log_level "default"
bind_to_address "0.0.0.0"
port "6600"
zeroconf_enabled "no"
host_permissions "127.0.0.1 read,add,control,admin"
audio_output {
type "pulse"
name "Home Assistant Pulseaudio"
}
audio_output_format "48000:24:2"
audio_buffer_size "4096"
resampler {
plugin "soxr"
quality "very high"
threads "0"
}
replaygain "track"
auto_update "yes"
metadata_to_use "title,artist"

View file

@ -0,0 +1,57 @@
#!/command/with-contenv bashio
set -e
# Enable Jemalloc for better memory handling
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
bashio::log.info 'Setup Folders'
MEDIA_FOLDER=$(bashio::config 'media_folder')
PLAYLIST_FOLDER=$(bashio::config 'playlist_folder')
mkdir -p /data/database \
"/media/mpd/media" \
"/media/mpd/playlists"
bashio::log.info 'Setup settings'
if [ "$(bashio::config 'custom_config')" != 'null' ]; then
bashio::log.info 'Use custom config'
cp "$(bashio::config 'custom_config')" '/etc/mpd.conf'
else
bashio::log.info 'Set media folder'
MEDIA_FOLDER=$(bashio::config 'media_folder')
sed -i "s/music_directory.*/music_directory \"${MEDIA_FOLDER//\//\\/}\"/" /etc/mpd.conf
bashio::log.info 'Set playlist folder'
PLAYLIST_FOLDER=$(bashio::config 'playlist_folder')
sed -i "s/playlist_directory.*/playlist_directory \"${PLAYLIST_FOLDER//\//\\/}\"/" /etc/mpd.conf
if [ "$(bashio::config 'volume_normalization')" == 'true' ]; then
sed -i "/^#volume_normalization/s/^#//" /etc/mpd.conf
fi
if [ "$(bashio::config 'verbose')" == 'true' ]; then
sed -i "/^log_level/s/default/verbose/" /etc/mpd.conf
fi
if [ "$(bashio::config 'httpd_output')" == 'true' ]; then
printf '\n
audio_output { \n
type "httpd" \n
name "HTTPd Output" \n
port "8000" \n
bitrate "192" \n
always_on "yes" \n
}' >> /etc/mpd.conf
bashio::log.info 'HTTPd output enabled'
fi
fi
chown root:root /usr/bin/mpd
chown root:root /usr/bin/mpc
chmod 0774 /usr/bin/mpd
chmod 0774 /usr/bin/mpc
bashio::log.info 'Start MPD'
mpd --stdout --no-daemon

View file

@ -0,0 +1 @@
longrun

3
repository.yaml Normal file
View file

@ -0,0 +1,3 @@
name: MPD Plugin Repo
url: 'https://forgejo.owo.monster/chaos/hass-mpd'
maintainer: chaos <chaos@owo.monster>