Remove snapcast, improve storage

This commit is contained in:
Wouter Habets
2017-01-21 12:59:13 +01:00
parent 5fbfe9c947
commit aa5da3f594
13 changed files with 112 additions and 134 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
test-data/

View File

@@ -30,38 +30,35 @@ RUN pip install -U six \
&& pip install Mopidy-Local-Images \ && pip install Mopidy-Local-Images \
&& pip install Mopidy-Party \ && pip install Mopidy-Party \
&& pip install Mopidy-Simple-Webclient \ && pip install Mopidy-Simple-Webclient \
&& pip install --upgrade pafy && pip install Mopidy-Iris \
RUN pip install Mopidy-Mopify \
&& pip install Mopidy-Spotmop \
&& pip install Mopidy-MusicBox-Webclient \ && pip install Mopidy-MusicBox-Webclient \
&& pip install Mopidy-API-Explorer && pip install Mopidy-API-Explorer
ADD snapserver.deb /tmp/snapserver.deb #ADD snapserver.deb /tmp/snapserver.deb
RUN apt-get install -y libavahi-client3 libavahi-common3 \ #RUN apt-get install -y libavahi-client3 libavahi-common3 \
&& dpkg -i /tmp/snapserver.deb \ # && dpkg -i /tmp/snapserver.deb \
&& apt-get install -f \ # && apt-get install -f \
&& rm /tmp/snapserver.deb # && rm /tmp/snapserver.deb
ADD mopidy.conf /var/lib/mopidy/.config/mopidy/mopidy.conf ADD mopidy.conf /etc/mopidy.conf
ADD entrypoint.sh /entrypoint.sh ADD entrypoint.sh /entrypoint.sh
RUN chown mopidy:audio -R /var/lib/mopidy/.config \ RUN chown mopidy:audio -R /var/lib/mopidy \
&& chown mopidy:audio /entrypoint.sh && chown mopidy:audio /entrypoint.sh
USER mopidy ADD localscan /usr/bin/localscan
RUN chmod +x /usr/bin/localscan
VOLUME /var/lib/mopidy/local VOLUME /var/lib/mopidy
VOLUME /var/lib/mopidy/media VOLUME /media
VOLUME /var/lib/mopidy/.config/mopidy/account-config VOLUME /mopidy.conf
EXPOSE 6600 EXPOSE 6600
EXPOSE 6680 EXPOSE 6680
EXPOSE 1704 EXPOSE 6681
EXPOSE 1705
USER mopidy
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/mopidy"] CMD ["/usr/bin/mopidy"]
ADD audio.conf /var/lib/mopidy/.config/mopidy/audio.conf

View File

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

View File

@@ -1,23 +1,59 @@
# Mopidy # Mopidy Docker image
Image for running [Mopidy](https://www.mopidy.com/) in Docker. Image for running [Mopidy](https://www.mopidy.com/) in Docker.
Supports audio output with Pulseaudio or [Snapcast](https://github.com/badaix/snapcast). Uses Pulseaudio for audio output.
## Tags ## Contents
`snapcast` uses Snapcast for audio output ### Frontend extensions
`latest` and `pulseaudio` uses Pulseaudio for audio output * [Iris](https://github.com/jaedb/Iris)
* [Mopidy Musicbox Webclient](https://github.com/pimusicbox/mopidy-musicbox-webclient)
* [Mopidy Party](https://github.com/Lesterpig/mopidy-party)
* [Mopidy Simple webclient](https://github.com/xolox/mopidy-simple-webclient)
* [API explorer](https://github.com/dz0ny/mopidy-api-explorer)
* [Local images](https://github.com/tkem/mopidy-local-images)
### Backend extensions
* Spotify
* Spotify tunigo
* Youtube
* Soundcloud
* Scrobbler
* Tunein
* Local SQLite
## How to use ## How to use
```bash ```bash
docker run \ docker run \
--name mopidy \ --name mopidy \
-e PULSE_SERVER=tcp:127.0.0.1:4713 \ # (Optional) Pulseaudio server for sound -e PULSE_SERVER=tcp:127.0.0.1:4713 \ # Pulseaudio server
-e USE_SNAPCAST=true \ # Set true to activate Snapcast (event with the Snapcast image) -v $PWD/media:/media:ro \ # Media files
-v $PWD/media:/var/lib/mopidy/media:ro \ # Media files -v $PWD/data:/var/lib/mopidy \ # Mopidy data and cache
-v $PWD/local:/var/lib/mopidy/local \ # Some kind of music storage(?) -v $PWD/mopidy.conf:/mopidyconf \ # Override config (for accounts)
-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 6600:6600 \ # Port for MPD -p 6680:6680 \ # Port for the webinterface
-p 6680:6680 \ # Port for the webinterface -p 6681:6681 \ # (Optional) Port for Iris pusher service
-p 1704:1704 \ # Port for Snapcast streaming whhoesj/mopidy
-p 1705:1705 \ # Port for Snapcast control
whhoesj/mopidy
``` ```
## Volumes
To keep the Mopidy data persistent, `/var/lib/mopidy` should be mounted as a volume. The Mopidy user must have write access to this directory. Set this with `chown -R 105 /path/to/data`.
## Accounts
To add Spotify, Last.FM etc. accounts, use the `/mopidy.conf` file. Example:
```
[spotify]
enabled = true
username =
password =
[scrobbler]
enabled = true
username =
password =
[soundcloud]
enabled = true
auth_token =
```
## Local media
To play local media files, mount `/media`. All meta data will be stored using Mopidy-Local-SQLite. To scan for new media files, run `docker exec -it mopidy localscan`.

View File

@@ -1,10 +0,0 @@
[spotify]
username=
password=
[scrobbler]
username=
password=
[soundcloud]
auth_token=

View File

@@ -1,5 +0,0 @@
[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,5 +0,0 @@
[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,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [ "$USE_SNAPCAST" = true ] ; then echo $PWD
snapserver -d cd ~
fi echo $PWD
ls -lsa
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 exec /usr/bin/mopidy --config /etc/mopidy.conf:/mopidy.conf

View File

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

2
localscan Normal file
View File

@@ -0,0 +1,2 @@
#! /bin/bash
/usr/bin/mopidy --config /etc/mopidy.conf:/mopidy.conf local scan

View File

@@ -1,73 +1,38 @@
# For further information about options in this file see: [core]
# http://docs.mopidy.com/ data_dir = /var/lib/mopidy/data
# cache_dir = /var/lib/mopidy/cache
# The initial commented out values reflect the defaults as of: config_dir = /var/lib/mopidy/config
# Mopidy 0.19.4 restore_state = true
# Mopidy-HTTP 0.19.4
# Mopidy-Local 0.19.4
# Mopidy-MPD 0.19.4
# Mopidy-SoftwareMixer 0.19.4
# Mopidy-Stream 0.19.4
#
# Available options and defaults might have changed since then,
# run `mopidy config` to see the current effective config and
# `mopidy --version` to check the current version.
[logging]
#color = true
#console_format = %(levelname)-8s %(message)s
#debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n %(message)s
#debug_file = mopidy.log
#config_file =
[audio] [audio]
# Check audio.conf for audio output config mixer = software
#mixer = software
mixer_volume = 10 mixer_volume = 10
#visualizer = #output = tee name=t t. ! queue ! autoaudiosink t. ! queue ! lamemp3enc ! shout2send mount=mopidy ip=127.0.0.1 port=8000 password=hackme
output = autoaudiosink
[proxy]
#scheme =
#hostname =
#port =
#username =
#password =
[local] [local]
enabled = true enabled = true
#library = json library = sqlite
media_dir = /var/lib/mopidy/media media_dir = /media
data_dir = /var/lib/mopidy/local data_dir = /var/lib/mopidy/local
#playlists_dir = /var/lib/mopidy/playlists scan_flush_threshold = 100
#scan_timeout = 1000 scan_timeout = 5000
#scan_flush_threshold = 1000
#excluded_file_extensions = [file]
# .directory enabled = false
# .html
# .jpeg
# .jpg
# .log
# .nfo
# .png
# .txt
[mpd] [mpd]
enabled = true enabled = true
hostname = 0.0.0.0 hostname = 0.0.0.0
port = 6600 port = 6600
#password =
max_connections = 20 max_connections = 20
connection_timeout = 60 connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname zeroconf = Mopidy MPD server on $hostname
[softwaremixer]
#enabled = true
[http] [http]
enabled = true enabled = true
hostname = 0.0.0.0 hostname = 0.0.0.0
port = 6680 port = 6680
#static_dir =
zeroconf = Mopidy HTTP server on $hostname zeroconf = Mopidy HTTP server on $hostname
[stream] [stream]
@@ -79,13 +44,9 @@ protocols =
rtmp rtmp
rtmps rtmps
rtsp rtsp
#metadata_blacklist =
#timeout = 5000
[spotify] [spotify]
enabled = true enabled = false
#username =
#password =
bitrate = 320 bitrate = 320
[spotify_tunigo] [spotify_tunigo]
@@ -97,11 +58,9 @@ enabled = false
[soundcloud] [soundcloud]
enabled = false enabled = false
#auth_token =
[scrobbler] [scrobbler]
enabled = false enabled = false
#username =
#password =
[musicbox_webclient]
on_track_click = PLAY_NOW

Binary file not shown.

13
test.sh Executable file
View File

@@ -0,0 +1,13 @@
#! /bin/bash
docker run \
--rm \
--name mopidy \
-e PULSE_SERVER=tcp:10.10.0.1:4713 \
-v /home/wouter/Muziek/Spotify:/media:ro \
-v $PWD/test-data:/var/lib/mopidy \
-v $PWD/accounts.conf:/mopidy.conf \
-p 6600:6600 \
-p 6680:6680 \
-p 6681:6681 \
whhoesj/mopidy:latest