mpd.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. docker run -it --rm --privileged --device=/dev/snd:/dev/snd --name mpd -p 6600:6600 -p 8000:8000 arm32v6/alpine
  2. apk --no-cache add mpd mpc ncmpc ffmpeg alsa-utils
  3. mkdir -p /var/lib/mpd/music
  4. mkdir -p /var/lib/mpd/.mpd/playlists
  5. touch /var/lib/mpd/.mpd/database
  6. touch /var/lib/mpd/.mpd/state
  7. chown -R mpd:audio /var/lib/mpd/
  8. cat <<EOF | tee /etc/asound.conf
  9. defaults.pcm.card 1
  10. defaults.ctl.card 1
  11. }
  12. EOF
  13. cat <<EOF | tee /etc/asound.conf
  14. pcm.!default {
  15. type plug
  16. slave {
  17. pcm "hw:1,0"
  18. }
  19. }
  20. ctl.!default {
  21. type hw
  22. card 1
  23. }
  24. EOF
  25. cat <<EOF | tee /etc/mpd.conf
  26. music_directory "~/music"
  27. playlist_directory "~/.mpd/playlists"
  28. db_file "~/.mpd/database"
  29. log_file "/dev/stdout"
  30. pid_file "~/.mpd/pid"
  31. state_file "~/.mpd/state"
  32. sticker_file "~/.mpd/sticker.sql"
  33. user "mpd"
  34. group "audio"
  35. bind_to_address "any"
  36. port "6600"
  37. log_level "default"
  38. auto_update "yes"
  39. follow_outside_symlinks "yes"
  40. follow_inside_symlinks "yes"
  41. zeroconf_enabled "no"
  42. audio_output {
  43. type "alsa"
  44. name "Device"
  45. }
  46. EOF
  47. su mpd -s /bin/sh -c \
  48. "wget -O /var/lib/mpd/music/toto.wav https://www.ee.columbia.edu/~dpwe/sounds/music/africa-toto.wav"
  49. cp /usr/share/sounds/alsa/Noise.wav /var/lib/mpd/music/
  50. mpc update && mpc ls | mpc add && mpc play
  51. /usr/bin/mpd --no-daemon --stdout &
  52. fg