Skip to content

Commit d3e539d

Browse files
authored
[Feature] Allow .asoundrc #167 (#170)
1 parent 3db377c commit d3e539d

File tree

3 files changed

+48
-11
lines changed

3 files changed

+48
-11
lines changed

README.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,20 @@ VOLUME|DESCRIPTION
8181
/music|Where the music is stored. You might consider to mount your directory in read-only mode (`:ro`)
8282
/playlists|Where the playlists are stored
8383
/log|Where all logs are written (e.g. `mpd.log`, `scrobbler.log` etc)
84-
/user/config|Where user configuration files must be located. Currently supported files: `lastfm.txt`, `librefm.txt`, `jamendo.txt` for `mpdscribble` credentials, `additional-alsa-presets.conf` for user-defined alsa presets. Also, the user can create a file named `additional-outputs.txt` including additional outputs, which will be added to the configuration file during the container startup phase.
84+
/user/config|Additional user-provided configuration files, see [this](#user-configuration-volume) paragraph for the details
85+
86+
#### User Configuration volume
87+
88+
Several files can be located in the user configuration (`/user/config`) volume. Here is a table of those files.
89+
90+
FILE|OPTIONAL|DESCRIPTION
91+
:---|:---:|:---
92+
lastfm.txt|yes|LastFM Credentials
93+
librefm.txt|yes|LibreFM Credentials
94+
jamendo.txt|yes|Jamendo Credentials
95+
additional-alsa-presets.conf|yes|Additional alsa presets
96+
additional-outputs.txt|yes|Additional outputs, which will be added to the configuration file during the container startup phase
97+
asoundrc.txt|yes|Alsa configuration file: this will be copied to `/home/mpd-user/.asoundrc` or to `/root/.asoundrc`, depending on user mode to be enabled or not
8598

8699
### Environment Variables
87100

@@ -273,17 +286,13 @@ You can completely uninstall the service by running:
273286

274287
## Build
275288

276-
You can build (or rebuild) the image by opening a terminal from the root of the repository and issuing the following command:
277-
278-
`docker build . -t giof71/mpd-alsa`
279-
280-
It will take very little time even on a Raspberry Pi. When it's finished, you can run the container following the previous instructions.
281-
Just be careful to use the tag you have built.
289+
See [this](https://github.com/GioF71/mpd-alsa-docker/blob/main/doc/build.md) document.
282290

283291
## Change History
284292

285293
Date|Major Changes
286294
:---|:---
295+
2023-01-05|Allowing `.asoundrc`
287296
2022-12-30|Remove `pull=always` from suggested systemd service
288297
2022-12-30|Initial support for equalization (add package `libasound2-plugin-equal`)
289298
2022-12-27|Support for additional `alsa` outputs
@@ -308,7 +317,7 @@ Date|Major Changes
308317
2022-12-07|Support for `auto_resample`
309318
2022-12-03|`HYBRID_DSD_ENABLED` added (enabled by default)
310319
2022-12-03|Removed support for defunct Tidal plugin
311-
2022-12-02|Support for `additional-outputs.txt` where it is possible to add custom outputs
320+
2022-12-02|Support for `additional-outputs.txt`
312321
2022-11-30|Support for `database_mode` with possible values `simple` and `proxy`
313322
2022-11-30|Support for tuning of `music_directory`
314323
2022-11-30|Bump to mpd version `v0.23.11`
@@ -342,10 +351,10 @@ Date|Major Changes
342351
2022-10-26|Added support for `soxr` plugin
343352
2022-10-26|Added support for `alsa` output format (`OUTPUT_FORMAT`)
344353
2022-10-26|Added support for samplerate_converter
345-
2022-10-26|Added support for PulseAudio mode
354+
2022-10-26|Added support for PulseAudio
346355
2022-10-26|Build mpd.conf at container runtime
347-
2022-10-22|Add support for daily builds
348-
2022-10-22|Add builds for ubuntu kinetic as well as for the current lts versions of ubuntu
356+
2022-10-22|Support for daily builds
357+
2022-10-22|Add builds for kinetic along with the current lts versions of ubuntu
349358
2022-10-22|Fixed `AUDIO-GID` now effectively defaulting to `995`
350359
2022-10-21|User mode support
351360
2022-10-21|Add logging support

app/bin/run-mpd.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,16 @@ cat $MPD_ALSA_CONFIG_FILE
671671
CMD_LINE="$mpd_binary --no-daemon $MPD_ALSA_CONFIG_FILE"
672672
echo "CMD_LINE=[$CMD_LINE]"
673673
if [ $USE_USER_MODE == "Y" ]; then
674+
if [ -f "/user/config/asoundrc.txt" ]; then
675+
cp /user/config/asoundrc.txt /home/$USER_NAME/.asoundrc
676+
chown $USER_NAME:$GROUP_NAME /home/$USER_NAME/.asoundrc
677+
chmod 600 /home/$USER_NAME/.asoundrc
678+
fi
674679
su - $USER_NAME -c "$CMD_LINE"
675680
else
681+
if [ -f "/user/config/asoundrc.txt" ]; then
682+
cp /user/config/asoundrc.txt /root/.asoundrc
683+
chmod 644 /root/.asoundrc
684+
fi
676685
eval "$CMD_LINE"
677686
fi

doc/build.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Build
2+
3+
## Using Docker build
4+
5+
You can build (or rebuild) the image by opening a terminal from the root of the repository and issuing the following command:
6+
7+
`docker build . -t giof71/mpd-alsa`
8+
9+
It will take very little time even on a Raspberry Pi. When it's finished, you can run the container following the previous instructions.
10+
Just be careful to use the tag you have built.
11+
12+
## Using the convenience script
13+
14+
There is a script, named `build.sh`, in the root of the repository.
15+
By default it builds using the current debian image and will tag the resulting image as `giof71/mpd-alsa:local`.
16+
17+
### Usage
18+
19+
The usage of the switches should be quite straightforward, but I will add more documentation here, as soon as I can.

0 commit comments

Comments
 (0)