add rclone and sync?

This commit is contained in:
chaos 2025-02-03 12:46:44 +00:00
parent 42b378f222
commit 87bf4ef540
No known key found for this signature in database
6 changed files with 64 additions and 1 deletions

View file

@ -1,4 +1,9 @@
ARG BUILD_FROM
FROM $BUILD_FROM
RUN apk add \
mpc \
mpd \
rclone
COPY rootfs /

View file

@ -1,5 +1,5 @@
name: MPD
version: "0.0.2"
version: "0.0.3"
slug: mpd
description: MPD Addon
url: "https://forgejo.owo.monster/chaos/hass-mpd/src/branch/main/mpd"

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 @@
oneshot