hzeller / gmrender-resurrect

Resource efficient UPnP/DLNA renderer, optimal for Raspberry Pi, CuBox or a general MediaServer. Fork of GMediaRenderer to add some features to make it usable.
GNU General Public License v2.0
851 stars 206 forks source link

Requiring pulseaudio.service or pulseaudio.socket with in systemd gmediarender.service #165

Open stormwatch opened 6 years ago

stormwatch commented 6 years ago

Hi all:

I'd like to know if there is a way for gmediarender.service running with user name 'gmediarender' to require pulseaudio (service or socket) as opposed to running pulseaudio as a system-wide daemon.

Would it be better to run gmediarender.service with systemctl --user since pulseaudio is defined as a user service too?

Thanks

hzeller commented 6 years ago

Yes, you can start gmediarender as any user.

stormwatch commented 6 years ago

For the record, I ended up with the original provided systemd unit service but then configured pulseaudio unix sockets as described in https://wiki.archlinux.org/index.php/PulseAudio/Examples#Allowing_multiple_users_to_use_PulseAudio_at_the_same_time

in /etc/pulse/default.pa: load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-socket

and in /etc/pulse/client.conf: default-server = unix:/tmp/pulse-socket

phpbg commented 4 years ago

I just spent hours trying to achieve this before I saw your post. Thanks!

There should be a word about this in the doc...

almereyda commented 3 years ago

I didn't need to reconfigure Pulseaudio with using

/etc/systemd/user/gmrender-resurrect.service
[Unit]
Description=gmrender-resurrect service
After=network.target sound.target

[Service]
Type=simple
Restart=always
PIDFile=/run/user/%U/gmrenderer.pid
EnvironmentFile=/etc/default/gmediarender
ExecStart=/bin/bash -c ' \
                       /usr/local/bin/gmediarender \
                           -f "`hostname`" \
                           -u "`cat /etc/machine-id`" \
                           -P /run/user/%U/gmrenderer.pid \
                           --gstout-initial-volume-db=$INITIAL_VOLUME_DB \
                           $DAEMON_EXTRA_ARGS \
                       '

[Install]
WantedBy=multi-user.target

and with

/etc/default/gmediarender
INITIAL_VOLUME_DB=-10
DAEMON_EXTRA_ARGS="--gstout-audiosink=alsasink --gstout-audiodevice=pulse"