public class Track extends MusicEntry
Track
s and provides bindings to methods
in the track.
namespace.Modifier and Type | Field and Description |
---|---|
protected String |
album |
static String |
ALBUM_PAGE |
protected String |
albumMbid |
protected String |
artist |
static String |
ARTIST_PAGE |
protected String |
artistMbid |
protected int |
duration |
protected boolean |
fullTrackAvailable |
protected Map<String,String> |
lastFmExtensionInfos |
protected String |
location |
protected boolean |
nowPlaying |
protected Date |
playedWhen |
protected int |
position |
static String |
TRACK_PAGE |
id, listeners, mbid, name, percentageChange, playcount, streamable, tags, url, userPlaycount
imageUrls
Modifier | Constructor and Description |
---|---|
protected |
Track(String name,
String url,
String artist) |
protected |
Track(String name,
String url,
String mbid,
int playcount,
int listeners,
boolean streamable,
String artist,
String artistMbid,
boolean fullTrackAvailable,
boolean nowPlaying) |
Modifier and Type | Method and Description |
---|---|
static Result |
addTags(String artist,
String track,
String tags,
Session session)
Tag an album using a list of user supplied tags.
|
static Result |
ban(String artist,
String track,
Session session)
Ban a track for a given user profile.
|
String |
getAlbum() |
String |
getAlbumMbid() |
String |
getArtist() |
String |
getArtistMbid() |
static Collection<BuyLink> |
getBuylinks(String artist,
String albumOrMbid,
String country,
String apiKey)
Get a list of Buy Links for a particular Track.
|
static Track |
getCorrection(String artist,
String track,
String apiKey)
Use the last.fm corrections data to check whether the supplied track has a correction to a canonical track.
|
int |
getDuration()
Returns the duration of the song, if available, in seconds.
|
static Track |
getInfo(String artist,
String trackOrMbid,
Locale locale,
String username,
String apiKey)
Get the metadata for a track on Last.fm using the artist/track name or a musicbrainz id.
|
static Track |
getInfo(String artist,
String trackOrMbid,
String apiKey)
Get the metadata for a track on Last.fm using the artist/track name or a musicbrainz id.
|
String |
getLastFmInfo(String key)
Returns last.fm specific information about this Track.
|
String |
getLocation()
Returns the location (URL) of this Track.
|
Date |
getPlayedWhen()
Returns the time when the track was played, if this data is available (e.g.
|
int |
getPosition()
Returns the position of this track in its associated album, or -1 if not available.
|
static Collection<Track> |
getSimilar(String artist,
String trackOrMbid,
String apiKey)
Get the similar tracks for this track on Last.fm, based on listening data.
You have to provide either an artist and a track name or an mbid. |
static Collection<String> |
getTags(String artist,
String track,
Session session)
Get the tags applied by an individual user to an track on Last.fm.
|
static Collection<User> |
getTopFans(String artist,
String trackOrMbid,
String apiKey)
Retrieves the top fans for the given track.
|
static Collection<Tag> |
getTopTags(String artist,
String trackOrMbid,
String apiKey)
Retrieves the top tags for the given track.
|
boolean |
isFullTrackAvailable() |
boolean |
isNowPlaying() |
static Result |
love(String artist,
String track,
Session session)
Love a track for a user profile.
|
static Result |
removeTag(String artist,
String track,
String tag,
Session session)
Remove a user's tag from a track.
|
static List<ScrobbleResult> |
scrobble(List<ScrobbleData> scrobbleData,
Session session) |
static ScrobbleResult |
scrobble(ScrobbleData scrobbleData,
Session session) |
static ScrobbleResult |
scrobble(String artistName,
String trackName,
int timestamp,
Session session) |
static Collection<Track> |
search(String track,
String apiKey)
Searches for a track with the given name and returns a list of possible matches.
|
static Collection<Track> |
search(String artist,
String track,
int limit,
String apiKey)
Searches for a track with the given name and returns a list of possible matches.
|
static Result |
share(String artist,
String track,
String message,
String recipient,
Session session)
Share a track twith one or more Last.fm users or other friends.
|
String |
toString() |
static Result |
unban(String artist,
String track,
Session session)
UnBan a track for a given user profile.
|
static Result |
unlove(String artist,
String track,
Session session)
UnLove a track for a user profile.
|
static ScrobbleResult |
updateNowPlaying(ScrobbleData scrobbleData,
Session session) |
static ScrobbleResult |
updateNowPlaying(String artistName,
String trackName,
Session session) |
getId, getListeners, getMbid, getName, getPercentageChange, getPlaycount, getTags, getUrl, getUserPlaycount, getWikiLastChanged, getWikiSummary, getWikiText, isStreamable, loadStandardInfo
availableSizes, getImageURL, loadImages
public static final String ARTIST_PAGE
public static final String ALBUM_PAGE
public static final String TRACK_PAGE
protected String artist
protected String artistMbid
protected String album
protected String albumMbid
protected int position
protected boolean fullTrackAvailable
protected boolean nowPlaying
protected Date playedWhen
protected int duration
protected String location
public int getDuration()
Playlist.fetch
and
Track.getInfo
.public String getArtist()
public String getArtistMbid()
public String getAlbum()
public String getAlbumMbid()
public boolean isFullTrackAvailable()
public boolean isNowPlaying()
public String getLocation()
Radio
services.public String getLastFmInfo(String key)
key
- A keyARTIST_PAGE
,
ALBUM_PAGE
,
TRACK_PAGE
public Date getPlayedWhen()
null
,
if this data is not available.null
public int getPosition()
public static Collection<Track> search(String track, String apiKey)
track
- Track nameapiKey
- The API keysearch(String, String, int, String)
public static Collection<Track> search(String artist, String track, int limit, String apiKey)
null
for the artist parameter if you want to specify a limit but don't want
to define an artist.artist
- Artist's name or null
track
- Track namelimit
- Number of maximum resultsapiKey
- The API keypublic static Collection<Tag> getTopTags(String artist, String trackOrMbid, String apiKey)
null
for the first parameter.artist
- Artist name or null
if an MBID is specifiedtrackOrMbid
- Track name or MBIDapiKey
- The API keypublic static Collection<User> getTopFans(String artist, String trackOrMbid, String apiKey)
null
for the first parameter.artist
- Artist name or null
if an MBID is specifiedtrackOrMbid
- Track name or MBIDapiKey
- The API keypublic static Result addTags(String artist, String track, String tags, Session session)
artist
- The artist name in questiontrack
- The track name in questiontags
- A comma delimited list of user supplied tags to apply to this track. Accepts a maximum of 10 tags.session
- A Session instance.public static Result removeTag(String artist, String track, String tag, Session session)
artist
- The artist name in questiontrack
- The track name in questiontag
- A single user tag to remove from this track.session
- A Session instance.public static Result share(String artist, String track, String message, String recipient, Session session)
artist
- An artist name.track
- A track name.message
- A message to send with the recommendation or null
. If not supplied a default message will be used.recipient
- A comma delimited list of email addresses or Last.fm usernames. Maximum is 10.session
- A Session instancepublic static Result love(String artist, String track, Session session)
artist
- An artist nametrack
- A track namesession
- A Session instancepublic static Result unlove(String artist, String track, Session session)
artist
- An artist nametrack
- A track namesession
- A Session instancepublic static Result ban(String artist, String track, Session session)
artist
- An artist nametrack
- A track namesession
- A Session instancepublic static Result unban(String artist, String track, Session session)
artist
- An artist nametrack
- A track namesession
- A Session instancepublic static Collection<Track> getSimilar(String artist, String trackOrMbid, String apiKey)
null
for parameters you don't need.artist
- The artist name in questiontrackOrMbid
- The track name in question or the track's MBIDapiKey
- A Last.fm API key.Track
spublic static Collection<String> getTags(String artist, String track, Session session)
artist
- The artist name in questiontrack
- The track name in questionsession
- A Session instancepublic static Track getInfo(String artist, String trackOrMbid, String apiKey)
artist
- The artist name in question or null
if an mbid is specifiedtrackOrMbid
- The track name in question or the musicbrainz id for the trackapiKey
- A Last.fm API key.public static Track getInfo(String artist, String trackOrMbid, Locale locale, String username, String apiKey)
artist
- The artist name in question or null
if an mbid is specifiedtrackOrMbid
- The track name in question or the musicbrainz id for the tracklocale
- 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 track and whether they have loved the track is included in the responseapiKey
- A Last.fm API key.public static Collection<BuyLink> getBuylinks(String artist, String albumOrMbid, String country, String apiKey)
artist
- The artist name in questionalbumOrMbid
- Track name or MBIDcountry
- A country name, as defined by the ISO 3166-1 country names standardapiKey
- A Last.fm API keyBuyLink
spublic static Track getCorrection(String artist, String track, String apiKey)
Track
object containing the corrected data, or null
if the supplied Artist/Track combination was not found.artist
- The artist name to correcttrack
- The track name to correctapiKey
- A Last.fm API keyTrack
, or null
public static ScrobbleResult scrobble(ScrobbleData scrobbleData, Session session)
public static ScrobbleResult scrobble(String artistName, String trackName, int timestamp, Session session)
public static List<ScrobbleResult> scrobble(List<ScrobbleData> scrobbleData, Session session)
public static ScrobbleResult updateNowPlaying(ScrobbleData scrobbleData, Session session)
public static ScrobbleResult updateNowPlaying(String artistName, String trackName, Session session)