Install squeeze

From xPL
Revision as of 16:41, 3 July 2014 by Fcorthay (Talk | contribs)

Jump to: navigation, search

A Logitech Media Server (a.k.a. SqueezeCenter) can be controlled in various ways, including a Telnet Command-Line Interface (CLI) or the xPL plugin.

This xPL client allows to control a Logitech Media Server running on a machine where there is no xPL hub installed. The Media Server will be controlled via the CLI.

Before all, make sure you have installed an xPL hub.

Install xPL squeeze device

Download the xPL squueze script.

Move the script to xPL scripts directory:

SCRIPTS_BASE_DIR=/home/control/Documents/Controls
mv xpl-squeeze.pl $SCRIPTS_BASE_DIR
chown control:users $SCRIPTS_BASE_DIR/*.pl
chmod 775 $SCRIPTS_BASE_DIR/*.pl

Test xPL squeeze device

Test it on a BeagleBone:

su control
SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-squeeze.pl -h
$SCRIPTS_BASE_DIR/xpl-squeeze.pl -v -n test

Open a 2nd terminal window (on any machine with xPL installed) and monitor the xPL protocol:

SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-monitor.pl -vf

Open another terminal and control the SqueezeCenter:

SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-send.pl -v -d dspc-squeeze.controller -c slimserv.request command=list
$SCRIPTS_BASE_DIR/xpl-send.pl -v -d dspc-squeeze.StudySqueezeslav -c slimserv.request command=status
$SCRIPTS_BASE_DIR/xpl-send.pl -v -d dspc-squeeze.StudySqueezeslav -c slimserv.basic command=play
$SCRIPTS_BASE_DIR/xpl-send.pl -v -d dspc-squeeze.StudySqueezeslav -c slimserv.basic command='power 0'

Launch the xPL squeeze device at startup

The xPL SqueezeCenter controller is to start after the xPL hub.

Ubuntu

On Ubuntu, the xPL squeeze device starts-up once xpl-hub_started has been emitted.

Edit /etc/init/xpl-actions.conf: Edit /etc/init/xpl-squeeze.conf:

################################################################################
# xPL SqueezeCenter controller
#
description "xPL squeeze"
version     "1.0"
author      "Francois Corthay"

#-------------------------------------------------------------------------------
# Configuration variables
#
env SCRIPTS_DIR='/home/control/Documents/Controls'
env SCRIPT_NAME='xpl-squeeze.pl'
env PARAMETERS='-n home'

#-------------------------------------------------------------------------------
# Start and stop conditions
#
start on xpl-hub_started
stop on shutdown
respawn
setuid control
setgid users

#-------------------------------------------------------------------------------
# Start daemon
#
exec $SCRIPTS_DIR/$SCRIPT_NAME $PARAMETERS

Start the device and test it:

su root
service xpl-squeeze start
service xpl-squeeze status
initctl list | grep xpl

SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-send.pl -v -d dspc-squeeze.StudySqueezeslav -c slimserv.basic command=play

Mac OS

On Mac OS, the xPL actions device starts-up later than the hub.

Edit /Library/LaunchDaemons/xpl-squeeze.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>xPL SqueezeCenter controller</string>
    <key>OnDemand</key>
    <false/>
    <key>UserName</key>
    <string>control</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Users/control/Documents/Controls/xpl-squeeze.pl</string>
      <string>-n</string>
      <string>home</string>
      <string>-w</string>
      <string>25</string>
    </array>
  </dict>
</plist>

Start the device and test it:

su root
launchctl load /Library/LaunchDaemons/xpl-squeeze.plist

SCRIPTS_BASE_DIR=/Users/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-send.pl -v -d dspc-squeeze.StudySqueezeslav -c slimserv.basic command=play