Track subsystem


Functions

bool sp_track_is_loaded (sp_track *track)
sp_error sp_track_error (sp_track *track)
bool sp_track_is_available (sp_session *session, sp_track *track)
bool sp_track_is_local (sp_session *session, sp_track *track)
bool sp_track_is_autolinked (sp_session *session, sp_track *track)
bool sp_track_is_starred (sp_session *session, sp_track *track)
void sp_track_set_starred (sp_session *session, const sp_track **tracks, int num_tracks, bool star)
int sp_track_num_artists (sp_track *track)
sp_artistsp_track_artist (sp_track *track, int index)
sp_albumsp_track_album (sp_track *track)
const char * sp_track_name (sp_track *track)
int sp_track_duration (sp_track *track)
int sp_track_popularity (sp_track *track)
int sp_track_disc (sp_track *track)
int sp_track_index (sp_track *track)
sp_tracksp_localtrack_create (const char *artist, const char *title, const char *album, int length)
void sp_track_add_ref (sp_track *track)
void sp_track_release (sp_track *track)

Function Documentation

sp_track* sp_localtrack_create ( const char *  artist,
const char *  title,
const char *  album,
int  length 
)

Returns the newly created local track

Parameters:
[in] artist Name of the artist
[in] title Song title
[in] album Name of the album, or an empty string if not available
[in] title Length in MS, or -1 if not available.
Returns:
A track.

void sp_track_add_ref ( sp_track track  ) 

Increase the reference count of a track

Parameters:
[in] track The track object

sp_album* sp_track_album ( sp_track track  ) 

The album of the specified track

Parameters:
[in] track A track object
Returns:
The album of the given track. You need to increase the refcount if you want to keep the pointer around. If no metadata is available for the track yet, this function returns 0.

sp_artist* sp_track_artist ( sp_track track,
int  index 
)

The artist matching the specified index performing on the current track.

Parameters:
[in] track The track whose participating artist you are interested in
[in] index The index for the participating artist. Should be in the interval [0, sp_track_num_artists() - 1]
Returns:
The participating artist, or NULL if invalid index

int sp_track_disc ( sp_track track  ) 

Returns the disc number for a track

Parameters:
[in] track A track object
Returns:
Disc index. Possible values are [1, total number of discs on album] This function returns valid data only for tracks appearing in a browse artist or browse album result (otherwise returns 0).

int sp_track_duration ( sp_track track  ) 

The duration, in milliseconds, of the specified track

Parameters:
[in] track A track object
Returns:
The duration of the specified track, in milliseconds If no metadata is available for the track yet, this function returns 0.

sp_error sp_track_error ( sp_track track  ) 

Return an error code associated with a track. For example if it could not load

Parameters:
[in] track The track
Returns:
Error code

int sp_track_index ( sp_track track  ) 

Returns the position of a track on its disc

Parameters:
[in] track A track object
Returns:
Track position, starts at 1 (relative the corresponding disc) This function returns valid data only for tracks appearing in a browse artist or browse album result (otherwise returns 0).

bool sp_track_is_autolinked ( sp_session session,
sp_track track 
)

Return true if the track is autolinked to another track.

Parameters:
[in] session Session
[in] track The track
Returns:
True if track is autolinked.
Note:
The track must be loaded or this function will always return false.
See also:
sp_track_is_loaded()

bool sp_track_is_available ( sp_session session,
sp_track track 
)

Return true if the track is available for playback.

Parameters:
[in] session Session
[in] track The track
Returns:
True if track is available for playback, otherwise false.
Note:
The track must be loaded or this function will always return false.
See also:
sp_track_is_loaded()

bool sp_track_is_loaded ( sp_track track  ) 

Get load status for the specified track. If the track is not loaded yet, all other functions operating on the track return default values.

Parameters:
[in] track The track whose load status you are interested in
Returns:
True if track is loaded, otherwise false

bool sp_track_is_local ( sp_session session,
sp_track track 
)

Return true if the track is a local file.

Parameters:
[in] session Session
[in] track The track
Returns:
True if track is a local file.
Note:
The track must be loaded or this function will always return false.
See also:
sp_track_is_loaded()

bool sp_track_is_starred ( sp_session session,
sp_track track 
)

Return true if the track is starred by the currently logged in user.

Parameters:
[in] session Session
[in] track The track
Returns:
True if track is starred.
Note:
The track must be loaded or this function will always return false.
See also:
sp_track_is_loaded()

const char* sp_track_name ( sp_track track  ) 

The string representation of the specified track's name

Parameters:
[in] track A track object
Returns:
The string representation of the specified track's name. Returned string is valid as long as the album object stays allocated and no longer than the next call to sp_session_process_events() If no metadata is available for the track yet, this function returns empty string.

int sp_track_num_artists ( sp_track track  ) 

The number of artists performing on the specified track

Parameters:
[in] track The track whose number of participating artists you are interested in
Returns:
The number of artists performing on the specified track. If no metadata is available for the track yet, this function returns 0.

int sp_track_popularity ( sp_track track  ) 

Returns popularity for track

Parameters:
[in] track A track object
Returns:
Popularity in range 0 to 100, 0 if undefined If no metadata is available for the track yet, this function returns 0.

void sp_track_release ( sp_track track  ) 

Decrease the reference count of a track

Parameters:
[in] track The track object

void sp_track_set_starred ( sp_session session,
const sp_track **  tracks,
int  num_tracks,
bool  star 
)

Star/Unstar the specified track

Parameters:
[in] session Session
[in] tracks Array of pointer to tracks.
[in] num_tracks Length of tracks array
[in] star Starred status of the track
Note:
This will fail silently if playlists are disabled.
See also:
sp_set_playlists_enabled()


Generated on Wed Nov 3 12:46:14 2010.
Copyright © 2006–2009 Spotify Ltd