I'm not sure I have understand how all this works, I took the code from
another plugin when I started to develop TrackStat and have just made
some small modifications in this part since then.

Anyway, this is the relevant code in TrackStat for setting up the
buttons:

Code:
--------------------
    
  my %mapping = (
        '0.hold' => 'saveRating_0',
        '1.hold' => 'saveRating_1',
        '2.hold' => 'saveRating_2',
        '3.hold' => 'saveRating_3',
        '4.hold' => 'saveRating_4',
        '5.hold' => 'saveRating_5',
        '0.single' => 'numberScroll_0',
        '1.single' => 'numberScroll_1',
        '2.single' => 'numberScroll_2',
        '3.single' => 'numberScroll_3',
        '4.single' => 'numberScroll_4',
        '5.single' => 'numberScroll_5',
        '0' => 'dead',
        '1' => 'dead',
        '2' => 'dead',
        '3' => 'dead',
        '4' => 'dead',
        '5' => 'dead'
  );
  
--------------------



Code:
--------------------
    
  # Alter mapping for functions & buttons in Now Playing mode.
  Slim::Hardware::IR::addModeDefaultMapping('playlist',\%mapping);
  my $functref = Slim::Buttons::Playlist::getFunctions();
  $functref->{'saveRating'} = \&saveRatingsForCurrentlyPlaying;
  
--------------------


The saveRatingsForCurrentlyPlaying method is declared as follows:

Code:
--------------------
    
  sub saveRatingsForCurrentlyPlaying {
  my $client = shift;
  my $button = shift;
  my $digit = shift;
  
--------------------


Hopefully this is enough information for you to make it work.

In case I can do something in TrackStat to make it easier, just tell me
and I will try to make the neccesary changes. Patches are also welcome
of course.

Just for information, the PLUGIN.TrackStat.Choice mode and the related
saveRatingsFromChoice method is probably not useful in your situation.
It is used to change ratings on non playing songs when browsing
statistics in the TrackStat menu. This will only work when you have
selected a song in the TrackStat menu, so it is not what you are
looking for.

By reading your conversation I suspect that might want to use
"saveRatingsForCurrentlyPlaying" instead of "saveRating" in some way.


-- 
erland

Erland Isaksson
'My homepage' (http://erland.homeip.net) 'My download page'
(http://erland.homeip.net/download)
(Developer of 'TrackStat'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-trackstat)
, 'SQLPlayList'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-sqlplaylist)
, 'DynamicPlayList'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-dynamicplaylist)
and 'RandomPlayList'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-randomplaylist)
plugins)
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=26793

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

Reply via email to