NAME

WebService::LastFM::Playlist - Playlist class of WebService::LastFM

SYNOPSIS

  use WebService::LastFM;


  my $lastfm = WebService::LastFM->new(
        username => $config{username},
        password => $config{password},
  );
  my $stream_info = $lastfm->get_session  || die "Can't get Session\n";
  my $playlist = $lastfm->get_new_playlist();

  while ( my $track = $playlist->get_next_track() ) {
      print "Playing '".$track->title."' by ".$track->creator."\n";

      my @cmd = ( 'mpg123' , $track->location() );
      system( @cmd );
  }

DESCRIPTION

WebService::LastFM::Playlist provides you an interface to the LastFM playlists.

METHODS

get_new_playlist()
  my $playlist = $lastfm->get_new_playlist();

Creates and returns a new WebService::LastFM::Playlist object after you have established a session.

get_next_track()
  $track = $playlist->get_next_track();

Returns a WS::LFM::Track object and removes is from the queue. After the queue is empty it returns undef.

tracks_left()
  $tracks_remaining_in_queue = $playlist->tracks_left;

Returns the count of tracks currently left in the playlist queue.

tracks()
  my @tracks = $playlist->tracks();

Returns a list of all WS::LFM::Track objects left in the queue. This is NOT what you generally want, but who am I to say. WS::LFM:Track objects contain a one-time-use url to play the song, so unless you are going to control your own queue then it's best to use the get_next_track and the playlist's queue.

SEE ALSO

AUTHOR

Christian Brink, <grep_pdx@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008 - 2009 by Christian Brink

Copyright (C) 2005 - 2008 by Kentaro Kuribayashi

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.