Enumerations | |
enum | sp_linktype { SP_LINKTYPE_INVALID = 0, SP_LINKTYPE_TRACK = 1, SP_LINKTYPE_ALBUM = 2, SP_LINKTYPE_ARTIST = 3, SP_LINKTYPE_SEARCH = 4, SP_LINKTYPE_PLAYLIST = 5 } |
Functions | |
sp_link * | sp_link_create_from_string (const char *link) |
sp_link * | sp_link_create_from_track (sp_track *track, int offset) |
sp_link * | sp_link_create_from_album (sp_album *album) |
sp_link * | sp_link_create_from_artist (sp_artist *artist) |
sp_link * | sp_link_create_from_search (sp_search *search) |
sp_link * | sp_link_create_from_playlist (sp_playlist *playlist) |
int | sp_link_as_string (sp_link *link, char *buffer, int buffer_size) |
sp_linktype | sp_link_type (sp_link *link) |
sp_track * | sp_link_as_track (sp_link *link) |
sp_album * | sp_link_as_album (sp_link *link) |
sp_artist * | sp_link_as_artist (sp_link *link) |
void | sp_link_add_ref (sp_link *link) |
void | sp_link_release (sp_link *link) |
enum sp_linktype |
Link types
void sp_link_add_ref | ( | sp_link * | link | ) |
Increase the reference count of a link
[in] | link | The link object |
The album representation for the given link
[in] | link | The Spotify link whose album you are interested in |
The artist representation for the given link
[in] | link | The Spotify link whose artist you are interested in |
int sp_link_as_string | ( | sp_link * | link, | |
char * | buffer, | |||
int | buffer_size | |||
) |
Create a string representation of the given Spotify link
Here is a snippet from link.c:
static void print_link(sp_link *link) { char spotify_uri[256]; if (0 > sp_link_as_string(link, spotify_uri, sizeof(spotify_uri))) { fprintf(stderr, "failed to render Spotify URI from link\n"); g_exit_code = 8; return; } printf("%s link %s\n", get_link_type_label(link), spotify_uri); } static void try_links(sp_session *session) { const char SPOTIFY_URI[] = "spotify:track:6JEK0CvvjDjjMUBFoXShNZ"; sp_link *link = sp_link_create_from_string(SPOTIFY_URI); if (!link) { fprintf(stderr, "failed to get link from a Spotify URI\n"); g_exit_code = 6; return; }
[in] | link | The Spotify link whose string representation you are interested in |
[out] | buffer | The buffer to hold the string representation of link |
[in] | buffer_size | The max size of the buffer that will hold the string representation The resulting string is guaranteed to always be null terminated if buffer_size > 0 |
buffer_size
, output was truncated. The track representation for the given link
[in] | link | The Spotify link whose track you are interested in |
Create a link object from an album
[in] | album | An album object |
Creates a link object from an artist
[in] | artist | An artist object |
sp_link* sp_link_create_from_playlist | ( | sp_playlist * | playlist | ) |
Create a link object representing the given playlist
[in] | playlist | Playlist object |
Generate a link object representing the current search
[in] | search | Search object |
sp_link* sp_link_create_from_string | ( | const char * | link | ) |
Create a Spotify link given a string
Here is a snippet from link.c:
sp_link *link = sp_link_create_from_string(SPOTIFY_URI); if (!link) { fprintf(stderr, "failed to get link from a Spotify URI\n"); g_exit_code = 6; return; } print_link(link); // The create function will have increased the reference count for us. sp_link_release(link);
[in] | link | A string representation of a Spotify link |
Generates a link object from a track
[in] | track | A track object |
[in] | offset | Offset in track in ms. |
void sp_link_release | ( | sp_link * | link | ) |
sp_linktype sp_link_type | ( | sp_link * | link | ) |
The link type of the specified link
Here is a snippet from link.c:
static const char* get_link_type_label(sp_link *link) { static const char *LINK_TYPES[] = { "invalid", "track", "album", "artist", "search", "playlist" }; return LINK_TYPES[sp_link_type(link)]; }
[in] | link | The Spotify link whose type you are interested in |