Skip to content

Commit

Permalink
Merge pull request #66 from GioF71/65-improve-documentation
Browse files Browse the repository at this point in the history
65 improve documentation
  • Loading branch information
GioF71 committed Sep 16, 2022
2 parents 9dcd755 + 0f6faf7 commit 9d0b4ba
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 21 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ ENV SQUEEZELITE_VISUALIZER ""

ENV DISPLAY_PRESETS ""

ENV PUID ""
ENV PGID ""

RUN mkdir /app
RUN mkdir /app/bin/

Expand Down Expand Up @@ -65,8 +68,9 @@ RUN mkdir /app/assets

VOLUME '/app/assets/additional-presets.conf'

COPY README.md /app/doc
COPY RELEASE.md /app/doc
COPY README.md /app/doc/
COPY RELEASE.md /app/doc/
COPY doc/* /app/doc/
COPY app/assets/builtin-presets.conf /app/assets/
COPY app/assets/pulse-client-template.conf /app/assets/pulse-client-template.conf

Expand Down
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ The following tables reports all the currently supported environment variables.
Variable|SqueezeLite corresponding option|Default|Notes
:---|:---:|:---:|:---
SQUEEZELITE_MODE||ALSA|Set to PULSE for [PulseAudio](#pulseaudio) mode
PUID||1000|User ID for PulseAudio Mode
PGID||1000|Gser ID for PulseAudio Mode
PRESET|||You can now choose to set variables using predefined presets. Presets can currently tune the values of `SQUEEZELITE_AUDIO_DEVICE`, `SQUEEZELITE_RATES`, `SQUEEZELITE_UPSAMPLING`, `SQUEEZELITE_CODECS` and `SQUEEZELITE_EXCLUDE_CODECS` for you. See the [Available presets](#available-presets) table for reference. Presets can be combined (the separator must be a comma `,`), but keep in mind that the first preset setting a variable has the priority: one set by a preset, a variable cannot be overwritten by subsequent presets.
SQUEEZELITE_AUDIO_DEVICE|-o||The audio device. Common examples: `hw:CARD=x20,DEV=0` or `hw:CARD=DAC,DEV=0` for usb dac based on XMOS. If left empty, the default alsa device is used.
SQUEEZELITE_PARAMS|-a||Please refer to the squeezelite's man page for `-a`.
Expand Down Expand Up @@ -204,8 +206,17 @@ no-dsd|2022-02-14|Excluded Codecs|Exclude dsd codec

## PulseAudio

You can specify PulseAudio mode by setting `SQUEEZELITE_MODE` to `PULSE`.
For that configuration to work properly, `/run/user/1000/pulse` must be mapped correctly. The example below assumes that your user id is `1000`. Mapping the device `/dev/snd` is not needed in PulseAudio mode. Also, most of the enviroment variables are not supported and, for the largest part, they would be irrelevant. I will add support for those that will appear to be relevant. Feel free to open issue(s).
You can specify PulseAudio mode by setting the environment variable `SQUEEZELITE_MODE` to `PULSE`.
For that configuration to work properly, `/run/user/1000/pulse` must be mapped correctly. The example below assumes that your user id is `1000`. The `PUID` and `PGID` variables should be set according to your user and groupid. Use the `id` command to see the uid for the currently logged in user.
Mapping the device `/dev/snd` is not needed in PulseAudio mode.
Also, most of the enviroment variables are not supported and, for the largest part, they would be irrelevant. I will add support for those that will appear to be relevant. Feel free to open issue(s).
A list of the variables that are configurable for PulseAudio mode:

- PUID
- PGID
- SQUEEZELITE_NAME
- SQUEEZELITE_SERVER_PORT


```code
---
Expand All @@ -216,13 +227,14 @@ services:
image: giof71/squeezelite:stable
container_name: sq-pulse
volumes:
# change only on the left side according to your uid
- /run/user/1000/pulse:/run/user/1000/pulse
environment:
- PUID=1000
- PGID=1000
- SQUEEZELITE_MODE=pulse
- SQUEEZELITE_NAME=sq-pulse
- SQUEEZELITE_SERVER_PORT=192.168.1.10
- PUID=1000 #optional, default is 1000
- PGID=1000 #optional, default is 1000
- SQUEEZELITE_NAME=sq-pulse #optional
- SQUEEZELITE_SERVER_PORT=192.168.1.10 #optional
```

I would avoid to add a restart strategy to the compose file with PulseAudio. On my desktop setup, doing so led to all sort of issues on computer startup/reboot. Instead, I would use a user-level systemd service. An example is container in the `pulse` directory of this repository.
Expand Down Expand Up @@ -255,7 +267,9 @@ For the new variables introduced over time, see the following table.

New Variable|Availability Date|Comment
:---|:---|:---
SQUEEZELITE_MODE|2022-09-16|Support for PulseAudio
SQUEEZELITE_MODE|2022-09-15|Introduced support for PulseAudio
UID|2022-09-15|User id for PulseAudio Mode
GID|2022-09-15|Group id for PulseAudio Mode
SQUEEZELITE_VISUALIZER|2022-06-09|Add support for visualizer (-v).
SQUEEZELITE_EXCLUDE_CODECS|2022-02-14|Added support for configuration option
SQUEEZELITE_RATES|2021-11-23|Added support for configuration option
Expand Down
7 changes: 7 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Releases

### 2022-09-16

Feature|Description
:---|:---
Documentation|More documentation for PulseAudio mode
Cleanup|Fixed use of PUID and PGID

### 2022-09-15-pulse

Feature|Description
Expand Down
13 changes: 13 additions & 0 deletions app/bin/run-squeezelite-pulse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

echo "Running in pulse mode"

DEFAULT_UID=1000
DEFAULT_GID=1000

if [ -z "${PUID}" ]; then
PUID=$DEFAULT_UID;
echo "Setting default value for PUID: ["$PUID"]"
fi

if [ -z "${PGID}" ]; then
PGID=$DEFAULT_GID;
echo "Setting default value for PGID: ["$PGID"]"
fi

USER_NAME=sq-pulse
GROUP_NAME=sq-pulse

Expand Down
12 changes: 6 additions & 6 deletions app/bin/run-squeezelite.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash

export SQUEEZELITE_MODE_ALSA=ALSA
export SQUEEZELITE_MODE_PULSE=PULSE
export DEFAULT_SQUEEZELITE_MODE=$SQUEEZELITE_MODE_ALSA
export DEFAULT_STARTUP_DELAY_SEC=0
export DEFAULT_SQUEEZELITE_DELAY=500
export DEFAULT_SQUEEZELITE_TIMEOUT=2
SQUEEZELITE_MODE_ALSA=ALSA
SQUEEZELITE_MODE_PULSE=PULSE
DEFAULT_SQUEEZELITE_MODE=$SQUEEZELITE_MODE_ALSA
DEFAULT_STARTUP_DELAY_SEC=0
DEFAULT_SQUEEZELITE_DELAY=500
DEFAULT_SQUEEZELITE_TIMEOUT=2

if [ -z "${SQUEEZELITE_MODE}" ]; then
SQUEEZELITE_MODE=$DEFAULT_SQUEEZELITE_MODE;
Expand Down
2 changes: 1 addition & 1 deletion pulse/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
cp squeezelite-docker-pulse.service ~/.config/systemd/user/

systemctl --user daemon-reload
systemctl --user enable squeezelite-docker-pulse --now
systemctl --user enable squeezelite-docker-pulse
3 changes: 2 additions & 1 deletion pulse/restart.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh

systemctl --user restart squeezelite-docker-pulse
systemctl --user stop squeezelite-docker-pulse
systemctl --user start squeezelite-docker-pulse


9 changes: 5 additions & 4 deletions pulse/squeezelite-docker-pulse.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ ExecStartPre=-/usr/bin/docker stop squeezelite-pulse
ExecStartPre=-/usr/bin/docker rm squeezelite-pulse
ExecStartPre=-/usr/bin/docker network create squeezelite-pulse
ExecStart=/usr/bin/docker run -i \
--network=squeezelite-pulse \
--network=squeezelite-pulse \
-e PUID=%U \
-e PGID=%G \
-e PGID=%G \
-e SQUEEZELITE_MODE=PULSE \
-e SQUEEZELITE_NAME=xeon10-pulse-exp \
-e SQUEEZELITE_NAME=xeon10-pulse-exp \
-e SQUEEZELITE_SERVER_PORT=lms.homelab.com \
-v /run/user/%U/pulse:/run/user/1000/pulse \
-v /run/user/%U/pulse:/run/user/%U/pulse \
--name squeezelite-pulse \
--label com.centurylinklabs.watchtower.enable=false \
giof71/squeezelite:stable

ExecStop=-/usr/bin/docker stop squeezelite-pulse
Expand Down

0 comments on commit 9d0b4ba

Please sign in to comment.