<?sphp $this->text('pagetitle') ?>
 
Home of the Squeezebox™ & Transporter® network music players.

PluginModes

From SqueezeboxWiki

Jump to: navigation, search

The remote buttons are context sensitive, meaning that they can serve different roles when the Squeezebox Server is in different modes. The setMode() subroutine defines this mode. Within this subroutine, there must be a definition for $client->lines, which is the text to be displayed on the Slim client while in this plugin mode. Typically, this is labeled just as above, though it can be any name you wish. The lines subroutine, or other name if you have chosen one, returns two strings. One for each line of the display. They can be updated at any time from any point in the plugin module by using the line:

$client->update();

Also included in the setMode subroutine are any commands or functions that must be run each time the Plugin is called. This may be loading an array for a menu system, default settings, or running any number of other subroutines that are needed for the operation of the plugin.

You may also want to add extra modes under your plugin. There is a function call that tells the server to add your new mode with its setMode and getFunctions references.

Slim::Buttons::Common::addMode('newmodename', getNewModeFunctions(), \&PluginName::setNewMode);

and then you can include the following in your plugin to hook-in to your new mode:

sub setNewMode { my $client = shift; $client->lines(\&newModeLines); } 
sub getNewModeFunctions { return \%newModeFunctions; }

Next Page