git.s-ol.nu hassio-addons / 4cc5d90
initial commit s-ol 1 year, 4 months ago
6 changed file(s) with 128 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 name: "s-ol's Addons"
1 url: https://git.s-ol.nu/hassio-addons/
2 maintainer: s-ol bekic
0 ARG BUILD_FROM
1 FROM $BUILD_FROM
2
3 # Add env
4 ENV LANG C.UTF-8
5
6 # Install snapcast and librespot
7 RUN apk -U add bash build-base curl cargo portaudio-dev protobuf-dev \
8 && cd /root \
9 && curl -LO https://github.com/librespot-org/librespot/archive/refs/tags/v0.3.1.zip \
10 && unzip v0.3.1.zip \
11 && cd librespot-0.3.1 \
12 && cargo build --jobs $(grep -c ^processor /proc/cpuinfo) --release --no-default-features \
13 && mv target/release/librespot /usr/local/bin \
14 && cd / \
15 && apk --purge del curl cargo portaudio-dev protobuf-dev \
16 && apk add llvm-libunwind snapcast-server \
17 && rm -rf /etc/ssl /var/cache/apk/* /lib/apk/db/* /root/v0.1.3.zip /root/librespot-0.3.1 /root/.ca
18
19 # Copy data for add-on
20 COPY run.sh /
21 RUN chmod a+x /run.sh
22
23 CMD [ "/run.sh" ]
0 {
1 "name": "snapcast-server",
2 "version": "0.25",
3 "slug": "snapcastserver",
4 "description": "Snapcast Server (with librespot)",
5 "startup": "system",
6 "boot": "auto",
7 "map": ["share:rw"],
8 "options": {
9 "stream": {
10 "streams": ["pipe:///share/snapfifo/librespot?name=SpotifyConnect&sampleformat=44100:16:2", "pipe:///share/snapfifo/mopidy?name=Mopidy&sampleformat=44100:16:2", "tcp://0.0.0.0?port=4953&name=snapbroadcast"],
11 "buffer": "1000",
12 "codec": "flac",
13 "send_to_muted": "false",
14 "sampleformat": "48000:16:2"
15 },
16 "http": {
17 "enabled": "true",
18 "doc_root": " "
19 },
20 "tcp": {
21 "enabled": "true"
22 },
23 "logging": {
24 "enabled": "true"
25 },
26 "server": {
27 "threads": "-1",
28 "datadir": "/share/snapcast/"
29 }
30 },
31 "schema": {
32 "stream": {
33 "streams": ["str"],
34 "buffer": "int",
35 "codec": "str",
36 "send_to_muted": "str",
37 "sampleformat": "str"
38 },
39 "http": {
40 "enabled": "str",
41 "doc_root": "str"
42 },
43 "tcp": {
44 "enabled": "str"
45 },
46 "logging": {
47 "enabled": "str"
48 },
49 "server": {
50 "threads": "int",
51 "datadir": "str"
52 }
53 },
54 "ports": {"1704/tcp": 1704, "1705/tcp": 1705, "1780/tcp": 1780, "4953/tcp": 4953},
55 "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"]
56 }
Binary diff not shown
Binary diff not shown
0
1 #!/usr/bin/env bashio
2
3 mkdir -p /share/snapfifo
4 mkdir -p /share/snapcast
5
6 config=/etc/snapserver.conf
7
8 if ! bashio::fs.file_exists '/etc/snapserver.conf'; then
9 touch /etc/snapserver.conf ||
10 bashio::exit.nok "Could not create snapserver.conf file on filesystem"
11 fi
12 bashio::log.info "Populating snapserver.conf..."
13
14 # Start creation of configuration
15
16 echo "[stream]" > "${config}"
17 for stream in $(bashio::config 'stream.streams'); do
18 echo "stream = ${stream}" >> "${config}"
19 done
20 echo "buffer = $(bashio::config 'stream.buffer')" >> "${config}"
21 echo "codec = $(bashio::config 'stream.codec')" >> "${config}"
22 echo "send_to_muted = $(bashio::config 'stream.send_to_muted')" >> "${config}"
23 echo "sampleformat = $(bashio::config 'stream.sampleformat')" >> "${config}"
24
25 echo "[http]" >> "${config}"
26 echo "enabled = $(bashio::config 'http.enabled')" >> "${config}"
27 echo "doc_root = $(bashio::config 'http.docroot')" >> "${config}"
28
29 echo "[tcp]" >> "${config}"
30 echo "enabled = $(bashio::config 'tcp.enabled')" >> "${config}"
31
32 echo "[logging]" >> "${config}"
33 echo "debug = $(bashio::config 'logging.enabled')" >> "${config}"
34
35 echo "[server]" >> "${config}"
36 echo "threads = $(bashio::config 'server.threads')" >> "${config}"
37
38 echo "[server]" >> "${config}"
39 echo "datadir = $(bashio::config 'server.datadir')" >> "${config}"
40
41 bashio::log.info "Starting SnapServer..."
42
43 /usr/bin/snapserver -c /etc/snapserver.conf