Squeezebox Controller (V2.2.0) Information

Posted on
Mon Mar 23, 2015 8:45 am
autolog offline
Posts: 2650
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT+0]

Squeezebox Controller (V2.2.0) Information

This Plugin controls Squeezebox Servers and Players. It is compatible with Indigo 6 and Indigo 7. This brand new version (v2.x.x) has significant changes when compared to the original v0.2.x version. I have therefore taken the difficult decision to implement it as a new plugin which means that when it is installed it won't pick up any of the previous definitions / actions etc.

I have also skipped a version generation as the Version 1.x.x series was an internal build only. This version of the plugin is released as Version 2.x.x series. :)

Improvements

Indigo Store Version V2.2.0 (26th November 2017)
  • Now hosted on Github
  • Minor bug fixes
Improved in V2.0.4 (24th March 2015)
  • Improved handling of disconnecting and reconnecting players; especially in relation to announcements processing
  • Minor bug fixes
Initial V2 Release [V2.0.3] (23rd March 2015)
  • A major new action Play Announcement replaces previous 'Play Alert' action. This new Play Announcement action can play sound files and also play speech files created from text input with prepended and appended sound files.
  • Numerous actions have been rationalised and renamed
  • Handling of sync'd players has been much improved
  • Support has been added for for overriding which state image icon is shown (using Indigo API version 1.18 and available in Indigo version 6.0.20)
  • Improved scripting support to enable the plugin actions to be invoked by a script
  • More detailed documentation describing custom states and actions
Download

The Plugin (V 2.2.0) is now available for download on Github: Squeezebox Controller.

Installation

Prerequisites
If you are currently running an earlier version of the plugin then BEFORE you install the new plugin, the best approach is to:
  1. Rename your existing Squeezebox Server and Players by say prefacing their existing name with 'OLD - ' (So that it will then be obvious which devices you are dealing with when you install the new plugin and it finds and creates your squeezebox devices).
  2. Disable the existing plugin (which will take your existing devices offline).
  3. Delete the existing plugin from the disabled folder: Library ▸ Application Support ▸ Perceptive Automation ▸ Indigo 6 ▸ Plugins (Disabled)
Plugin Install and Configuration
Download and install the Plugin as normal.

The plugin configuration dialogue has some logging options:
squeezeboxPluginConfiguration.png
squeezeboxPluginConfiguration.png (121.45 KiB) Viewed 3430 times


These are to support debugging and should normally be 'off' to avoid filling the event log with messages.

Device Configuration
The only device that should be defined is your Squeezebox server. Create a new Squeezebox server device and specify your Squeezebox server's IP address; example:
SqueezeboxServerDeviceDefinition.png
SqueezeboxServerDeviceDefinition.png (62.82 KiB) Viewed 3430 times


Once the device has been saved, the Plugin will initialise various things, such as:
  • Creates 'Squeezebox' folders in the Devices Home Window which will contain the devices used by the Plugin.
  • The Squeezebox server is scanned and Player devices created for all the players currently connected to the Squeezebox server
Example result of scan:
Squeezebox Devices.png
Squeezebox Devices.png (74.19 KiB) Viewed 3430 times


Usage
Documented below are the States and Actions fort the plugin. This enables you to define quite powerful Control Pages, an example of which is:
SqueezeboxCPexample.png
SqueezeboxCPexample.png (400.12 KiB) Viewed 3430 times


States
The Squeezebox Server custom states (all character strings) are:
  • status - Status of the Squeezebox server e.g.'connected', 'disconnected'
  • version - Squeezebox Server version
  • totalAlbums - Total number of albums in library
  • totalArtists - Total number of artists in library
  • totalGenres - Totals number of genres in library
  • totalSongs - Total number of songs in library
  • lastScan - date and time of last library scan e.g. '2015-Mar-14 10:31:47'

The Squeezebox Player custom states (all character strings unless otherwise noted) are:
  • album - The name of the album currently playing
  • artist - The name of the artist of the currently playing song
  • duration - The duration of the the currently playing song in seconds
  • durationUi - The duration of the the currently playing song in minutes and seconds i.e. HH:MM
  • genre - The genre of the the currently playing song
  • ipAddress - The IP Address of the Squeezebox Player e.g. '192.168.0.20'
  • isSyncMaster [boolean] - Whether the Squeezebox Player is the master player in the sync group this player belongs to ('true') or not ('false')
  • isSyncSlave [boolean] - Whether the Squeezebox Player is a slave player in the sync group this player belongs to ('true') or not ('false')
  • maintainSync - Indicates whether the Squeezebox Player is set to maintain synchronisation with other players in the sync group ('1') or not ('0')
  • mode - Shows the player mode: 'play', 'stop' or 'pause'
  • model - The Squeezebox Player model e.g 'Squeezebox Boom', 'Squeezebox Radio', 'Squeezebox Touch', 'Squeezebox Touch', 'iPengiPod', 'iPengiPad' etc
  • name - The name of the Squeezebox Player
  • playlistIndex - The index number (zero base) of song currently playing
  • playlistTrackNumber - The track number of song currently playing
  • playlistTracksTotal - Total number of tracks in current playlist
  • playlistTracksUi - A UI friendly display of track number and total tracks e.g. '8 of 12'
  • portAddress - The port number the Squeezebox Player is accessed on
  • power - Shows the power status: 'on', 'ff' or 'disconnected'
  • remoteStream - Indicates whether a remote stream (Spotify, Pandora etc) is playing ('true') or not ('false')
  • repeat - Whether the playlist is repeating: 'off', 'song', 'album'
  • serverId [Integer] - The indigo device id for the Squeezebox Server
  • serverName - The name of the Squeezebox Server
  • shuffle - Whether the playlist is being shuffled: 'off', 'songs', 'albums'
  • state - the state of the Squeezebox player: 'disconnected', 'off', 'playing', 'stopped' or 'paused'
  • syncMasterNumberOfSlaves - Number of slave players if Squeezebox Player is master of a sync group
  • syncMasterSlave_1_Address - IP address of slave
  • syncMasterSlave_1_Id - Indigo device id of slave
  • syncMasterSlave_1_Name - Name of slave
  • syncMasterSlave_2_Address - IP address of slave
  • syncMasterSlave_2_Id - Indigo device id of slave
  • syncMasterSlave_2_Name - Name of slave
  • syncMasterSlave_3_Address - IP address of slave
  • syncMasterSlave_3_Id - Indigo device id of slave
  • syncMasterSlave_3_Name - Name of slave
  • syncMasterSlave_4_Address - IP address of slave
  • syncMasterSlave_4_Id - Indigo device id of slave
  • syncMasterSlave_4_Name - Name of slave
  • syncSlaveMasterAddress - Address of master Squeezebox Player if this player is a slave in a sync group
  • syncSlaveMasterId - Indigo device id of master Squeezebox Player if this player is a slave in a sync group
  • syncSlaveMasterName - Name of master Squeezebox Player if this player is a slave in a sync group
  • title - The title of the song currently playing
  • volume -The current volume
Actions

The Plugin provides for a number of 'AutologSqueezebox Actions', that can be invoked via the normal Action Group actions or via a script (example code for scripting is shown beneath each action). To invoke an action via a script, set-up your script as follows:
Code: Select all
squeezeboxPlugin = indigo.server.getPlugin("com.indigodomo.indigoplugin.autologsqueezeboxcontroller")
if squeezeboxPlugin.isEnabled():
    # How to define a Squeezebox Server action:
    squeezeboxServerDeviceId = 12345678  # CHANGE TO ID OF YOUR SQUEEZEBOX SERVER
    squeezeboxPlugin.executeAction("<ACTION-NAME.", squeezeboxServerDeviceId, props={"<PROP-NAME-1": "<VALUE-1>","<PROP-NAME-2": "<VALUE-2>", .... "<PROP-NAME-N": "<VALUE-N>"})
    # How to define a Squeezebox Player action:
    squeezeboxPlayerDeviceId = 87654321  # CHANGE TO ID OF YOUR SQUEEZEBOX PLAYER
    squeezeboxPlugin.executeAction("<ACTION-NAME.", squeezeboxPlayerDeviceId, props={"<PROP-NAME-1": "<VALUE-1>","<PROP-NAME-2": "<VALUE-2>", .... "<PROP-NAME-N": "<VALUE-N>"})
Examples:
  • squeezeboxPlugin.executeAction("resetAnnouncement", squeezeboxServerDeviceId)
  • squeezeboxPlugin.executeAction("volumeSet", squeezeboxPlayerDeviceId, props={"volumeSetValue": "40"})
The available plugin actions are:
  • Refresh Server Status:
    This will scan the server and updates its status and create new Player devices for any discovered players
    Code: Select all
    squeezeboxPlugin.executeAction("refreshServerStatus", squeezeboxServerDeviceId)
  • Power On All:
    Power on all Squeezebox Players for a selected Squeezebox Server
    Code: Select all
    squeezeboxPlugin.executeAction("powerOnAll", squeezeboxServerDeviceId)
  • Power Off All:
    Power off all Squeezebox Players for a selected Squeezebox Server
    Code: Select all
    squeezeboxPlugin.executeAction("powerOffAll", squeezeboxServerDeviceId)
  • Power On:
    Power on the selected Squeezebox Player
    Code: Select all
    squeezeboxPlugin.executeAction("powerOn", squeezeboxPlayerDeviceId)
  • Power Off:
    Power off the selected Squeezebox Player
    Code: Select all
    squeezeboxPlugin.executeAction("powerOff", squeezeboxPlayerDeviceId)
  • Power Toggle On/Off:
    This will toggle the Squeezebox Player's power state i.e. power on if off and power off if on
    Code: Select all
    squeezeboxPlugin.executeAction("powerToggleOnOff", squeezeboxPlayerDeviceId)
  • Play:
    Equivalent to pressing the Play button on the Squeezebox Player
    Code: Select all
    squeezeboxPlugin.executeAction("play", squeezeboxPlayerDeviceId)
  • Stop:
    Equivalent to pressing the Stop button on the Squeezebox Player
    Code: Select all
    squeezeboxPlugin.executeAction("stop", squeezeboxPlayerDeviceId)
  • Pause:
    Equivalent to pressing the Pause button on the Squeezebox Player
    Code: Select all
    squeezeboxPlugin.executeAction("pause", squeezeboxPlayerDeviceId)
  • Forward Now Playing:
    Equivalent to pressing the FWD button on the Squeezebox Player
    Code: Select all
    squeezeboxPlugin.executeAction("forward", squeezeboxPlayerDeviceId)
  • Rewind Now Playing:
    Equivalent to pressing the REW button on the Squeezebox Player
    Code: Select all
    squeezeboxPlugin.executeAction("rewind", squeezeboxPlayerDeviceId)
  • Volume Set:
    Sets the Player volume to a specific value (0 to 100).
    Edit Action Setting to set required value.
    Code: Select all
    squeezeboxPlugin.executeAction("volumeSet", squeezeboxPlayerDeviceId, props={"volumeSetValue": "40"})
  • Volume Increase:
    Increases the Player volume by a specific value (0 to 100) - default = 5.
    Edit Action Setting to set required value. You can also elect to Force volume to multiple of increase (default false) e.g. if current volume is 23 and the volume increase value is 5, then the volume will be increased to 25, then 30, 35 etc on subsequent actions. It is a way of rationalising the current volume value.
    Code: Select all
    squeezeboxPlugin.executeAction("volumeSet", squeezeboxPlayerDeviceId, props={"volumeIncreaseValue": "40","forceVolumeToMultipleOfIncrease":"true"})
  • Volume Decrease:
    Decreases the Player volume by a specific value (0 to 100) - default = 5.
    Edit Action Setting to set required value. You can also elect to Force volume to multiple of decrease (default false) e.g. if current volume is 23 and the volume decrease value is 5, then the volume will be decreased to 20, then 15, 10 etc on subsequent actions. It is a way of rationalising the current volume value.
    Code: Select all
    squeezeboxPlugin.executeAction("volumeSet", squeezeboxPlayerDeviceId, props={"volumeDecreaseValue": "40","forceVolumeToMultipleOfDecrease":"false"})
  • Volume Mute:
    Mutes the Player volume.
    Edit Action Setting to request the action to be applied to all players in a Sync Group.
    Code: Select all
    squeezeboxPlugin.executeAction("volumeMute", squeezeboxPlayerDeviceId, props={"volumeMuteAll":"false"})
  • Volume Unmute:
    Unmutes the Player volume.
    Edit Action Setting to request the action to be applied to all players in a Sync Group.
    Code: Select all
    squeezeboxPlugin.executeAction("volumeUnmute", squeezeboxPlayerDeviceId, props={"volumeUnmuteAll":"false"})
  • Volume Toggle Mute:
    Toggles the muting of the Player volume.
    Edit Action Setting to request the action to be applied to all players in a Sync Group.
    Code: Select all
    squeezeboxPlugin.executeAction("volumeToggleMute", squeezeboxPlayerDeviceId, props={"volumeToggleMuteAll":"false"})
  • Play Preset:
    Equivalent to pressing a preset button (1-6) on the Squeezebox Player
    Code: Select all
    squeezeboxPlugin.executeAction("playPreset", squeezeboxPlayerDeviceId, props={"preset":"2"})
  • Play Favorite:
    Plays a favorite previously set-up.
    Edit Action Setting to set Favorite ID value. The value is the index number for the favorite which can be found by hovering the mouse over the favorite in the Logitech Media Server web interface. See this post for a more detailed explanation :)
    Code: Select all
    squeezeboxPlugin.executeAction("playFavorite", squeezeboxPlayerDeviceId, props={"favorite":"2.1.3"})
  • Play Playlist:
    Play a selected playlist.
    Edit Action Setting to set-up the link to the playlist.
    The playlist naming format is something like this (for an example 'Zero 7' playlist):
    • /Users/YOUR-USER-NAME/Music/Playlists/zero 7.m3u or
    • /Volumes/YOUR-OTHER-VOLUME-NAME/Playlists/zero 7.m3u.
    Code: Select all
    squeezeboxPlugin.executeAction("playPlaylist", squeezeboxPlayerDeviceId, props={"playlist":"/Users/YOUR-USER-NAME/Music/Playlists/zero 7.m3u"})
  • Clear Playlist:
    Will clear the playlist for the selected playlist.
    Code: Select all
    squeezeboxPlugin.executeAction("clearPlaylist", squeezeboxPlayerDeviceId)
  • Shuffle Playlist:
    Edit Action Setting to:
    • Turn Shuffle Off
    • Shuffle by Song
    • Shuffle by Album
    • Toggle Shuffle
    Code: Select all
    squeezeboxPlugin.executeAction("shuffle", squeezeboxPlayerDeviceId, props={"optionShuffle":"off|song|album|toggle"})
  • Repeat Now Playing:
    Edit Action Setting to:
    • Turn Repeat Off
    • Repeat Song
    • Repeat Playlist
    • Toggle Repeat
    Code: Select all
    squeezeboxPlugin.executeAction("repeat", squeezeboxPlayerDeviceId, props={"optionRepeat":"off|song|playlist|toggle"})
  • Play Announcement:
    This will play an announcement on a player or sync'd group of players. It will interrupt the current playlist, play the announcement and then resume the playing of the playlist at the start of the song just interrupted. Note: In testing, trying to restart the playlist at the mid-song point has proved too unreliable so I haven't implemented it.

    If an announcement is currently playing when a new announcement is requested, it will be queued and played when the current announcement ends. The queue can contain many announcements, they will just play one after the other. There is only one announcement queue and announcements are queued at the plugin level and so only one announcement can be played at a time even if announcements are directed at multiple players.

    Use Edit Action Settings... to select the announcement option and set-up the the announcement to play.

    Specify the required Volume for the announcement. If left blank, then the volume on the player(s) will be left unchanged. The volume is changed for the duration of the announcement. When the announcement has ended the volume is reset to the level set prior to the announcement being played and this is done individually for each sync'd player.

    There are two options:
    1. Option File - play a file:
      • Specify an Announcement file. The announcement file naming format is something like this:
        /Users/YOUR-USER-NAME/Music/Alerts/YOUR-ANNOUNCEMENT-FILE-NAME.mp3
    2. Option Speech - convert text to speech file and play:
      • Select a Voice for the speech from the list of available Apple voices. Premium (higher quality) voices are identified in the list of voices by the suffix [Premium].
      • Specify the Text to Speak e.g. The temperature outside is; %%d:12345678:temperature%% degrees centigrade. The plugin handles device and variable substitution.
      • if Prepend? is selected then you can specify a file to be played before the speech is played - file naming format as noted above under option File.
      • if Append? is selected then you can specify a file to be played after the speech is played - file naming format as noted above under option File.
      The prepend and Append can be used to simulate (for example) an airport announcement where a tone is played before and after the announcement.

    As an Announcement is a more complicated action, multiple script examples are shown below.
    Note that if the selected voice is a high quality premium voice, then the name ends in '.premium'.
    Code: Select all
    # File Announcement
    squeezeboxPlugin.executeAction("announcement", squeezeboxPlayerDeviceId, props={"optionAnnouncement":"file","announcementVolume":"50","announcementFile":"/Users/YOUR-USER-NAME/Music/YOUR-ANNOUNCEMENT-FILE-NAME.mp3"})
    # Speech Announcement
    squeezeboxPlugin.executeAction("announcement", squeezeboxPlayerDeviceId, props={"optionAnnouncement":"speech","announcementVolume":"50","announcementVoice":"com.apple.speech.synthesis.voice.allison.premium","announcementText":"The temperature outside is; %%d:11223344:temperature%% degrees centigrade"})
    # Speech Announcement with prepended and appended files
    squeezeboxPlugin.executeAction("announcement", squeezeboxPlayerDeviceId, props={"optionAnnouncement":"speech","announcementVolume":"50","announcementVoice":"com.apple.speech.synthesis.voice.alex","announcementText":"Testing one two three","announcementPrepend":"true","announcementPrependFile":"/Users/YOUR-USER-NAME/Music/YOUR-ANNOUNCEMENT-PREPEND-FILE-NAME.mp3","announcementAppend":"true","announcementAppendFile":"/Users/YOUR-USER-NAME/Music/YOUR-ANNOUNCEMENT-APPEND-FILE-NAME.mp3" })
  • Server Raw Command:
    Send a raw command to the selected Squeezebox Server.
    Edit Action Setting to specify the raw command. The Plugin works by communicating with the Squeezebox Server using the Logitech Media Server Command Line Interface. A server raw command sends the whole command string to the server. This command is useful for debugging or specifying commands not yet supported by the plugin.
    Code: Select all
    # initiate a rescan of the music library
    squeezeboxPlugin.executeAction("serverRawCommand", squeezeboxServerDeviceId, props={"rawServerCommand":"rescan"})
  • Player Raw Command:
    Send a player command to the Squeezebox Server for the selected player. The Plugin works by communicating with the Squeezebox Server using the Logitech Media Server Command Line Interface. A player raw command will substitute the '<playerid> parameter with the MAC (address) of the selected player to save you having to type it in. This command is useful for debugging or specifying commands not yet supported by the plugin.
    Code: Select all
    # skip to 120 into current song
    squeezeboxPlugin.executeAction("playerRawCommand", squeezeboxPlayerDeviceId, props={"rawPlayerCommand":"time 120"})
  • Reset Announcement:
    Resets the Play Announcement condition for all players. Not normally needed but can be useful if announcements get stuck on the queue and not released
    Code: Select all
    squeezeboxPlugin.executeAction("resetAnnouncement", squeezeboxServerDeviceId)
Last edited by autolog on Sun Nov 26, 2017 8:46 am, edited 2 times in total.
Reason: Version 2.0.4 released

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests