Merge branch 'snapcast'

This commit is contained in:
Wouter Habets
2016-12-02 18:07:44 +01:00
9 changed files with 66 additions and 21 deletions

View File

@@ -37,6 +37,11 @@ RUN pip install Mopidy-Mopify \
&& pip install Mopidy-MusicBox-Webclient \
&& pip install Mopidy-API-Explorer
ADD snapserver.deb /tmp/snapserver.deb
RUN apt-get install -y libavahi-client3 libavahi-common3 \
&& dpkg -i /tmp/snapserver.deb \
&& apt-get install -f \
&& rm /tmp/snapserver.deb
ADD mopidy.conf /var/lib/mopidy/.config/mopidy/mopidy.conf
@@ -53,6 +58,10 @@ VOLUME /var/lib/mopidy/.config/mopidy/account-config
EXPOSE 6600
EXPOSE 6680
EXPOSE 1704
EXPOSE 1705
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/mopidy"]
ADD audio.conf /var/lib/mopidy/.config/mopidy/audio.conf

21
Makefile Normal file
View File

@@ -0,0 +1,21 @@
all: snapcast pulseaudio
snapcast:
cp audio-snapcast.conf audio.conf
docker build -t whhoesj/mopidy:snapcast .
pulseaudio:
cp audio-pulseaudio.conf audio.conf
docker build -t whhoesj/mopidy:pulseaudio .
docker build -t whhoesj/mopidy:latest .
push:
docker push whhoesj/mopidy:snapcast
docker push whhoesj/mopidy:pulseaudio
docker push whhoesj/mopidy:latest
clean:
-rm -rfv audio.conf
-docker rmi whhoesj/mopidy:snapcast
-docker rmi whhoesj/mopidy:pulseaudio
-docker rmi whhoesj/mopidy:latest

View File

@@ -1,17 +1,23 @@
Mopidy
======
Image for running Mopidy in Docker.
Based on [wernight/docker-mopidy](https://github.com/wernight/docker-mopidy).
# Mopidy
Image for running [Mopidy](https://www.mopidy.com/) in Docker.
Supports audio output with Pulseaudio or [Snapcast](https://github.com/badaix/snapcast).
## Tags
`snapcast` uses Snapcast for audio output
`latest` and `pulseaudio` uses Pulseaudio for audio output
## How to use
```bash
docker run \
--name mopidy \
-e PULSE_SERVER=tcp:127.0.0.1:4713 \ # Pulseaudio server for sound
-e PULSE_SERVER=tcp:127.0.0.1:4713 \ # (Optional) Pulseaudio server for sound
-e USE_SNAPCAST=true \ # Set true to activate Snapcast (event with the Snapcast image)
-v $PWD/media:/var/lib/mopidy/media:ro \ # Media files
-v $PWD/local:/var/lib/mopidy/local \ # Some kind of music storage(?)
-v $PWD/local:/var/lib/mopidy/local \ # Some kind of music storage(?)
-v $PWD/account-config:/var/lib/mopidy/.config/mopidy/account-config \ # Place here the account configurations (see account-config.conf)
-p 6600:6600 \ # Port for MPD
-p 6680:6680 \ # Port for the webinterface
whhoesj/mopidy-web
-p 1704:1704 \ # Port for Snapcast streaming
-p 1705:1705 \ # Port for Snapcast control
whhoesj/mopidy
```

5
audio-pulseaudio.conf Normal file
View File

@@ -0,0 +1,5 @@
[output]
# USE THIS FOR PULSEAUDIO
output = autoaudiosink
# USE THIS FOR SNAPCAST
#output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo

5
audio-snapcast.conf Normal file
View File

@@ -0,0 +1,5 @@
[output]
# USE THIS FOR PULSEAUDIO
#output = autoaudiosink
# USE THIS FOR SNAPCAST
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo

View File

@@ -1,11 +1,7 @@
#!/bin/bash
mopidy local scan
if [[ "$PULSE_COOKIE_DATA" != "" ]]
then
echo -ne $(echo $PULSE_COOKIE_DATA | sed -e 's/../\\x&/g') >$HOME/pulse.cookie
export PULSE_COOKIE=$HOME/pulse.cookie
if [ "$USE_SNAPCAST" = true ] ; then
snapserver -d
fi
exec /usr/bin/mopidy --config /var/lib/mopidy/.config/mopidy/mopidy.conf:/var/lib/mopidy/.config/mopidy/account-config/accounts.conf
exec /usr/bin/mopidy --config /var/lib/mopidy/.config/mopidy/mopidy.conf:/var/lib/mopidy/.config/mopidy/account-config/accounts.conf:/var/lib/mopidy/.config/mopidy/account-config/audio.conf

3
local-scan.sh Executable file
View File

@@ -0,0 +1,3 @@
#! /bin/bash
docker exec -it mopidy mopidy local scan

View File

@@ -21,9 +21,9 @@
#config_file =
[audio]
# Check audio.conf for audio output config
#mixer = software
mixer_volume = 10
#output = autoaudiosink
#visualizer =
[proxy]
@@ -55,7 +55,7 @@ data_dir = /var/lib/mopidy/local
enabled = true
hostname = 0.0.0.0
port = 6600
#password = dada123
#password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
@@ -96,11 +96,11 @@ region = all
enabled = false
[soundcloud]
enabled = true
enabled = false
#auth_token =
[scrobbler]
enabled = true
enabled = false
#username =
#password =

BIN
snapserver.deb Normal file

Binary file not shown.