diff options
| author | s-ol <s+removethis@s-ol.nu> | 2022-05-13 08:07:30 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2022-05-13 08:07:30 +0000 |
| commit | 4cc5d90debae95114945c6c32f31888beca4b3f8 (patch) | |
| tree | 1c5985ce344965054a72944ed90c322b9e7cc3e9 /snapserver/run.sh | |
| download | hassio-addons-main.tar.gz hassio-addons-main.zip | |
initial commitmain
Diffstat (limited to 'snapserver/run.sh')
| -rw-r--r-- | snapserver/run.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/snapserver/run.sh b/snapserver/run.sh new file mode 100644 index 0000000..e85e3d6 --- /dev/null +++ b/snapserver/run.sh @@ -0,0 +1,44 @@ + +#!/usr/bin/env bashio + +mkdir -p /share/snapfifo +mkdir -p /share/snapcast + +config=/etc/snapserver.conf + +if ! bashio::fs.file_exists '/etc/snapserver.conf'; then + touch /etc/snapserver.conf || + bashio::exit.nok "Could not create snapserver.conf file on filesystem" +fi +bashio::log.info "Populating snapserver.conf..." + +# Start creation of configuration + +echo "[stream]" > "${config}" +for stream in $(bashio::config 'stream.streams'); do + echo "stream = ${stream}" >> "${config}" +done +echo "buffer = $(bashio::config 'stream.buffer')" >> "${config}" +echo "codec = $(bashio::config 'stream.codec')" >> "${config}" +echo "send_to_muted = $(bashio::config 'stream.send_to_muted')" >> "${config}" +echo "sampleformat = $(bashio::config 'stream.sampleformat')" >> "${config}" + +echo "[http]" >> "${config}" +echo "enabled = $(bashio::config 'http.enabled')" >> "${config}" +echo "doc_root = $(bashio::config 'http.docroot')" >> "${config}" + +echo "[tcp]" >> "${config}" +echo "enabled = $(bashio::config 'tcp.enabled')" >> "${config}" + +echo "[logging]" >> "${config}" +echo "debug = $(bashio::config 'logging.enabled')" >> "${config}" + +echo "[server]" >> "${config}" +echo "threads = $(bashio::config 'server.threads')" >> "${config}" + +echo "[server]" >> "${config}" +echo "datadir = $(bashio::config 'server.datadir')" >> "${config}" + +bashio::log.info "Starting SnapServer..." + +/usr/bin/snapserver -c /etc/snapserver.conf |
