Squeezelite

From LinuxMCE
Revision as of 15:31, 20 March 2014 by Esperanto (Talk | contribs) (stop section)

Jump to: navigation, search

An alternative for squeezeslave.

Downloadable executables and source at:

http://code.google.com/p/squeezelite/


Squeezelite upstart (/etc/init/squeezelite.conf). This is run after pulseaudio is started up and uses the pulseaudio sink 'kitchen'.

# squeezelite service

description     "squeezelite"

start on started pulseaudio
stop on starting shutdown or stopping pulseaudio

respawn

env EXEC="/root/squeezelite-i386"
env ARGS="-a 180 -o pulse"
env LOGGING="-d all=info"
env MAC="00:00:00:00:00:04"
env LOGFILE="/var/log/squeezelite.log"
env PIDFILE="/var/run/squeezelite.pid"
env NAME="kitchen"
env PULSE_SINK="kitchen"
env PULSE_PROP_OVERRIDE="application.name='squeezelite kitchen'"
env SERVER="192.168.80.1"

exec start-stop-daemon  -m --pidfile $PIDFILE --exec $EXEC --start -- -s $SERVER $ARGS $LOGGING -m $MAC -f $LOGFILE -n $NAME

Take care of the logfile

/var/log/squeezelite.log {
       daily
       rotate 7
       delaycompress
       compress
       missingok
       postrotate 
        [ ! -f /var/run/squeezelite.pid ] || kill -HUP `cat /var/run/squeezelite.pid`
       endscript
}

Since pulseaudio is started via /etc/init.d/ instead of upstart I changed /etc/init.d/pulseaudio and added to end of the pulseaudio_start () section:

        if [ ${status} -eq 0 ]; then
                initctl emit started JOB=pulseaudio
        fi
        log_end_msg ${status}

And added an emit entry to the /etc/init.d/pulseaudio pulseaudio_stop () section:

pulseaudio_stop () {
        log_daemon_msg "Stopping system PulseAudio Daemon"
        start-stop-daemon -p $PIDFILE --stop --retry 5 || echo -n "...which is not running"
        initctl emit stopping JOB=pulseaudio
        log_end_msg $?
}