de.umass.lastfm
Class Library

java.lang.Object
  extended byde.umass.lastfm.Library

public class Library
extends Object

Contains bindings for all methods in the "library" namespace.

Author:
Martin Chorley, Janni Kovacs

Method Summary
static Result addAlbum(String artist, String album, Session session)
          Add an album to a user's Last.fm library
static Result addArtist(String artist, Session session)
          Add an artist to a user's Last.fm library
static Result addTrack(String artist, String track, Session session)
          Add a track to a user's Last.fm library
static PaginatedResult getAlbums(String user, int page, int limit, String apiKey)
          Retrieves a paginated list of all the albums in a user's library.
static PaginatedResult getAlbums(String user, int page, String apiKey)
          Retrieves a paginated list of all the albums in a user's library.
static PaginatedResult getAlbums(String user, String apiKey)
          Retrieves a paginated list of all the albums in a user's library.
static Collection getAllAlbums(String user, String apiKey)
          Retrieves all albums in a user's library.
static Collection getAllArtists(String user, String apiKey)
          Retrieves all artists in a user's library.
static Collection getAllTracks(String user, String apiKey)
          Retrieves all tracks in a user's library.
static PaginatedResult getArtists(String user, int page, int limit, String apiKey)
          Retrieves a paginated list of all the artists in a user's library.
static PaginatedResult getArtists(String user, int page, String apiKey)
          Retrieves a paginated list of all the artists in a user's library.
static PaginatedResult getArtists(String user, String apiKey)
          Retrieves a paginated list of all the artists in a user's library.
static PaginatedResult getTracks(String user, int page, int limit, String apiKey)
          Retrieves a paginated list of all the tracks in a user's library.
static PaginatedResult getTracks(String user, int page, String apiKey)
          Retrieves a paginated list of all the tracks in a user's library.
static PaginatedResult getTracks(String user, String apiKey)
          Retrieves a paginated list of all the tracks in a user's library.
static Result removeAlbum(String artist, String album, Session session)
          Remove an album from a user's Last.fm library
static Result removeArtist(String artist, Session session)
          Remove an artist from a user's Last.fm library
static Result removeScrobble(String artist, String track, long timestamp, Session session)
          Remove a scrobble from a user's Last.fm library
static Result removeTrack(String artist, String track, Session session)
          Remove a track from a user's Last.fm library
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getArtists

public static PaginatedResult getArtists(String user,
                                         String apiKey)
Retrieves a paginated list of all the artists in a user's library.

Parameters:
user - The user whose library you want to fetch.
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the artists

getArtists

public static PaginatedResult getArtists(String user,
                                         int page,
                                         String apiKey)
Retrieves a paginated list of all the artists in a user's library.

Parameters:
user - The user whose library you want to fetch.
page - The page number you wish to scan to.
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the artists

getArtists

public static PaginatedResult getArtists(String user,
                                         int page,
                                         int limit,
                                         String apiKey)
Retrieves a paginated list of all the artists in a user's library.

Parameters:
user - The user whose library you want to fetch.
page - The page number you wish to scan to.
limit - Limit the amount of artists returned (maximum/default is 50).
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the artists

getAllArtists

public static Collection getAllArtists(String user,
                                       String apiKey)
Retrieves all artists in a user's library. Pay attention if you use this method as it may produce a lot of network traffic and therefore may consume a long time.

Parameters:
user - The user whose library you want to fetch.
apiKey - A Last.fm API key.
Returns:
all artists in a user's library

getAlbums

public static PaginatedResult getAlbums(String user,
                                        String apiKey)
Retrieves a paginated list of all the albums in a user's library.

Parameters:
user - The user whose library you want to fetch.
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the albums

getAlbums

public static PaginatedResult getAlbums(String user,
                                        int page,
                                        String apiKey)
Retrieves a paginated list of all the albums in a user's library.

Parameters:
user - The user whose library you want to fetch.
page - The page number you wish to scan to.
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the albums

getAlbums

public static PaginatedResult getAlbums(String user,
                                        int page,
                                        int limit,
                                        String apiKey)
Retrieves a paginated list of all the albums in a user's library.

Parameters:
user - The user whose library you want to fetch.
page - The page number you wish to scan to.
limit - Limit the amount of albumss returned (maximum/default is 50).
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the albums

getAllAlbums

public static Collection getAllAlbums(String user,
                                      String apiKey)
Retrieves all albums in a user's library. Pay attention if you use this method as it may produce a lot of network traffic and therefore may consume a long time.

Parameters:
user - The user whose library you want to fetch.
apiKey - A Last.fm API key.
Returns:
all albums in a user's library

getTracks

public static PaginatedResult getTracks(String user,
                                        String apiKey)
Retrieves a paginated list of all the tracks in a user's library.

Parameters:
user - The user whose library you want to fetch.
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the tracks

getTracks

public static PaginatedResult getTracks(String user,
                                        int page,
                                        String apiKey)
Retrieves a paginated list of all the tracks in a user's library.

Parameters:
user - The user whose library you want to fetch.
page - The page number you wish to scan to.
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the tracks

getTracks

public static PaginatedResult getTracks(String user,
                                        int page,
                                        int limit,
                                        String apiKey)
Retrieves a paginated list of all the tracks in a user's library.

Parameters:
user - The user whose library you want to fetch.
page - The page number you wish to scan to.
limit - Limit the amount of albumss returned (maximum/default is 50).
apiKey - A Last.fm API key.
Returns:
a PaginatedResult of the tracks

getAllTracks

public static Collection getAllTracks(String user,
                                      String apiKey)
Retrieves all tracks in a user's library. Pay attention if you use this method as it may produce a lot of network traffic and therefore may consume a long time.

Parameters:
user - The user whose library you want to fetch.
apiKey - A Last.fm API key.
Returns:
all tracks in a user's library

addArtist

public static Result addArtist(String artist,
                               Session session)
Add an artist to a user's Last.fm library

Parameters:
artist - The artist name you wish to add
session - A Session instance
Returns:
the result of the operation

addAlbum

public static Result addAlbum(String artist,
                              String album,
                              Session session)
Add an album to a user's Last.fm library

Parameters:
artist - The artist that composed the track
album - The album name you wish to add
session - A Session instance
Returns:
the result of the operation

addTrack

public static Result addTrack(String artist,
                              String track,
                              Session session)
Add a track to a user's Last.fm library

Parameters:
artist - The artist that composed the track
track - The track name you wish to add
session - A Session instance
Returns:
the result of the operation

removeArtist

public static Result removeArtist(String artist,
                                  Session session)
Remove an artist from a user's Last.fm library

Parameters:
artist - The artist name you wish to remove
session - A Session instance
Returns:
the result of the operation

removeAlbum

public static Result removeAlbum(String artist,
                                 String album,
                                 Session session)
Remove an album from a user's Last.fm library

Parameters:
artist - The artist that composed the album
album - The name of the album you wish to remove
session - A Session instance
Returns:
the result of the operation

removeTrack

public static Result removeTrack(String artist,
                                 String track,
                                 Session session)
Remove a track from a user's Last.fm library

Parameters:
artist - The artist that composed the track
track - The name of the track that you wish to remove
session - A Session instance
Returns:
the result of the operation

removeScrobble

public static Result removeScrobble(String artist,
                                    String track,
                                    long timestamp,
                                    Session session)
Remove a scrobble from a user's Last.fm library

Parameters:
artist - The artist that composed the track
track - The name of the track
timestamp - The unix timestamp of the scrobble that you wish to remove
session - A Session instance
Returns:
the result of the operation