Class: Track

Track

new Track(spotify, entry, idopt)

Create track entry.

Parameters:
Name Type Attributes Description
spotify SpotifyRequestHandler

Spotify request handler.

entry string

The track to search for.

id string <optional>

The Spotify ID, if known.

Source:

Members

album

Album name.

Source:

artist

Track artists, separated by ,.

Source:

artists

Array of track artists.

Source:

entry

Entry string.

Source:

id

Spotify ID.

Source:

lastfm

Last.fm global playcount.

Source:

lastfmGlobal

Last.fm global playcount.

Source:

lastfmPersonal

Last.fm personal playcount.

Source:

mainArtist

Main track artist.

Source:

name

Track name.

Source:

popularity

Spotify popularity.

Source:

spotify

Spotify request handler.

Source:

title

Full track name on the form Title - Artist.

Source:

uri

Spotify URI (a string on the form spotify:track:xxxxxxxxxxxxxxxxxxxxxx).

Source:

Methods

clone(response)

Clone a JSON response.

Parameters:
Name Type Description
response Object

The response.

Source:

dispatch() → {Promise|Track}

Dispatch entry.

Source:
Returns:

Itself.

Type
Promise | Track

equals(track) → {boolean}

Whether this track is equal to another track.

Parameters:
Name Type Description
track Track

The track to compare against.

Source:
Returns:

true if the tracks are equal, false otherwise.

Type
boolean

fetchLastfm() → {Promise|Track}

Fetch Last.fm information.

Source:
Returns:

Itself.

Type
Promise | Track

fetchTrack() → {Promise|Track}

Fetch track metadata.

Source:
Returns:

Itself.

Type
Promise | Track

getPopularity() → {Promise|integer}

Get track popularity.

Source:
Returns:

The track popularity.

Type
Promise | integer

hasArtist(artist) → {boolean}

Whether the track has the given artist.

Parameters:
Name Type Description
artist string

The artist.

Source:
Returns:

true the track has the artist, false otherwise.

Type
boolean

refresh() → {Promise|Track}

Refresh track metadata.

Source:
Returns:

Itself.

Type
Promise | Track

searchForTrack(query) → {Promise|Track}

Search for track.

Parameters:
Name Type Description
query string

The query text.

Source:
Returns:

Itself.

Type
Promise | Track

similarTo(track) → {boolean}

Whether this track is similar to another track.

Parameters:
Name Type Description
track Track

The track to compare against.

Source:
Returns:

true if the tracks are similar, false otherwise.

Type
boolean

toString() → {string}

Full track title.

Source:
Returns:

The track title.

Type
string