WebService::LastFM::Track - The Track class of WebService::LastFM


WebService-LastFM documentation  | view source Contained in the WebService-LastFM distribution.

Index


NAME

Top

WebService::LastFM::Track - The Track class of WebService::LastFM

SYNOPSIS

Top

  use WebService::LastFM;




  my $lastfm = WebService::LastFM->new(
        username => $config{username},
        password => $config{password},
  );
  my $session_key = $stream_info->session;
  my $playlist = $lastfm->get_new_playlist();
  while ( my $track = $playlist->get_next_track() ) {
      foreach ( qw/ location  creator  duration image
                    album     title    lastfm:artistId
                    lastfm:trackauth lastfm:albumId /)
      {
        print "$_: ".$track->$_."\n" if defined $track->$_;
        system( 'mpg123', $track->location() );
      }
  }

DESCRIPTION

Top

WebService::LastFM::Track provides the Track class to WebService::LastFM

METHODS

Top

location()
  $url = $track->location();

Returns a url ready for passing to you streaming media player. This is a one-time-use url. Repeated attempts will fail.

creator()
  $artists = $track->creator();

Returns the artist of the track.

duration()
  $duration = $track->duration();

Returns the duration of the track.

image()
  $image_url = $track->image();

Returns a url to the album image, if available.

album()
  $album_name = $track->album();

Returns the album name, if available.

title()
  $track_title = $track->title();

Returns the track's title.

SEE ALSO

Top

* Last.FM

http://www.last.fm/

* Last.FM Stream API documentation

http://www.audioscrobbler.com/development/lastfm-ws.php

* LWP::UserAgent

AUTHOR

Top

Christian Brink, <grep_pdx@gmail.com>

COPYRIGHT AND LICENSE

Top


WebService-LastFM documentation  | view source Contained in the WebService-LastFM distribution.