net.roarsoftware.lastfm
Class Playlist

java.lang.Object
  extended by net.roarsoftware.lastfm.Playlist

public class Playlist
extends java.lang.Object

Bean for music playlists. Contains the fetch method and various fetchXXX methods to retrieve playlists from the server. Playlists are identified by lastfm:// playlist urls. Valid urls include:

See http://www.last.fm/api/playlists for more information about playlists.

Author:
Janni Kovacs

Method Summary
static Result addTrack(int playlistId, java.lang.String artist, java.lang.String track, Session session)
          Add a track to a Last.fm user's playlist.
static Playlist create(java.lang.String title, java.lang.String description, Session session)
          Creates a Last.fm playlist.
static Playlist fetch(java.lang.String playlistUrl, java.lang.String apiKey)
          Fetches a playlist using a lastfm playlist url.
static Playlist fetchAlbumPlaylist(java.lang.String albumId, java.lang.String apiKey)
          Fetches an album playlist, which contains the tracks of the specified album.
static Playlist fetchTagPlaylist(java.lang.String tag, java.lang.String apiKey)
          Fetches a playlist of freetracks for a given tag name.
static Playlist fetchUserPlaylist(int playlistId, java.lang.String apiKey)
          Fetches a user-created playlist.
 java.lang.String getAnnotation()
           
 java.lang.String getCreator()
           
 int getId()
           
 int getSize()
           
 java.lang.String getTitle()
           
 java.util.Collection<Track> getTracks()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCreator

public java.lang.String getCreator()

getId

public int getId()

getSize

public int getSize()

getTitle

public java.lang.String getTitle()

getAnnotation

public java.lang.String getAnnotation()

getTracks

public java.util.Collection<Track> getTracks()

fetchAlbumPlaylist

public static Playlist fetchAlbumPlaylist(java.lang.String albumId,
                                          java.lang.String apiKey)
Fetches an album playlist, which contains the tracks of the specified album.

Parameters:
albumId - The album id as returned in Album.getInfo.
apiKey - A Last.fm API key.
Returns:
a playlist

fetchUserPlaylist

public static Playlist fetchUserPlaylist(int playlistId,
                                         java.lang.String apiKey)
Fetches a user-created playlist.

Parameters:
playlistId - A playlist id.
apiKey - A Last.fm API key.
Returns:
a playlist

fetchTagPlaylist

public static Playlist fetchTagPlaylist(java.lang.String tag,
                                        java.lang.String apiKey)
Fetches a playlist of freetracks for a given tag name.

Parameters:
tag - A tag name.
apiKey - A Last.fm API key.
Returns:
a playlist

fetch

public static Playlist fetch(java.lang.String playlistUrl,
                             java.lang.String apiKey)
Fetches a playlist using a lastfm playlist url. See the class description for a list of valid playlist urls.

Parameters:
playlistUrl - A valid playlist url.
apiKey - A Last.fm API key.
Returns:
a playlist

addTrack

public static Result addTrack(int playlistId,
                              java.lang.String artist,
                              java.lang.String track,
                              Session session)
Add a track to a Last.fm user's playlist.

Parameters:
playlistId - The ID of the playlist - this is available in user.getPlaylists
artist - The artist name that corresponds to the track to be added.
track - The track name to add to the playlist.
session - A Session instance.
Returns:
the result of the operation

create

public static Playlist create(java.lang.String title,
                              java.lang.String description,
                              Session session)
Creates a Last.fm playlist.

Parameters:
title - A title for the playlist
description - A description for the playlist
session - A Session instance
Returns:
the result of the operation