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

Plugin hooks

From SqueezeboxWiki

(Redirected from PluginHooks)
Jump to: navigation, search

Each level in the SlimServer menu hierarchy is considered a "mode" by the SlimServer. Each time the server is started, it reads the Plugins directory for modules. Each is added, by name, into a list. Each Plugin is given a mode, and a set of functions that are defined within that module. The plugins can each be enabled or disabled at will from the web interface. The plugin module itself must define a mode and functions in a form that the server is expecting. This comes from two functions: sub setMode() and sub getFunctions(). A third subroutine, sub getDisplayName() is required to provide the name that the server should display for the plugin. Simple examples of these three functions are below. We will now build a template based on these main functions.

Example 1:


sub setMode { my $client = shift; $client->lines(\&lines); } 
sub getFunctions { return \%functions; } 
sub getDisplayName { return "MY_PLUGIN_NAME_TOKEN"; }


Next Page