I trying to start writing plugins. I'm starting with the HelloWorld.pm
plugin. This is the code I copied from the wiki with a few changes
that seems to be included in some of the current plugins:
# give the package a name
package Plugins::Hello;
use strict;
sub enabled {
return ($::VERSION ge '6.1')
}
# a hash of strings and anonymous functions.
# read it as follows:
# when button left is pushed, execute the following code
# for better readability, keep your code compact here and do most in
subs below.
my %functions = (
'left' => sub {
my $client = shift;
Slim::Buttons::Common::popModeRight($client); # leave this one
out and you're blocked
},
'right' => sub {
my $client = shift;
$client->bumpRight();
},
'up' => sub {
my $client = shift;
$client->bumpUp();
},
'down' => sub {
my $client = shift;
$client->bumpDown();
},
);
# my display routine
sub lines
{
my $client = shift;
return ("Hello", "World");
}
# below the functions that the Slimserver calls in my module
sub setMode
{
my $client = shift;
# connect the client's (i.e. the squeezebox) lines to our function
$client->lines(\&lines);
# and update them
$client->update();
}
sub getFunctions
{
\%functions;
}
sub getDisplayName
{
return "PLUGIN_DISPLAY_FILE_NAME";
}
sub strings
{
return q^PLUGIN_DISPLAY_FILE_NAME
EN Hello World
NL Hallo Wereld^;
}
1;
This doesn't seem to show up on the Squeezebox under plugins. Is there
a log I can look at to see if there is a problem? I've tried this both
on Windows and on Linux and neither seem to work with this code. Any
help would be great.
Thanks,
Jamin
--
kodenine
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins