Installing Logitech Media Server and Squeezelite


I have a Logitech Squeezebox Radio and like being able to play music on my TV from the Logitech Android app, so here is how I did that, taken mostly from http://www.havetheknowhow.com/Install-the-software/Install-Squeezebox-server.html:
Added deb http://debian.slimdevices.com stable main to /etc/apt/sources.list (on Ubuntu 14.04LTS, use deb http://debian.slimdevices.com unstable main instead) then:

sudo apt-get update
sudo apt-get install logitechmediaserver

Then from http://localhost:9000 you log in and configure it.
Squeezelite is a client to playback local and internet music through the computer. It is a downloadable executable program, so here are the procedures:

cd /opt
sudo mkdir squeezelite
cd squeezelite
sudo wget http://squeezelite-downloads.googlecode.com/git/squeezelite-x86-64
sudo chmod +x squeezelite-x86-64

I learned that if you keep squeezelite as owned by the root user, it won’t play nicely with other sounds at the same time. I believe the program will use a root’s version of pulseaudio, rather than the user’s version. So, run the following, changing the username to the username you use when using mythtv:

cd /opt
sudo chown someuser:someuser -R squeezelite

Then I put the following startup script as /etc/init.d/squeezelite (this is from here)

#!/bin/sh
### BEGIN INIT INFO
# Provides: squeezelite
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Script to start squeezelite
# Description: Service script for squeezelite, command line squeezebox player
### END INIT INFO
#Define some variables. LMS is the IP of your Logitech Media Server. Output device can be found by running squeezelite -l

USER=someuser
OUTPUT=pulse
NAME=SqueezelitePlayerName
LMS=localhost

case "$1" in
start)
echo "Starting Squeezelite"
start-stop-daemon --start --quiet -b -m -p /var/run/squeezelite.pid --chuid $USER --exec /opt/squeezelite/squeezelite -- -o $OUTPUT -n $NAME $LMS
;;
stop)
echo "Stopping Squeezelite"
start-stop-daemon --stop --quiet --pidfile /var/run/squeezelite.pid
rm -f /var/run/squeezelite
;;
*)
echo "Usage: /etc/init.d/squeezelite {start|stop}"
exit 1
;;
esac
exit 0

Then to finish the setup I made it executable, set the startup to a very low priority to not conflict with pulseaudio or anything else. the chkconfig line is not needed, just something recommended.

sudo chmod +x /etc/init.d/squeezelite
sudo update-rc.d squeezelite defaults 90 10
sudo chkconfig –add squeezelite
sudo /etc/init.d/squeezelite start

In ubuntu 14.04, squeezelite appears to not be running while accessing the correct pulseaudio if started using the init.d script. It works, but conflicts with mythtv audio. Therefore I stopped the autorunning of the above script, and added a new autorun to the xfce desktop. That gives it the correct access to pulseaudio. Use these steps to accomplish that:

sudo update-rc.d -f squeezelite remove
nano ~/config/autostart/SqueezeLite.desktop

Paste the following into that file:

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=SqueezeLite
Comment=Media Streaming using Logitech Media Server
Exec=/opt/squeezelite/squeezelite -z -o pulse -n SqueezelitePlayerName -s localhost
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false

At your next startup, squeezelite should autostart and work properly with other audio streams.

Leave a Reply

Your email address will not be published. Required fields are marked *