## net.dontdrinkandroot.lastfm.api.model
Class Track

    java.lang.Object
      net.dontdrinkandroot.lastfm.api.model.LfmEntity
          net.dontdrinkandroot.lastfm.api.model.Track

All Implemented Interfaces:
  java.io.Serializable, AlbumEntity, ArtistEntity, DateEntity, DurationEntity, Entity, IdEntity, ListenersEntity, MbidEntity, MusicBrainzEntity, NameEntity, NowPlayingEntity, PlayCountEntity, RankEntity, StreamableEntity, UrlEntity, UserPlayCountEntity

    public class Track

extends LfmEntity
implements MusicBrainzEntity, NameEntity, UrlEntity, PlayCountEntity, UserPlayCountEntity, IdEntity, DurationEntity, StreamableEntity, DateEntity, RankEntity, AlbumEntity, NowPlayingEntity, ArtistEntity

See Also:
  Serialized Form

Constructor Summary
`Track(org.w3c.dom.Element element)` Create a track from a dom4j element.
`Track(java.lang.String name)`

Method Summary
`Album` `getAlbum()`
`java.util.List<Album>` `getAlbums()`
`Artist` `getArtist()`
`java.util.Date` `getDate()`
`java.lang.Long` `getDuration()`
`java.lang.Long` `getId()`
`static UnauthenticatedGetQuery<Track>` `getInfo(java.lang.String artist, java.lang.String track, java.lang.String mbid, java.lang.String username)` Get the metadata for a track on Last.fm using the artist/track name or a musicbrainz id.
`java.lang.Integer` `getListeners()`
`java.lang.Float` `getMatch()`
`java.lang.String` `getMbid()`
`java.lang.String` `getName()`
`java.lang.Boolean` `getNowPlaying()`
`java.lang.Integer` `getPlayCount()`
`java.lang.Integer` `getRank()`
`static UnauthenticatedGetQuery<java.util.ArrayList<Track>>` `getSimilar(java.lang.String track, java.lang.String artist, java.lang.String mbid, java.lang.Boolean autocorrect, java.lang.Integer limit)` Get the similar tracks for this track on Last.fm, based on listening data.
`Streamable` `getStreamable()`
`java.util.List<Tag>` `getTags()`
`java.net.URL` `getUrl()`
`java.lang.Integer` `getUserPlayCount()`
`Wiki` `getWiki()`
`static PostQuery<Scrobble>` `scrobble(java.lang.String artist, java.lang.String track, java.lang.Long startTime, java.lang.String album, java.lang.Integer trackNumber, java.lang.String mbid, java.lang.String albumArtist, java.lang.Long duration, java.lang.String sessionKey)` Used to add a track-play to a user's profile.
`void` `setAlbum(Album album)`
`void` `setAlbums(java.util.List<Album> albums)`
`void` `setArtist(Artist artist)`
`void` `setDate(java.util.Date date)`
`void` `setDuration(java.lang.Long duration)`
`void` `setId(java.lang.Long id)`
`void` `setListeners(java.lang.Integer listeners)`
`void` `setMatch(java.lang.Float match)`
`void` `setMbid(java.lang.String mbid)`
`void` `setName(java.lang.String name)`
`void` `setNowPlaying(java.lang.Boolean nowPlaying)`
`void` `setPlayCount(java.lang.Integer playCount)`
`void` `setRank(java.lang.Integer rank)`
`void` `setStreamable(Streamable streamable)`
`void` `setTags(java.util.List<Tag> tags)`
`void` `setUrl(java.net.URL url)`
`void` `setUserPlayCount(java.lang.Integer userPlayCount)`
`void` `setWiki(Wiki wiki)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Track

    public Track(java.lang.String name)

### Track

    public Track(org.w3c.dom.Element element)

  Create a track from a dom4j element.

  Parameters:
    `element` - The dom4j element to convert.

Method Detail

### getName

    public final java.lang.String getName()

  Specified by:
    `getName` in interface `NameEntity`

### getUrl

    public final java.net.URL getUrl()

  Specified by:
    `getUrl` in interface `UrlEntity`

### getDate

    public final java.util.Date getDate()

  Specified by:
    `getDate` in interface `DateEntity`

### setDate

    public final void setDate(java.util.Date date)

  Specified by:
    `setDate` in interface `DateEntity`

### setName

    public final void setName(java.lang.String name)

  Specified by:
    `setName` in interface `NameEntity`

### setUrl

    public final void setUrl(java.net.URL url)

  Specified by:
    `setUrl` in interface `UrlEntity`

### getListeners

    public final java.lang.Integer getListeners()

  Specified by:
    `getListeners` in interface `ListenersEntity`

### setStreamable

    public final void setStreamable(Streamable streamable)

  Specified by:
    `setStreamable` in interface `StreamableEntity`

### getStreamable

    public final Streamable getStreamable()

  Specified by:
    `getStreamable` in interface `StreamableEntity`

### getMbid

    public final java.lang.String getMbid()

  Specified by:
    `getMbid` in interface `MbidEntity`

### getPlayCount

    public final java.lang.Integer getPlayCount()

  Specified by:
    `getPlayCount` in interface `PlayCountEntity`

### getRank

    public final java.lang.Integer getRank()

  Specified by:
    `getRank` in interface `RankEntity`

### setListeners

    public final void setListeners(java.lang.Integer listeners)

  Specified by:
    `setListeners` in interface `ListenersEntity`

### setMbid

    public final void setMbid(java.lang.String mbid)

  Specified by:
    `setMbid` in interface `MbidEntity`

### setPlayCount

    public final void setPlayCount(java.lang.Integer playCount)

  Specified by:
    `setPlayCount` in interface `PlayCountEntity`

### setRank

    public final void setRank(java.lang.Integer rank)

  Specified by:
    `setRank` in interface `RankEntity`

### getAlbums

    public final java.util.List<Album> getAlbums()

### getAlbum

    public Album getAlbum()

  Specified by:
    `getAlbum` in interface `AlbumEntity`

### setAlbum

    public void setAlbum(Album album)

  Specified by:
    `setAlbum` in interface `AlbumEntity`

### setAlbums

    public final void setAlbums(java.util.List<Album> albums)

### getArtist

    public final Artist getArtist()

  Specified by:
    `getArtist` in interface `ArtistEntity`

### setArtist

    public final void setArtist(Artist artist)

  Specified by:
    `setArtist` in interface `ArtistEntity`

### getMatch

    public final java.lang.Float getMatch()

### setMatch

    public final void setMatch(java.lang.Float match)

### getNowPlaying

    public java.lang.Boolean getNowPlaying()

  Specified by:
    `getNowPlaying` in interface `NowPlayingEntity`

### setNowPlaying

    public void setNowPlaying(java.lang.Boolean nowPlaying)

  Specified by:
    `setNowPlaying` in interface `NowPlayingEntity`

### getDuration

    public final java.lang.Long getDuration()

  Specified by:
    `getDuration` in interface `DurationEntity`

### setDuration

    public final void setDuration(java.lang.Long duration)

  Specified by:
    `setDuration` in interface `DurationEntity`

### getTags

    public final java.util.List<Tag> getTags()

### setTags

    public final void setTags(java.util.List<Tag> tags)

### getWiki

    public final Wiki getWiki()

### setWiki

    public final void setWiki(Wiki wiki)

### getId

    public final java.lang.Long getId()

  Specified by:
    `getId` in interface `IdEntity`

### setId

    public final void setId(java.lang.Long id)

  Specified by:
    `setId` in interface `IdEntity`

### getUserPlayCount

    public final java.lang.Integer getUserPlayCount()

  Specified by:
    `getUserPlayCount` in interface `UserPlayCountEntity`

### setUserPlayCount

    public final void setUserPlayCount(java.lang.Integer userPlayCount)

  Specified by:
    `setUserPlayCount` in interface `UserPlayCountEntity`

### getInfo

    public static UnauthenticatedGetQuery<Track> getInfo(java.lang.String artist,
                                                         java.lang.String track,
                                                         java.lang.String mbid,
                                                         java.lang.String username)

  Get the metadata for a track on Last.fm using the artist/track name or a musicbrainz id. TODO: autocorrect is not supported, implement userloved

  Parameters:
    `artist` - The artist name (Required (unless mbid).
    `track` - The track name (Required (unless mbid).
    `mbid` - The musicbrainz id for the track (Optional).
    `username` - The username for the context of the request (Optional). If supplied, the user's playcount for this track and whether they have loved the track is included in the response.
  Returns:

### getSimilar

    public static UnauthenticatedGetQuery<java.util.ArrayList<Track>> getSimilar(java.lang.String track,
                                                                                 java.lang.String artist,
                                                                                 java.lang.String mbid,
                                                                                 java.lang.Boolean autocorrect,
                                                                                 java.lang.Integer limit)

  Get the similar tracks for this track on Last.fm, based on listening data.

  Parameters:
    `track` - The track name (Optional).
    `artist` - The artist name (Optional).
    `mbid` - The musicbrainz id for the track (Optional).
    `autocorrect` - Transform misspelled artist and track names into correct artist and track names, returning the correct version instead (Optional). The corrected artist and track name will be returned in the response. TODO: currently the corrected originally requested artist/trackname will NOT be returned.
    `limit` - Maximum number of similar tracks to return (Optional).
  Returns:
    TODO: Using ArrayList to avoid complex generics.

### scrobble

    public static PostQuery<Scrobble> scrobble(java.lang.String artist,
                                               java.lang.String track,
                                               java.lang.Long startTime,
                                               java.lang.String album,
                                               java.lang.Integer trackNumber,
                                               java.lang.String mbid,
                                               java.lang.String albumArtist,
                                               java.lang.Long duration,
                                               java.lang.String sessionKey)

  Used to add a track-play to a user's profile.

  Parameters:
    `artist` - The artist name (Required).
    `track` - The track name (Required).
    `startTime` - The time the track started playing in UNIX timestamp format in milliseconds (Required).
    `album` - The album name (Optional).
    `trackNumber` - The track number of the track on the album (Optional).
    `mbid` - The MusicBrainz Track ID (Optional).
    `albumArtist` - The album artist - if this differs from the track artist (Optional).
    `duration` - The length of the track in milliseconds (Optional).
    `sessionKey` - A session key generated by authenticating a user via the authentication protocol.

Copyright © 2013 dontdrinkandroot. All Rights Reserved.