WebService::LastFM::Track - The Track class of WebService::LastFM
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() ); } }
WebService::LastFM::Track provides the Track class to WebService::LastFM
$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.
$artists = $track->creator();
Returns the artist of the track.
$duration = $track->duration();
Returns the duration of the track.
$image_url = $track->image();
Returns a url to the album image, if available.
$album_name = $track->album();
Returns the album name, if available.
$track_title = $track->title();
Returns the track's title.
Last.FM
http://www.last.fm/
Last.FM Stream API documentation
http://www.audioscrobbler.com/development/lastfm-ws.php
LWP::UserAgent
Christian Brink, <grep_pdx@gmail.com>
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.
To install WebService::LastFM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::LastFM
CPAN shell
perl -MCPAN -e shell install WebService::LastFM
For more information on module installation, please visit the detailed CPAN module installation guide.