I'm not sure if this is the best way to do it, but this is how I've done
it my own plugins. I'll give you some extracts of the relevant parts of
the code:


Code:
--------------------
    
  my %nowPlayingmapping = (
  # We like to register holding the 1 button in Now Playing
  '1.hold' => 'xxx',
  );
  
  sub initPlugin {
  my $class = shift;
  $class->SUPER::initPlugin(@_);
  
  # Add your button mapping
  Slim::Hardware::IR::addModeDefaultMapping('playlist',\%nowPlayingmapping);
  
  # Register 'xxx' function in 'playlist' mode
  my $functref = Slim::Buttons::Playlist::getFunctions();
  $functref->{'xxx'} = \&xxx;
  }
  
  #Callback which will be called when 1 is hold in the Now Playing mode
  sub xxx {
  my $client = shift;
  my $button = shift;
  my $arg = shift;
  
  # Call showBriefly or what ever you want
  }
  
--------------------


So basically, you will need to add your own function to the
Slim::Buttons::Playlist::getFunctions() reference which is used by the
'playlist'mode. 

And you will need to add your mapping between buttons and your custom
function with the Slim::Hardware::IR::addModeDefaultMapping function.

I haven't actually tested this code, I just extracted the parts I think
is relevant from an existing plugin. So let me know if you don't get it
to work and we can throw together a small executable example.


-- 
erland

Erland Isaksson
'My homepage' (http://erland.homeip.net) 'My download page'
(http://erland.homeip.net/download)
(Developer of 'TrackStat, SQLPlayList, DynamicPlayList, Custom Browse,
Custom Scan,  Custom Skip, Multi Library and Database Query plugins'
(http://wiki.erland.homeip.net/index.php/Category:SlimServer))
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=46742

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to