The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::LastFM::TrackInfo - Access to *.getInfo slices of the last.fm API

VERSION

version 0.0206

SYNOPSIS

  use WebService::LastFM::TrackInfo;

  my $w = WebService::LastFM::TrackInfo->new(api_key => 'abcdef123456');
  my $r = $w->fetch(
    artist => 'Led Zeppelin',
    track  => 'Kashmir',
  );
  print Dumper $r; # Do something cool with the result!

  $w = WebService::LastFM::TrackInfo->new(
    api_key => 'abcdef123456',
    method  => 'album',
  );
  $r = $w->fetch(
    artist => 'Led Zeppelin',
    album  => 'Presence',
  );

DESCRIPTION

WebService::LastFM::TrackInfo provides access to a couple *.getInfo API slices: track, artist and album.

ATTRIBUTES

api_key

Your required, last.fm API authorization key.

Default: undef

method

The required method string ("track", "artist", or "album").

Default: track

format

The last.fm API response format ("xml" or "json")

Default: json

base

The base URL.

Default: http://ws.audioscrobbler.com

version

The API version.

Default: 2.0

ua

The user agent.

Default: Mojo::UserAgent->new

METHODS

new

  $w = WebService::LastFM::TrackInfo->new(
      api_key => $api_key,
      method  => $method,
      format  => $format,
  );

Create a new WebService::LastFM::TrackInfo object with your required api_key argument.

fetch

  $r = $w->fetch(artist => $artist, track => $track);
  $r = $w->fetch(artist => $artist, album => $album); # for method => album
  $r = $w->fetch(artist => $artist); # for method => artist

Fetch the results given the artist, album or track.

SEE ALSO

The t/* tests

The eg/* programs

https://www.last.fm/api/show/track.getInfo

Moo

Mojo::JSON

Mojo::URL

Mojo::UserAgent

Try::Tiny

Net::LastFMAPI - Contains this functionality I guess? Broken for me...

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Gene Boggs.

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