I would suggest you use the "status" query (as documented in the 'CLI
documentation'
(http://htmlpreview.github.io/?https://raw.githubusercontent.com/Logitech/slimserver/public/7.9/HTML/EN/html/docs/cli-api.html)
rather than to try to grab the information from the track object
yourself. That's what all the other UIs do, and it does the difficult
part for you.


Code:
--------------------
    
  # request the current player's status. Starting with the current track ('-'), 
grab information for one single track:
  my $r = $client->execute(['status', '-', 1, 'tags:aKl']);
  
  # playlist_loop of the response is a list of track information hashes. We 
only have requested on - grab it:
  my $track = $r->getResult('playlist_loop')->[0];
  
  # extract the nice pieces of information from the $track hash ref:
  my $artist = $track->{artist};
  my $album = $track->{album};
  my $title = $track->{title};
  
--------------------



Michael

http://www.herger.net/slim-plugins - Spotty, MusicArtistInfo
------------------------------------------------------------------------
mherger's Profile: http://forums.slimdevices.com/member.php?userid=50
View this thread: http://forums.slimdevices.com/showthread.php?t=108743

_______________________________________________
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss

Reply via email to