The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::iTMS::Artist - Represents an artist in the iTunes Music Store

SYNOPSIS

    use Net::iTMS::Artist;

    my $artist = Net::iTMS::Artist->new($iTMS, $id);
    
    print "Artist: ", $artist->name, "\n";

    # $album will be a Net::iTMS::Album object
    for my $album ($artist->discography) {
        print $album->title, " (", $album->genre->name, ")\n";

        # $track will be a Net::iTMS::Song object
        for my $track ($album->tracks) {    # also $album->songs
            print "\t ", $track->number, ": ", $track->title, "\n";
        }
    }

DESCRIPTION

Net::iTMS::Artist represents an artist in the iTMS and encapsulates the associated data. If a piece of information hasn't been fetched from the iTMS, it will transparently fetch and store it for later use before returning.

If one of the methods id, name, website, genre, path, selected_albums, or total_albums is called, the information for the others will be fetched in the same request. This means, for these methods, the first call to one will have a time hit for the HTTP request, but subsequent calls won't.

Methods

All methods return undef on error and (should) set an error message, which is available through the error method. (Unless I note otherwise.)

new($itms, $artistId)

The first argument must be an instance of Net::iTMS, the second an iTMS artist ID.

Returns a blessed hashref (object) for Net::iTMS::Artist.

id

Returns the ID of the artist (artistId).

name

Returns the name of the artist.

website

Returns the website URL of the artist (undef if there isn't one specified).

genre

Returns a Net::iTMS::Genre object representing the artist's primary genre.

path

Returns an arrayref of hashrefs representing the artist's "path" in the iTMS. The hashrefs contain the name of the node in the path and the iTMS URL of that node.

For example, Elliott Smith's (id = 2893902) "path" is "Alternative > Elliott Smith", which is represented in Perl by:

    # URLs trimmed for example
    [
      {
        'url' => 'http://ax.phobos.apple.com.edgesuite.net/.../viewGenre?genreId=20',
        'name' => 'Alternative'
      },
      {
        'url' => 'http://ax.phobos.apple.com.edgesuite.net/.../viewArtist?artistId=2893902',
        'name' => 'Elliott Smith'
      }
    ]

This is pretty much only useful if you're trying to imitate the iTunes interface.

best_sellers

Returns an array or arrayref (depending on context) of Net::iTMS::Album objects for a selection of the best selling albums by the artist.

discography
albums

Returns an array or arrayref (depending on context) of Net::iTMS::Album objects for all the albums of the artist available on the iTMS.

biography

Returns an array or arrayref (depending on context) where each element is a paragraph in the artist's iTMS bio.

Options

If this option is set, iTMS links to albums within the bio will be translated into HTML links. The albumId is prepended to the URL passed as the value of the option.

The default is to simply ignore the links, leaving the plain text title.

influences

Returns an array or arrayref (depending on context) of Net::iTMS::Album objects for the albums/artists which influenced the artist, according to the iTMS.

LICENSE

Copyright 2004, Thomas R. Sibley.

You may use, modify, and distribute this package under the same terms as Perl itself.

AUTHOR

Thomas R. Sibley, http://zulutango.org:82/

SEE ALSO

Net::iTMS, Net::iTMS::Album, Net::iTMS::Song, Net::iTMS::Genre