SCTC
the soundcloud.com terminal client
Data Structures | Macros | Functions
track.h File Reference

Definitions of the most important structures track and track_list More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  track
 The basic datastructure representing a single track. More...
 
struct  track_list
 

Macros

#define FLAG_PLAYING   1
 this track is currently being played More...
 
#define FLAG_PAUSED   2
 this track is currently pause More...
 
#define FLAG_BOOKMARKED   4
 this track is bookmarked More...
 
#define FLAG_NEW   8
 this track is 'new' More...
 
#define FLAG_CACHED   16
 this track is within the cache More...
 
#define TRACK(LST, ID)   (LST->entries[ID].name ? &LST->entries[ID] : LST->entries[ID].href)
 

Functions

bool track_list_add (struct track_list *list, struct track *track)
 Add a single track to an existing track_list. More...
 
struct track_listtrack_list_merge (struct track_list **lists)
 Merge an array of track_lists. More...
 
void track_list_sort (struct track_list *list)
 Sort a track_list by creation time. More...
 
bool track_list_append (struct track_list *target, struct track_list *source)
 Append a list to another list. More...
 
struct tracktrack_list_get (struct track_list *list, char *permalink)
 Check if list contains a track, identified by its permalink and return it. More...
 
void track_list_destroy (struct track_list *list, bool free_trackdata)
 Free the memory occupied by a track_list. More...
 
bool track_list_del (struct track_list *list, size_t track_id)
 
void track_destroy (struct track *track)
 

Detailed Description

Definitions of the most important structures track and track_list

Macro Definition Documentation

#define FLAG_BOOKMARKED   4

this track is bookmarked

#define FLAG_CACHED   16

this track is within the cache

#define FLAG_NEW   8

this track is 'new'

#define FLAG_PAUSED   2

this track is currently pause

#define FLAG_PLAYING   1

this track is currently being played

#define TRACK (   LST,
  ID 
)    (LST->entries[ID].name ? &LST->entries[ID] : LST->entries[ID].href)

Function Documentation

void track_destroy ( struct track track)

Here is the caller graph for this function:

bool track_list_add ( struct track_list list,
struct track track 
)

Add a single track to an existing track_list.

Parameters
listThe list receiving the new track
trackThe track, which will be added to list

Here is the caller graph for this function:

bool track_list_append ( struct track_list target,
struct track_list source 
)

Append a list to another list.

Todo:
remove in favour of track_list_merge()

Here is the caller graph for this function:

bool track_list_del ( struct track_list list,
size_t  track_id 
)

Here is the caller graph for this function:

void track_list_destroy ( struct track_list list,
bool  free_trackdata 
)

Free the memory occupied by a track_list.

Do not use the list after calling this function. Do not use any of the tracks within the list if free_trackdata is set to true.

Parameters
listthe list to free
free_trackdataif true every single track within the list will be freed too

Here is the call graph for this function:

Here is the caller graph for this function:

struct track* track_list_get ( struct track_list list,
char *  permalink 
)

Check if list contains a track, identified by its permalink and return it.

Parameters
listThe list to search in
permalinkThe permalink to use for searching
Returns
The track, if found, NULL otherwise

Here is the caller graph for this function:

struct track_list* track_list_merge ( struct track_list **  lists)

Merge an array of track_lists.

The resulting list is not sorted, entries from all lists are simply concatinated. Both input lists are not modified, call track_list_destroy() if they are no longer needed. The struct tracks within the list are duplicated, the struct tracks' members are not - set free_trackdata to false!

Parameters
listsA NULL-terminated array containing the track_lists to be merged into one
Returns
a new list containing all tracks all lists

Here is the caller graph for this function:

void track_list_sort ( struct track_list list)

Sort a track_list by creation time.

Parameters
listThe list to be sorted

Here is the call graph for this function:

Here is the caller graph for this function: