de.umass.lastfm
Class User

java.lang.Object
  extended by de.umass.lastfm.ImageHolder
      extended by de.umass.lastfm.User

public class User
extends ImageHolder

Contains user information and provides bindings to the methods in the user. namespace.

Author:
Janni Kovacs

Field Summary
 
Fields inherited from class de.umass.lastfm.ImageHolder
imageUrls
 
Method Summary
 int getAge()
           
static PaginatedResult<Track> getArtistTracks(String user, String artist, int page, long startTimestamp, long endTimestamp, String apiKey)
          Get a list of tracks by a given artist scrobbled by this user, including scrobble time.
static PaginatedResult<Track> getArtistTracks(String user, String artist, String apiKey)
          Get a list of tracks by a given artist scrobbled by this user, including scrobble time.
static PaginatedResult<Track> getBannedTracks(String user, int page, String apiKey)
          Returns the tracks banned by the user.
static PaginatedResult<Track> getBannedTracks(String user, String apiKey)
          Returns the tracks banned by the user.
 String getCountry()
           
static Collection<Event> getEvents(String user, String apiKey)
          GetS a list of upcoming events that this user is attending.
static Collection<User> getFriends(String user, boolean recenttracks, int limit, String apiKey)
           
static Collection<User> getFriends(String user, String apiKey)
           
 String getGender()
           
 String getId()
           
 String getImageURL()
           
static User getInfo(String user, String apiKey)
          Retrieves profile information about the specified user.
 String getLanguage()
           
static PaginatedResult<Track> getLovedTracks(String user, int page, String apiKey)
          Retrieves the loved tracks by a user.
static PaginatedResult<Track> getLovedTracks(String user, String apiKey)
          Retrieves the loved tracks by a user.
 String getName()
           
static Collection<User> getNeighbours(String user, int limit, String apiKey)
           
static Collection<User> getNeighbours(String user, String apiKey)
           
static Collection<Album> getNewReleases(String user, boolean useRecommendations, String apiKey)
          Gets a list of forthcoming releases based on a user's musical taste.
static Collection<Album> getNewReleases(String user, String apiKey)
          Gets a list of forthcoming releases based on a user's musical taste.
 int getNumPlaylists()
           
static PaginatedResult<Event> getPastEvents(String user, int page, String apiKey)
          Gets a paginated list of all events a user has attended in the past.
static PaginatedResult<Event> getPastEvents(String user, String apiKey)
          Get the first page of a paginated result of all events a user has attended in the past.
 int getPlaycount()
           
static Collection<Playlist> getPlaylists(String user, String apiKey)
          Gets a list of a user's playlists on Last.fm.
 String getRealname()
           
static PaginatedResult<Track> getRecentTracks(String user, int limit, String apiKey, int page)
           
static PaginatedResult<Track> getRecentTracks(String user, String apiKey)
           
static PaginatedResult<Artist> getRecommendedArtists(int page, Session session)
          Get Last.fm artist recommendations for a user.
static PaginatedResult<Artist> getRecommendedArtists(Session session)
          Get Last.fm artist recommendations for a user.
static PaginatedResult<Event> getRecommendedEvents(int page, Session session)
           
static PaginatedResult<Event> getRecommendedEvents(Session session)
           
 Date getRegisteredDate()
           
static Collection<Album> getTopAlbums(String user, Period period, String apiKey)
           
static Collection<Album> getTopAlbums(String user, String apiKey)
           
static Collection<Artist> getTopArtists(String user, Period period, String apiKey)
           
static Collection<Artist> getTopArtists(String user, String apiKey)
           
static Collection<Tag> getTopTags(String user, int limit, String apiKey)
           
static Collection<Tag> getTopTags(String user, String apiKey)
           
static Collection<Track> getTopTracks(String user, Period period, String apiKey)
           
static Collection<Track> getTopTracks(String user, String apiKey)
           
 String getUrl()
           
static Chart<Album> getWeeklyAlbumChart(String user, int limit, String apiKey)
           
static Chart<Album> getWeeklyAlbumChart(String user, String apiKey)
           
static Chart<Album> getWeeklyAlbumChart(String user, String from, String to, int limit, String apiKey)
           
static Chart<Artist> getWeeklyArtistChart(String user, int limit, String apiKey)
           
static Chart<Artist> getWeeklyArtistChart(String user, String apiKey)
           
static Chart<Artist> getWeeklyArtistChart(String user, String from, String to, int limit, String apiKey)
           
static LinkedHashMap<String,String> getWeeklyChartList(String user, String apiKey)
           
static Collection<Chart> getWeeklyChartListAsCharts(String user, String apiKey)
           
static Chart<Track> getWeeklyTrackChart(String user, int limit, String apiKey)
           
static Chart<Track> getWeeklyTrackChart(String user, String apiKey)
           
static Chart<Track> getWeeklyTrackChart(String user, String from, String to, int limit, String apiKey)
           
 boolean isSubscriber()
           
static Result shout(String user, String message, Session session)
          Shout on this user's shoutbox
 
Methods inherited from class de.umass.lastfm.ImageHolder
availableSizes, getImageURL, loadImages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public String getName()

getRealname

public String getRealname()

getUrl

public String getUrl()

getAge

public int getAge()

getCountry

public String getCountry()

getGender

public String getGender()

getLanguage

public String getLanguage()

getNumPlaylists

public int getNumPlaylists()

getPlaycount

public int getPlaycount()

isSubscriber

public boolean isSubscriber()

getImageURL

public String getImageURL()

getId

public String getId()

getRegisteredDate

public Date getRegisteredDate()

getArtistTracks

public static PaginatedResult<Track> getArtistTracks(String user,
                                                     String artist,
                                                     String apiKey)
Get a list of tracks by a given artist scrobbled by this user, including scrobble time. Can be limited to specific timeranges, defaults to all time.

Parameters:
user - The last.fm username to fetch the recent tracks of
artist - The artist name you are interested in
apiKey - A Last.fm API key
Returns:
a list of Tracks

getArtistTracks

public static PaginatedResult<Track> getArtistTracks(String user,
                                                     String artist,
                                                     int page,
                                                     long startTimestamp,
                                                     long endTimestamp,
                                                     String apiKey)
Get a list of tracks by a given artist scrobbled by this user, including scrobble time. Can be limited to specific timeranges, defaults to all time.

Parameters:
user - The last.fm username to fetch the recent tracks of
artist - The artist name you are interested in
page - An integer used to fetch a specific page of tracks
startTimestamp - An unix timestamp to start at
endTimestamp - An unix timestamp to end at
apiKey - A Last.fm API key
Returns:
a list of Tracks

getFriends

public static Collection<User> getFriends(String user,
                                          String apiKey)

getFriends

public static Collection<User> getFriends(String user,
                                          boolean recenttracks,
                                          int limit,
                                          String apiKey)

getNeighbours

public static Collection<User> getNeighbours(String user,
                                             String apiKey)

getNeighbours

public static Collection<User> getNeighbours(String user,
                                             int limit,
                                             String apiKey)

getRecentTracks

public static PaginatedResult<Track> getRecentTracks(String user,
                                                     String apiKey)

getRecentTracks

public static PaginatedResult<Track> getRecentTracks(String user,
                                                     int limit,
                                                     String apiKey,
                                                     int page)

getTopAlbums

public static Collection<Album> getTopAlbums(String user,
                                             String apiKey)

getTopAlbums

public static Collection<Album> getTopAlbums(String user,
                                             Period period,
                                             String apiKey)

getTopArtists

public static Collection<Artist> getTopArtists(String user,
                                               String apiKey)

getTopArtists

public static Collection<Artist> getTopArtists(String user,
                                               Period period,
                                               String apiKey)

getTopTracks

public static Collection<Track> getTopTracks(String user,
                                             String apiKey)

getTopTracks

public static Collection<Track> getTopTracks(String user,
                                             Period period,
                                             String apiKey)

getTopTags

public static Collection<Tag> getTopTags(String user,
                                         String apiKey)

getTopTags

public static Collection<Tag> getTopTags(String user,
                                         int limit,
                                         String apiKey)

getWeeklyAlbumChart

public static Chart<Album> getWeeklyAlbumChart(String user,
                                               String apiKey)

getWeeklyAlbumChart

public static Chart<Album> getWeeklyAlbumChart(String user,
                                               int limit,
                                               String apiKey)

getWeeklyAlbumChart

public static Chart<Album> getWeeklyAlbumChart(String user,
                                               String from,
                                               String to,
                                               int limit,
                                               String apiKey)

getWeeklyArtistChart

public static Chart<Artist> getWeeklyArtistChart(String user,
                                                 String apiKey)

getWeeklyArtistChart

public static Chart<Artist> getWeeklyArtistChart(String user,
                                                 int limit,
                                                 String apiKey)

getWeeklyArtistChart

public static Chart<Artist> getWeeklyArtistChart(String user,
                                                 String from,
                                                 String to,
                                                 int limit,
                                                 String apiKey)

getWeeklyTrackChart

public static Chart<Track> getWeeklyTrackChart(String user,
                                               String apiKey)

getWeeklyTrackChart

public static Chart<Track> getWeeklyTrackChart(String user,
                                               int limit,
                                               String apiKey)

getWeeklyTrackChart

public static Chart<Track> getWeeklyTrackChart(String user,
                                               String from,
                                               String to,
                                               int limit,
                                               String apiKey)

getWeeklyChartList

public static LinkedHashMap<String,String> getWeeklyChartList(String user,
                                                              String apiKey)

getWeeklyChartListAsCharts

public static Collection<Chart> getWeeklyChartListAsCharts(String user,
                                                           String apiKey)

getEvents

public static Collection<Event> getEvents(String user,
                                          String apiKey)
GetS a list of upcoming events that this user is attending.

Parameters:
user - The user to fetch the events for.
apiKey - A Last.fm API key.
Returns:
a list of upcoming events

getPastEvents

public static PaginatedResult<Event> getPastEvents(String user,
                                                   String apiKey)
Get the first page of a paginated result of all events a user has attended in the past.

Parameters:
user - The username to fetch the events for.
apiKey - A Last.fm API key.
Returns:
a list of past Events

getPastEvents

public static PaginatedResult<Event> getPastEvents(String user,
                                                   int page,
                                                   String apiKey)
Gets a paginated list of all events a user has attended in the past.

Parameters:
user - The username to fetch the events for.
page - The page number to scan to.
apiKey - A Last.fm API key.
Returns:
a list of past Events

getRecommendedEvents

public static PaginatedResult<Event> getRecommendedEvents(Session session)

getRecommendedEvents

public static PaginatedResult<Event> getRecommendedEvents(int page,
                                                          Session session)

getPlaylists

public static Collection<Playlist> getPlaylists(String user,
                                                String apiKey)
Gets a list of a user's playlists on Last.fm. Note that this method only fetches metadata regarding the user's playlists. If you want to retrieve the list of tracks in a playlist use Playlist.fetch().

Parameters:
user - The last.fm username to fetch the playlists of.
apiKey - A Last.fm API key.
Returns:
a list of Playlists

getLovedTracks

public static PaginatedResult<Track> getLovedTracks(String user,
                                                    String apiKey)
Retrieves the loved tracks by a user.

Parameters:
user - The user name to fetch the loved tracks for.
apiKey - A Last.fm API key.
Returns:
the loved tracks

getLovedTracks

public static PaginatedResult<Track> getLovedTracks(String user,
                                                    int page,
                                                    String apiKey)
Retrieves the loved tracks by a user.

Parameters:
user - The user name to fetch the loved tracks for.
page - The page number to scan to
apiKey - A Last.fm API key.
Returns:
the loved tracks

getInfo

public static User getInfo(String user,
                           String apiKey)
Retrieves profile information about the specified user.

Parameters:
user - A username
apiKey - A Last.fm API key.
Returns:
User info

getRecommendedArtists

public static PaginatedResult<Artist> getRecommendedArtists(Session session)
Get Last.fm artist recommendations for a user.

Parameters:
session - A Session instance
Returns:
a list of Artists

getRecommendedArtists

public static PaginatedResult<Artist> getRecommendedArtists(int page,
                                                            Session session)
Get Last.fm artist recommendations for a user.

Parameters:
page - The page to fetch
session - A Session instance
Returns:
a list of Artists

shout

public static Result shout(String user,
                           String message,
                           Session session)
Shout on this user's shoutbox

Parameters:
user - The name of the user to shout on
message - The message to post to the shoutbox
session - A Session instance
Returns:
the result of the operation

getNewReleases

public static Collection<Album> getNewReleases(String user,
                                               String apiKey)
Gets a list of forthcoming releases based on a user's musical taste.

Parameters:
user - The Last.fm username
apiKey - A Last.fm API key
Returns:
a Collection of new Album releases

getNewReleases

public static Collection<Album> getNewReleases(String user,
                                               boolean useRecommendations,
                                               String apiKey)
Gets a list of forthcoming releases based on a user's musical taste.

Parameters:
user - The Last.fm username
useRecommendations - If true, the feed contains new releases based on Last.fm's artist recommendations for this user. Otherwise, it is based on their library (the default)
apiKey - A Last.fm API key
Returns:
a Collection of new Album releases

getBannedTracks

public static PaginatedResult<Track> getBannedTracks(String user,
                                                     String apiKey)
Returns the tracks banned by the user.

Parameters:
user - The user name
apiKey - A Last.fm API key
Returns:
the banned tracks

getBannedTracks

public static PaginatedResult<Track> getBannedTracks(String user,
                                                     int page,
                                                     String apiKey)
Returns the tracks banned by the user.

Parameters:
user - The user name
page - The page number to fetch
apiKey - A Last.fm API key
Returns:
the banned tracks