XMMS2
Functions
Collection
XMMSServer

This is the collection manager. More...

Functions

xmms_coll_dag_txmms_collection_init (xmms_playlist_t *playlist)
 Initializes a new xmms_coll_dag_t.
void xmms_collection_sync (xmms_coll_dag_t *dag)
 Synchronize collection data to the database (i.e.
GList * xmms_collection_query_ids (xmms_coll_dag_t *dag, xmmsv_coll_t *coll, gint32 lim_start, gint32 lim_len, xmmsv_t *order, xmms_error_t *err)
 Find the ids of the media matched by a collection.
void xmms_collection_update_pointer (xmms_coll_dag_t *dag, const gchar *name, guint nsid, xmmsv_coll_t *newtarget)
 Update a reference to point to a new collection.
void xmms_collection_dag_replace (xmms_coll_dag_t *dag, xmms_collection_namespace_id_t nsid, gchar *key, xmmsv_coll_t *newcoll)
 Update the DAG to update the value of the pair with the given key.
xmmsv_coll_txmms_collection_get_pointer (xmms_coll_dag_t *dag, const gchar *collname, guint nsid)
 Find the collection structure corresponding to the given name in the given namespace.
gboolean xmms_collection_get_int_attr (xmmsv_coll_t *coll, const gchar *attrname, gint *val)
 Extract an attribute from a collection as an integer.
gboolean xmms_collection_set_int_attr (xmmsv_coll_t *coll, const gchar *attrname, gint newval)
 Set the attribute of a collection as an integer.
const gchar * xmms_collection_find_alias (xmms_coll_dag_t *dag, guint nsid, xmmsv_coll_t *value, const gchar *key)
 Reverse-search the list of collections in the given namespace to find the first pair whose value matches the argument.
xmms_medialib_entry_t xmms_collection_get_random_media (xmms_coll_dag_t *dag, xmmsv_coll_t *source)
 Get a random media entry from the given collection.

Detailed Description

This is the collection manager.

The set of collections is stored as a DAG of collection operators. Each collection namespace contains a list of saved collections, with a pointer to the node in the graph.


Function Documentation

void xmms_collection_dag_replace ( xmms_coll_dag_t dag,
xmms_collection_namespace_id_t  nsid,
gchar *  key,
xmmsv_coll_t newcoll 
)

Update the DAG to update the value of the pair with the given key.

Definition at line 858 of file collection.c.

Referenced by xmms_collection_dag_restore(), and xmms_collection_update_pointer().

const gchar* xmms_collection_find_alias ( xmms_coll_dag_t dag,
guint  nsid,
xmmsv_coll_t value,
const gchar *  key 
)

Reverse-search the list of collections in the given namespace to find the first pair whose value matches the argument.

If key is not NULL, any pair with the same key will be ignored.

Parameters:
dagThe collection DAG.
nsidThe id of the namespace to consider.
valueThe value of the pair to find.
keyIf not NULL, ignore any pair with that key.
Returns:
The key of the found pair.

Definition at line 955 of file collection.c.

gboolean xmms_collection_get_int_attr ( xmmsv_coll_t coll,
const gchar *  attrname,
gint *  val 
)

Extract an attribute from a collection as an integer.

Parameters:
collThe collection to extract the attribute from.
attrnameThe name of the attribute.
valThe integer value of the attribute will be saved in this pointer.
Returns:
TRUE if attribute correctly read, FALSE otherwise

Definition at line 898 of file collection.c.

xmmsv_coll_t* xmms_collection_get_pointer ( xmms_coll_dag_t dag,
const gchar *  collname,
guint  nsid 
)

Find the collection structure corresponding to the given name in the given namespace.

Parameters:
dagThe collection DAG.
collnameThe name of the collection to find.
nsidThe namespace id.
Returns:
The collection structure if found, NULL otherwise.

Definition at line 873 of file collection.c.

Referenced by bind_all_references().

Get a random media entry from the given collection.

Parameters:
dagThe collection DAG.  
sourceThe collection to query.
Returns:
A random media from the source collection, or 0 if none found.

Definition at line 978 of file collection.c.

Initializes a new xmms_coll_dag_t.

Returns:
The newly allocated collection DAG.

Definition at line 214 of file collection.c.

Referenced by xmms_playlist_init().

GList* xmms_collection_query_ids ( xmms_coll_dag_t dag,
xmmsv_coll_t coll,
gint32  lim_start,
gint32  lim_len,
xmmsv_t order,
xmms_error_t err 
)

Find the ids of the media matched by a collection.

Parameters:
dagThe collection DAG.
collThe collection used to match media.
lim_startThe beginning index of the LIMIT statement (0 to disable).
lim_lenThe number of entries of the LIMIT statement (0 to disable).
orderThe list of properties to order by (empty to disable).
errIf an error occurs, a message is stored in it.
Returns:
A list of media ids.

Definition at line 731 of file collection.c.

Referenced by xmms_collection_get_random_media().

gboolean xmms_collection_set_int_attr ( xmmsv_coll_t coll,
const gchar *  attrname,
gint  newval 
)

Set the attribute of a collection as an integer.

Parameters:
collThe collection in which to set the attribute.
attrnameThe name of the attribute.
newvalThe new value of the attribute.
Returns:
TRUE if attribute successfully saved, FALSE otherwise.

Definition at line 926 of file collection.c.

Referenced by xmms_playlist_current_entry(), and xmms_playlist_insert_entry().

Synchronize collection data to the database (i.e.

to disk).

Parameters:
dagThe collection DAG.
errIf an error occurs, a message is stored in it.

Definition at line 539 of file collection.c.

void xmms_collection_update_pointer ( xmms_coll_dag_t dag,
const gchar *  name,
guint  nsid,
xmmsv_coll_t newtarget 
)

Update a reference to point to a new collection.

Parameters:
dagThe collection DAG.
nameThe name of the reference to update.
nsidThe namespace in which to locate the reference.
newtargetThe new collection pointed to by the reference.

Definition at line 849 of file collection.c.