NAME
WebService::LastFM - Simple interface to Last.FM Web service API
SYNOPSIS
use WebService::LastFM;
my $lastfm = WebService::LastFM->new(
username => $username,
password => $password,
);
# get a sessoin key and stream URL to identify your stream
my $stream_info = $lastfm->get_session;
my $session_key = $stream_info->session;
my $stream_url = $stream_info->stream_url;
# get the song information you are now listening
my $nowplaying = $lastfm->get_nowplaying;
for (qw(
price
shopname
clickthrulink
streaming
discovery
station
artist
artist_url
track
track_url
album
album_url
albumcover_small
albumcover_medium
albumcover_large
trackduration
radiomode
recordtoprofile
)){
print $nowplaying->$_;
}
# send a command
$lastfm->send_command($command);
# change the station
$lastfm->change_station($friend);
DESCRIPTION
WebService::LastFM provides you a simple interface to Last.FM Web service API. It currently supports Last.FM Stream API.
CAVEAT
WebServices::LastFM is now obsolete and doesn't cover all over the API which Last.fm offers. If you'd like to take over it from me to work on implementing, please give me a line, I'll let you have it.
METHODS
- new(%args)
-
$lastfm = WebService::LastFM->new( username => $username, password => $password, );
Creates and returns a new WebService::LastFM object.
- get_session()
-
$stream_info = $lastfm->get_session;
Returns a session key and stream URL as a WebService::LastFM::Session object.
- get_nowplaying()
-
$current_song = $lastfm->get_nowplaying;
Returns a WebService::LastFM::NowPlaying object to retrieve the information of the song you're now listening.
- send_command($command)
-
$response = $lastfm->send_command($command);
Sends a command to Last.FM Stream API to control the streaming.
$command
can be one of the follows: skip, love, ban, rtp, or nortp.$response which you'll get after issuing a command will be either 'OK' or 'FAILED' as a string.
- change_station($friend)
-
$response = $lastfm->change_station($friend);
Changes the station of your stream to
$friend
's one.$response which you'll get after issuing a command will be either 'OK' or 'FAILED' as a string.
- ua
-
$lastfm->ua->timeout(10);
Returns the LWP::UserAgent object which is internally used by
$lastfm
object. You can set some values to customize its behavior. See the documentation of LWP::UserAgent for more details.
SEE ALSO
Last.FM
Last.FM Stream API documentation
AUTHOR
Kentaro Kuribayashi, <kentarok@gmail.com>
COPYRIGHT AND LICENSE
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.