updayes
This commit is contained in:
parent
87bf4ef540
commit
17efef1634
|
@ -1,5 +1,5 @@
|
|||
name: MPD
|
||||
version: "0.0.3"
|
||||
version: "0.0.4"
|
||||
slug: mpd
|
||||
description: MPD Addon
|
||||
url: "https://forgejo.owo.monster/chaos/hass-mpd/src/branch/main/mpd"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
musicsync
|
|
@ -1,52 +1,11 @@
|
|||
#!/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
|
||||
/media/mpd/media \
|
||||
/media/mpd/playlists
|
||||
|
||||
chown root:root /usr/bin/mpd
|
||||
chown root:root /usr/bin/mpc
|
||||
|
|
|
@ -1,57 +1,6 @@
|
|||
#!/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
|
||||
rclone --config /media/rclone.conf sync Music: /media/mpd/music
|
||||
|
|
Loading…
Reference in a new issue