Class Artist


  • public class Artist
    extends MusicEntry
    Bean that contains artist information.
    This class contains static methods that executes API methods relating to artists.
    Method names are equivalent to the last.fm API method names.
    Author:
    Janni Kovacs
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Artist​(java.lang.String name, java.lang.String url)  
      protected Artist​(java.lang.String name, java.lang.String url, java.lang.String mbid, int playcount, int listeners, boolean streamable)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Result addTags​(java.lang.String artist, java.lang.String tags, Session session)
      Tag an artist with one or more user supplied tags.
      static Artist getCorrection​(java.lang.String artist, java.lang.String apiKey)
      Use the last.fm corrections data to check whether the supplied artist has a correction to a canonical artist.
      static java.util.Collection<Event> getEvents​(java.lang.String artist, java.lang.String apiKey)
      Returns a list of upcoming events for an artist.
      static PaginatedResult<Image> getImages​(java.lang.String artist, int page, int limit, java.lang.String apiKey)
      Get Images for this artist in a variety of sizes.
      static PaginatedResult<Image> getImages​(java.lang.String artist, java.lang.String apiKey)
      Get Images for this artist in a variety of sizes.
      static Artist getInfo​(java.lang.String artistOrMbid, java.lang.String apiKey)
      Retrieves detailed artist info for the given artist or mbid entry.
      static Artist getInfo​(java.lang.String artistOrMbid, java.lang.String username, java.lang.String apiKey)
      Retrieves detailed artist info for the given artist or mbid entry.
      static Artist getInfo​(java.lang.String artistOrMbid, java.util.Locale locale, java.lang.String username, java.lang.String apiKey)
      Retrieves detailed artist info for the given artist or mbid entry.
      static PaginatedResult<Event> getPastEvents​(java.lang.String artist, int page, int limit, java.lang.String apiKey)
      Get a paginated list of all the events this artist has played at in the past.
      static PaginatedResult<Event> getPastEvents​(java.lang.String artist, java.lang.String apiKey)
      Get a paginated list of all the events this artist has played at in the past.
      java.util.Collection<Artist> getSimilar()
      Returns a list of similar Artists.
      static java.util.Collection<Artist> getSimilar​(java.lang.String artist, int limit, java.lang.String apiKey)
      Returns limit similar artists to the given one.
      static java.util.Collection<Artist> getSimilar​(java.lang.String artist, java.lang.String apiKey)
      Calls getSimilar(String, int, String) with the default limit of 100.
      float getSimilarityMatch()  
      static java.util.Collection<java.lang.String> getTags​(java.lang.String artist, Session session)
      Get the tags applied by an individual user to an artist on Last.fm.
      static java.util.Collection<Album> getTopAlbums​(java.lang.String artist, java.lang.String apiKey)
      Returns a list of the given artist's top albums.
      static java.util.Collection<User> getTopFans​(java.lang.String artist, java.lang.String apiKey)
      Retrieves a list of the top fans of the given artist.
      static java.util.Collection<Tag> getTopTags​(java.lang.String artist, java.lang.String apiKey)
      Retrieves the top tags for the given artist.
      static java.util.Collection<Track> getTopTracks​(java.lang.String artist, java.lang.String apiKey)
      Get the top tracks by an artist on Last.fm, ordered by popularity
      static Result removeTag​(java.lang.String artist, java.lang.String tag, Session session)
      Remove a user's tag from an artist.
      static java.util.Collection<Artist> search​(java.lang.String name, java.lang.String apiKey)
      Searches for an artist and returns a Collection of possible matches.
      static Result share​(java.lang.String artist, java.lang.String recipients, java.lang.String message, Session session)
      Share an artist with one or more Last.fm users or other friends.
      static Result shout​(java.lang.String artist, java.lang.String message, Session session)
      Shout on this artist's shoutbox
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Artist

        protected Artist​(java.lang.String name,
                         java.lang.String url)
      • Artist

        protected Artist​(java.lang.String name,
                         java.lang.String url,
                         java.lang.String mbid,
                         int playcount,
                         int listeners,
                         boolean streamable)
    • Method Detail

      • getSimilarityMatch

        public float getSimilarityMatch()
      • getInfo

        public static Artist getInfo​(java.lang.String artistOrMbid,
                                     java.lang.String apiKey)
        Retrieves detailed artist info for the given artist or mbid entry.
        Parameters:
        artistOrMbid - Name of the artist or an mbid
        apiKey - The API key
        Returns:
        detailed artist info
      • getInfo

        public static Artist getInfo​(java.lang.String artistOrMbid,
                                     java.lang.String username,
                                     java.lang.String apiKey)
        Retrieves detailed artist info for the given artist or mbid entry.
        Parameters:
        artistOrMbid - Name of the artist or an mbid
        username - The username for the context of the request, or null. If supplied, the user's playcount for this artist is included in the response
        apiKey - The API key
        Returns:
        detailed artist info
      • getInfo

        public static Artist getInfo​(java.lang.String artistOrMbid,
                                     java.util.Locale locale,
                                     java.lang.String username,
                                     java.lang.String apiKey)
        Retrieves detailed artist info for the given artist or mbid entry.
        Parameters:
        artistOrMbid - Name of the artist or an mbid
        locale - The language to fetch info in, or null
        username - The username for the context of the request, or null. If supplied, the user's playcount for this artist is included in the response
        apiKey - The API key
        Returns:
        detailed artist info
      • getSimilar

        public static java.util.Collection<Artist> getSimilar​(java.lang.String artist,
                                                              int limit,
                                                              java.lang.String apiKey)
        Returns limit similar artists to the given one.
        Parameters:
        artist - Artist's name
        limit - Number of maximum results
        apiKey - The API key
        Returns:
        similar artists
      • search

        public static java.util.Collection<Artist> search​(java.lang.String name,
                                                          java.lang.String apiKey)
        Searches for an artist and returns a Collection of possible matches.
        Parameters:
        name - The artist name to look up
        apiKey - The API key
        Returns:
        a list of possible matches
      • getTopAlbums

        public static java.util.Collection<Album> getTopAlbums​(java.lang.String artist,
                                                               java.lang.String apiKey)
        Returns a list of the given artist's top albums.
        Parameters:
        artist - Artist's name
        apiKey - The API key
        Returns:
        list of top albums
      • getTopFans

        public static java.util.Collection<User> getTopFans​(java.lang.String artist,
                                                            java.lang.String apiKey)
        Retrieves a list of the top fans of the given artist.
        Parameters:
        artist - Artist's name
        apiKey - The API key
        Returns:
        list of top fans
      • getTopTags

        public static java.util.Collection<Tag> getTopTags​(java.lang.String artist,
                                                           java.lang.String apiKey)
        Retrieves the top tags for the given artist.
        Parameters:
        artist - Artist's name
        apiKey - The API key
        Returns:
        list of top tags
      • getTopTracks

        public static java.util.Collection<Track> getTopTracks​(java.lang.String artist,
                                                               java.lang.String apiKey)
        Get the top tracks by an artist on Last.fm, ordered by popularity
        Parameters:
        artist - The artist name in question
        apiKey - A Last.fm API key.
        Returns:
        list of top tracks
      • addTags

        public static Result addTags​(java.lang.String artist,
                                     java.lang.String tags,
                                     Session session)
        Tag an artist with one or more user supplied tags.
        Parameters:
        artist - The artist name in question.
        tags - A comma delimited list of user supplied tags to apply to this artist. Accepts a maximum of 10 tags.
        session - A Session instance
        Returns:
        the result of the operation
      • removeTag

        public static Result removeTag​(java.lang.String artist,
                                       java.lang.String tag,
                                       Session session)
        Remove a user's tag from an artist.
        Parameters:
        artist - The artist name in question.
        tag - A single user tag to remove from this artist.
        session - A Session instance
        Returns:
        the result of the operation
      • share

        public static Result share​(java.lang.String artist,
                                   java.lang.String recipients,
                                   java.lang.String message,
                                   Session session)
        Share an artist with one or more Last.fm users or other friends.
        Parameters:
        artist - The artist to share.
        recipients - A comma delimited list of email addresses or Last.fm usernames. Maximum is 10.
        message - An optional message to send with the recommendation.
        session - A Session instance
        Returns:
        the Result of the operation
      • getTags

        public static java.util.Collection<java.lang.String> getTags​(java.lang.String artist,
                                                                     Session session)
        Get the tags applied by an individual user to an artist on Last.fm.
        Parameters:
        artist - The artist name in question
        session - A Session instance
        Returns:
        a list of tags
      • getEvents

        public static java.util.Collection<Event> getEvents​(java.lang.String artist,
                                                            java.lang.String apiKey)
        Returns a list of upcoming events for an artist.
        Parameters:
        artist - The artist name in question
        apiKey - A Last.fm API key.
        Returns:
        a list of events
      • getPastEvents

        public static PaginatedResult<Event> getPastEvents​(java.lang.String artist,
                                                           java.lang.String apiKey)
        Get a paginated list of all the events this artist has played at in the past.
        Parameters:
        artist - The name of the artist you would like to fetch event listings for
        apiKey - A Last.fm API key
        Returns:
        a list of past events
      • getPastEvents

        public static PaginatedResult<Event> getPastEvents​(java.lang.String artist,
                                                           int page,
                                                           int limit,
                                                           java.lang.String apiKey)
        Get a paginated list of all the events this artist has played at in the past.
        Parameters:
        artist - The name of the artist you would like to fetch event listings for
        page - The page of results to return
        limit - The maximum number of results to return per page
        apiKey - A Last.fm API key
        Returns:
        a list of past events
      • getImages

        public static PaginatedResult<Image> getImages​(java.lang.String artist,
                                                       java.lang.String apiKey)
        Get Images for this artist in a variety of sizes.
        Parameters:
        artist - The artist name in question
        apiKey - A Last.fm API key
        Returns:
        a list of Images
      • getImages

        public static PaginatedResult<Image> getImages​(java.lang.String artist,
                                                       int page,
                                                       int limit,
                                                       java.lang.String apiKey)
        Get Images for this artist in a variety of sizes.
        Parameters:
        artist - The artist name in question
        page - Which page of limit amount to display
        limit - How many to return. Defaults and maxes out at 50
        apiKey - A Last.fm API key
        Returns:
        a list of Images
      • shout

        public static Result shout​(java.lang.String artist,
                                   java.lang.String message,
                                   Session session)
        Shout on this artist's shoutbox
        Parameters:
        artist - The name of the artist to shout on
        message - The message to post to the shoutbox
        session - A Session instance
        Returns:
        the result of the operation
      • getCorrection

        public static Artist getCorrection​(java.lang.String artist,
                                           java.lang.String apiKey)
        Use the last.fm corrections data to check whether the supplied artist has a correction to a canonical artist. This method returns a new Artist object containing the corrected data, or null if the supplied Artist was not found.
        Parameters:
        artist - The artist name to correct
        apiKey - A Last.fm API key
        Returns:
        a new Artist, or null