XmmsClient
Modules | Functions

All modules related to collection handling. More...

Modules

 CollectionControl
 Functions to manage the collections on the server.
 
 CollectionParser
 Generate a collection structure from a string pattern.
 

Functions

xmmsv_txmmsv_new_coll (xmmsv_coll_type_t type)
 Allocates a new collection xmmsv_t of the given type. More...
 
xmmsv_txmmsv_coll_new (xmmsv_coll_type_t type)
 
xmmsv_txmmsv_coll_ref (xmmsv_t *coll)
 Increases the references for the xmmsv_t. More...
 
void xmmsv_coll_unref (xmmsv_t *coll)
 Decreases the references for the xmmsv_t When the number of references reaches 0 it will be freed and all its operands unreferenced as well. More...
 
void _xmmsv_coll_free (xmmsv_coll_internal_t *coll)
 Free the memory owned by the collection. More...
 
void xmmsv_coll_set_idlist (xmmsv_t *coll, int ids[])
 Set the list of ids in the given collection. More...
 
void xmmsv_coll_add_operand (xmmsv_t *coll, xmmsv_t *op)
 Add the operand to the given collection. More...
 
void xmmsv_coll_remove_operand (xmmsv_t *coll, xmmsv_t *op)
 Remove all the occurences of the operand in the given collection. More...
 
int xmmsv_coll_idlist_append (xmmsv_t *coll, int64_t id)
 Append a value to the idlist. More...
 
int xmmsv_coll_idlist_insert (xmmsv_t *coll, int index, int64_t id)
 Insert a value at a given position in the idlist. More...
 
int xmmsv_coll_idlist_move (xmmsv_t *coll, int index, int newindex)
 Move a value of the idlist to a new position. More...
 
int xmmsv_coll_idlist_remove (xmmsv_t *coll, int index)
 Remove the value at a given index from the idlist. More...
 
int xmmsv_coll_idlist_clear (xmmsv_t *coll)
 Empties the idlist. More...
 
int xmmsv_coll_idlist_get_index_int32 (xmmsv_t *coll, int index, int32_t *val)
 Retrieves the value at the given position in the idlist. More...
 
int xmmsv_coll_idlist_get_index_int64 (xmmsv_t *coll, int index, int64_t *val)
 Retrieves the value at the given position in the idlist. More...
 
int xmmsv_coll_idlist_set_index (xmmsv_t *coll, int index, int64_t val)
 Sets the value at the given position in the idlist. More...
 
int xmmsv_coll_idlist_get_size (xmmsv_t *coll)
 Get the size of the idlist. More...
 
int xmmsv_coll_is_type (xmmsv_t *val, xmmsv_coll_type_t t)
 Check if collection is of specified type. More...
 
xmmsv_coll_type_t xmmsv_coll_get_type (xmmsv_t *coll)
 Return the type of the collection. More...
 
xmmsv_txmmsv_coll_idlist_get (xmmsv_t *coll)
 Return the list of ids stored in the collection. More...
 
void xmmsv_coll_idlist_set (xmmsv_t *coll, xmmsv_t *idlist)
 Replace the idlist in the given collection. More...
 
xmmsv_txmmsv_coll_operands_get (xmmsv_t *coll)
 
void xmmsv_coll_operands_set (xmmsv_t *coll, xmmsv_t *operands)
 Replace all operands in the given collection. More...
 
xmmsv_txmmsv_coll_attributes_get (xmmsv_t *coll)
 
void xmmsv_coll_attributes_set (xmmsv_t *coll, xmmsv_t *attributes)
 Replace all attributes in the given collection. More...
 
void xmmsv_coll_attribute_set (xmmsv_t *coll, const char *key, const char *value)
 Set a string attribute in the given collection. More...
 
void xmmsv_coll_attribute_set_string (xmmsv_t *coll, const char *key, const char *value)
 Set a string attribute in the given collection. More...
 
void xmmsv_coll_attribute_set_int (xmmsv_t *coll, const char *key, int64_t value)
 Set an integer attribute in the given collection. More...
 
void xmmsv_coll_attribute_set_value (xmmsv_t *coll, const char *key, xmmsv_t *value)
 Set an attribute in the given collection. More...
 
int xmmsv_coll_attribute_remove (xmmsv_t *coll, const char *key)
 Remove an attribute from the given collection. More...
 
int xmmsv_coll_attribute_get (xmmsv_t *coll, const char *key, const char **value)
 Retrieve a string attribute from the given collection. More...
 
int xmmsv_coll_attribute_get_string (xmmsv_t *coll, const char *key, const char **value)
 Retrieve a string attribute from the given collection. More...
 
int xmmsv_coll_attribute_get_int32 (xmmsv_t *coll, const char *key, int32_t *val)
 Retrieve an integer attribute from the given collection. More...
 
int xmmsv_coll_attribute_get_int64 (xmmsv_t *coll, const char *key, int64_t *value)
 Retrieve an integer attribute from the given collection. More...
 
int xmmsv_coll_attribute_get_value (xmmsv_t *coll, const char *key, xmmsv_t **value)
 Retrieve an attribute from the given collection. More...
 
xmmsv_txmmsv_coll_universe ()
 Return a collection referencing the whole media library. More...
 
xmmsv_txmmsv_coll_add_order_operator (xmmsv_t *coll, xmmsv_t *value)
 Return a collection with an order-operator added. More...
 
xmmsv_txmmsv_coll_add_order_operators (xmmsv_t *coll, xmmsv_t *order)
 Return a collection with several order-operators added. More...
 
xmmsv_txmmsv_coll_add_limit_operator (xmmsv_t *coll, int lim_start, int lim_len)
 Returns a collection with a LIMIT operator added. More...
 

Detailed Description

All modules related to collection handling.

The API to be used to work with collection structures.

The API to use collections ; please refer to the wiki for more infos on this.

Function Documentation

void _xmmsv_coll_free ( xmmsv_coll_internal_t *  coll)

Free the memory owned by the collection.

You probably want to use xmmsv_coll_unref instead, which handles reference counting.

Parameters
collthe collection to free.

Referenced by xmmsv_new_coll().

xmmsv_t* xmmsv_coll_add_limit_operator ( xmmsv_t coll,
int  lim_start,
int  lim_len 
)

Returns a collection with a LIMIT operator added.

Parameters
collThe collection to add the limit operator to
lim_startThe index of the first element to include, or 0 to disable
lim_lenThe length of the interval, or 0 to disable
Returns
A new collection with LIMIT operator added

Referenced by xmmsc_coll_query_ids().

void xmmsv_coll_add_operand ( xmmsv_t coll,
xmmsv_t op 
)

Add the operand to the given collection.

Parameters
collThe collection to add the operand to.
opThe operand to add.

Referenced by xmmsc_playlist_shuffle(), xmmsv_coll_add_limit_operator(), and xmmsv_coll_add_order_operator().

xmmsv_t* xmmsv_coll_add_order_operator ( xmmsv_t coll,
xmmsv_t value 
)

Return a collection with an order-operator added.

Parameters
collthe original collection
valuean ordering string, optionally starting with "-" (for descending ordering), followed by a string "id", "random" or a key identifying a property, such as "artist" or "album". Or it can be a dict containing the attributes to set.
Returns
coll with order-operators added

Referenced by xmmsv_coll_add_order_operators().

xmmsv_t* xmmsv_coll_add_order_operators ( xmmsv_t coll,
xmmsv_t order 
)

Return a collection with several order-operators added.

Parameters
collthe original collection
orderlist of ordering strings or dicts.
Returns
coll with order-operators added

Referenced by xmmsc_coll_query_ids(), xmmsc_coll_query_infos(), xmmsc_playlist_add_collection(), xmmsc_playlist_insert_collection(), and xmmsc_playlist_sort().

int xmmsv_coll_attribute_get ( xmmsv_t coll,
const char *  key,
const char **  value 
)

Retrieve a string attribute from the given collection.

Parameters
collThe collection to retrieve the attribute from.
keyThe name of the attribute.
valueThe value of the attribute if found (owned by the collection).
Returns
1 if the attribute was found, 0 otherwise
int xmmsv_coll_attribute_get_int32 ( xmmsv_t coll,
const char *  key,
int32_t *  val 
)

Retrieve an integer attribute from the given collection.

Parameters
collThe collection to retrieve the attribute from.
keyThe name of the attribute.
valueThe value of the attribute if found (owned by the collection).
Returns
1 if the attribute was found, 0 otherwise
int xmmsv_coll_attribute_get_int64 ( xmmsv_t coll,
const char *  key,
int64_t *  value 
)

Retrieve an integer attribute from the given collection.

Parameters
collThe collection to retrieve the attribute from.
keyThe name of the attribute.
valueThe value of the attribute if found (owned by the collection).
Returns
1 if the attribute was found, 0 otherwise
int xmmsv_coll_attribute_get_string ( xmmsv_t coll,
const char *  key,
const char **  value 
)

Retrieve a string attribute from the given collection.

Parameters
collThe collection to retrieve the attribute from.
keyThe name of the attribute.
valueThe value of the attribute if found (owned by the collection).
Returns
1 if the attribute was found, 0 otherwise

Referenced by xmmsv_coll_attribute_get().

int xmmsv_coll_attribute_get_value ( xmmsv_t coll,
const char *  key,
xmmsv_t **  value 
)

Retrieve an attribute from the given collection.

Parameters
collThe collection to retrieve the attribute from.
keyThe name of the attribute.
valueThe value of the attribute if found (owned by the collection).
Returns
1 if the attribute was found, 0 otherwise
int xmmsv_coll_attribute_remove ( xmmsv_t coll,
const char *  key 
)

Remove an attribute from the given collection.

The return value indicated whether the attribute was found (and removed)

Parameters
collThe collection to remove the attribute from.
keyThe name of the attribute to remove.
Returns
1 upon success, 0 otherwise
void xmmsv_coll_attribute_set ( xmmsv_t coll,
const char *  key,
const char *  value 
)

Set a string attribute in the given collection.

Parameters
collThe collection in which to set the attribute.
keyThe name of the attribute to set.
valueThe value of the attribute.
void xmmsv_coll_attribute_set_int ( xmmsv_t coll,
const char *  key,
int64_t  value 
)

Set an integer attribute in the given collection.

Parameters
collThe collection in which to set the attribute.
keyThe name of the attribute to set.
valueThe value of the attribute.
void xmmsv_coll_attribute_set_string ( xmmsv_t coll,
const char *  key,
const char *  value 
)

Set a string attribute in the given collection.

Parameters
collThe collection in which to set the attribute.
keyThe name of the attribute to set.
valueThe value of the attribute.

Referenced by xmmsc_playlist_create(), xmmsc_playlist_shuffle(), xmmsc_playlist_sort(), xmmsv_coll_add_limit_operator(), and xmmsv_coll_attribute_set().

void xmmsv_coll_attribute_set_value ( xmmsv_t coll,
const char *  key,
xmmsv_t value 
)

Set an attribute in the given collection.

Parameters
collThe collection in which to set the attribute.
keyThe name of the attribute to set.
valueThe value of the attribute.
xmmsv_t* xmmsv_coll_attributes_get ( xmmsv_t coll)
void xmmsv_coll_attributes_set ( xmmsv_t coll,
xmmsv_t attributes 
)

Replace all attributes in the given collection.

Parameters
collThe collection in which to set the attribute.
attributesThe new attributes.

Referenced by xmmsv_coll_add_order_operator().

xmmsv_coll_type_t xmmsv_coll_get_type ( xmmsv_t coll)

Return the type of the collection.

Parameters
collThe collection to consider.
Returns
The xmmsv_coll_type_t of the collection, or -1 if invalid.

Referenced by xmmsv_coll_is_type().

int xmmsv_coll_idlist_append ( xmmsv_t coll,
int64_t  id 
)

Append a value to the idlist.

Parameters
collThe collection to update.  
idThe id to append to the idlist.
Returns
TRUE on success, false otherwise.

Referenced by xmmsc_playlist_add_id(), and xmmsc_playlist_insert_id().

int xmmsv_coll_idlist_clear ( xmmsv_t coll)

Empties the idlist.

Parameters
collThe collection to update.
Returns
TRUE on success, false otherwise.
xmmsv_t* xmmsv_coll_idlist_get ( xmmsv_t coll)

Return the list of ids stored in the collection.

This function does not increase the refcount of the list, the reference is still owned by the collection.

Note that this must not be confused with the content of the collection, which must be queried using xmmsc_coll_query_ids!

Parameters
collThe collection to consider.
Returns
The 0-terminated list of ids.
int xmmsv_coll_idlist_get_index_int32 ( xmmsv_t coll,
int  index,
int32_t *  val 
)

Retrieves the value at the given position in the idlist.

Parameters
collThe collection to update.
indexThe position of the value to retrieve.
valThe pointer at which to store the found value.
Returns
TRUE on success, false otherwise.
int xmmsv_coll_idlist_get_index_int64 ( xmmsv_t coll,
int  index,
int64_t *  val 
)

Retrieves the value at the given position in the idlist.

Parameters
collThe collection to update.
indexThe position of the value to retrieve.
valThe pointer at which to store the found value.
Returns
TRUE on success, false otherwise.
int xmmsv_coll_idlist_get_size ( xmmsv_t coll)

Get the size of the idlist.

Parameters
collThe collection to update.
Returns
The size of the idlist.
int xmmsv_coll_idlist_insert ( xmmsv_t coll,
int  index,
int64_t  id 
)

Insert a value at a given position in the idlist.

Parameters
collThe collection to update.  
idThe id to insert in the idlist.  
indexThe position at which to insert the value.
Returns
TRUE on success, false otherwise.
int xmmsv_coll_idlist_move ( xmmsv_t coll,
int  index,
int  newindex 
)

Move a value of the idlist to a new position.

Parameters
collThe collection to update.
indexThe index of the value to move.
newindexThe newindex to which to move the value.
Returns
TRUE on success, false otherwise.
int xmmsv_coll_idlist_remove ( xmmsv_t coll,
int  index 
)

Remove the value at a given index from the idlist.

Parameters
collThe collection to update.
indexThe index at which to remove the value.
Returns
TRUE on success, false otherwise.
void xmmsv_coll_idlist_set ( xmmsv_t coll,
xmmsv_t idlist 
)

Replace the idlist in the given collection.

Parameters
collThe collection in which to set the idlist.
operandsThe new idlist.
int xmmsv_coll_idlist_set_index ( xmmsv_t coll,
int  index,
int64_t  val 
)

Sets the value at the given position in the idlist.

Parameters
collThe collection to update.
indexThe position of the value to set.
valThe new value.
Returns
TRUE on success, false otherwise.
int xmmsv_coll_is_type ( xmmsv_t val,
xmmsv_coll_type_t  t 
)

Check if collection is of specified type.

Parameters
valxmmsv_t to check.
txmmsv_coll_type_t to check for.
Returns
1 if value is of specified type, 0 otherwise.
xmmsv_t* xmmsv_coll_new ( xmmsv_coll_type_t  type)
xmmsv_t* xmmsv_coll_operands_get ( xmmsv_t coll)
void xmmsv_coll_operands_set ( xmmsv_t coll,
xmmsv_t operands 
)

Replace all operands in the given collection.

Parameters
collThe collection in which to set the operands.
operandsThe new operands.
xmmsv_t* xmmsv_coll_ref ( xmmsv_t coll)

Increases the references for the xmmsv_t.

Deprecated:
Use xmmsv_ref instead.
Parameters
collthe collection to reference.
Returns
coll
void xmmsv_coll_remove_operand ( xmmsv_t coll,
xmmsv_t op 
)

Remove all the occurences of the operand in the given collection.

Parameters
collThe collection to remove the operand from.
opThe operand to remove.
void xmmsv_coll_set_idlist ( xmmsv_t coll,
int  ids[] 
)

Set the list of ids in the given collection.

The list must be 0-terminated. Note that the idlist is only relevant for idlist collections.

Parameters
collthe collection to modify.
idsthe 0-terminated list of ids to store in the collection.
xmmsv_t* xmmsv_coll_universe ( void  )

Return a collection referencing the whole media library.

The returned structure must be unref'd using xmmsv_coll_unref after usage.

Returns
a collection containing all media.
void xmmsv_coll_unref ( xmmsv_t coll)

Decreases the references for the xmmsv_t When the number of references reaches 0 it will be freed and all its operands unreferenced as well.

Deprecated:
Use xmmsv_unref instead.
Parameters
collthe collection to unref.
xmmsv_t* xmmsv_new_coll ( xmmsv_coll_type_t  type)

Allocates a new collection xmmsv_t of the given type.

Parameters
typethe xmmsv_coll_type_t specifying the type of collection to create.
Returns
The new xmmsv_t. Must be unreferenced with xmmsv_unref.

Referenced by xmmsc_playlist_add_id(), xmmsc_playlist_clear(), xmmsc_playlist_create(), xmmsc_playlist_insert_id(), xmmsc_playlist_shuffle(), xmmsc_playlist_sort(), xmmsv_coll_add_limit_operator(), xmmsv_coll_add_order_operator(), xmmsv_coll_new(), and xmmsv_coll_universe().