updayes
This commit is contained in:
parent
87bf4ef540
commit
17efef1634
|
@ -1,5 +1,5 @@
|
||||||
name: MPD
|
name: MPD
|
||||||
version: "0.0.3"
|
version: "0.0.4"
|
||||||
slug: mpd
|
slug: mpd
|
||||||
description: MPD Addon
|
description: MPD Addon
|
||||||
url: "https://forgejo.owo.monster/chaos/hass-mpd/src/branch/main/mpd"
|
url: "https://forgejo.owo.monster/chaos/hass-mpd/src/branch/main/mpd"
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
musicsync
|
|
@ -1,52 +1,11 @@
|
||||||
#!/command/with-contenv bashio
|
#!/command/with-contenv bashio
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Enable Jemalloc for better memory handling
|
|
||||||
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
|
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 \
|
mkdir -p /data/database \
|
||||||
"/media/mpd/media" \
|
/media/mpd/media \
|
||||||
"/media/mpd/playlists"
|
/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/mpd
|
||||||
chown root:root /usr/bin/mpc
|
chown root:root /usr/bin/mpc
|
||||||
|
|
|
@ -1,57 +1,6 @@
|
||||||
#!/command/with-contenv bashio
|
#!/command/with-contenv bashio
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Enable Jemalloc for better memory handling
|
|
||||||
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
|
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
|
||||||
|
|
||||||
bashio::log.info 'Setup Folders'
|
rclone --config /media/rclone.conf sync Music: /media/mpd/music
|
||||||
|
|
||||||
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
|
|
||||||
|
|
Loading…
Reference in a new issue