This is the collection manager. More...
Functions | |
xmms_coll_dag_t * | xmms_collection_init (xmms_playlist_t *playlist) |
Initializes a new xmms_coll_dag_t. | |
gboolean | xmms_collection_remove (xmms_coll_dag_t *dag, const gchar *name, const gchar *namespace, xmms_error_t *err) |
Remove the given collection from the DAG. | |
gboolean | xmms_collection_save (xmms_coll_dag_t *dag, const gchar *name, const gchar *namespace, xmmsv_coll_t *coll, xmms_error_t *err) |
Save the given collection in the DAG under the given name in the given namespace. | |
xmmsv_coll_t * | xmms_collection_get (xmms_coll_dag_t *dag, const gchar *name, const gchar *namespace, xmms_error_t *err) |
Retrieve the structure of a given collection. | |
void | xmms_collection_sync (xmms_coll_dag_t *dag, xmms_error_t *err) |
Synchronize collection data to the database (i.e. | |
GList * | xmms_collection_list (xmms_coll_dag_t *dag, const gchar *namespace, xmms_error_t *err) |
Lists the collections in the given namespace. | |
GList * | xmms_collection_find (xmms_coll_dag_t *dag, guint mid, const gchar *namespace, xmms_error_t *err) |
Find all collections in the given namespace that contain a given media. | |
gboolean | xmms_collection_rename (xmms_coll_dag_t *dag, const gchar *from_name, const gchar *to_name, const gchar *namespace, xmms_error_t *err) |
Rename a collection in a given namespace. | |
GList * | xmms_collection_query_ids (xmms_coll_dag_t *dag, xmmsv_coll_t *coll, guint lim_start, guint lim_len, xmmsv_t *order, xmms_error_t *err) |
Find the ids of the media matched by a collection. | |
GList * | xmms_collection_query_infos (xmms_coll_dag_t *dag, xmmsv_coll_t *coll, guint lim_start, guint lim_len, xmmsv_t *order, xmmsv_t *fetch, xmmsv_t *group, xmms_error_t *err) |
Find the properties 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_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. | |
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. |
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.
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 888 of file collection.c.
Referenced by xmms_collection_dag_restore(), xmms_collection_rename(), xmms_collection_save(), and xmms_collection_update_pointer().
GList* xmms_collection_find | ( | xmms_coll_dag_t * | dag, | |
guint | mid, | |||
const gchar * | namespace, | |||
xmms_error_t * | err | |||
) |
Find all collections in the given namespace that contain a given media.
dag | The collection DAG. | |
mid | The id of the media. | |
namespace | The namespace in which to look for collections. | |
err | If an error occurs, a message is stored in it. |
Definition at line 637 of file collection.c.
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.
dag | The collection DAG. | |
nsid | The id of the namespace to consider. | |
value | The value of the pair to find. | |
key | If not NULL, ignore any pair with that key. |
Definition at line 985 of file collection.c.
Referenced by xmms_collection_save().
xmmsv_coll_t* xmms_collection_get | ( | xmms_coll_dag_t * | dag, | |
const gchar * | name, | |||
const gchar * | namespace, | |||
xmms_error_t * | err | |||
) |
Retrieve the structure of a given collection.
If looking in ALL namespaces, only the collection first found is returned!
dag | The collection DAG. | |
name | The name of the collection to retrieve. | |
namespace | The namespace in which to look for the collection. | |
err | If an error occurs, a message is stored in it. |
Definition at line 546 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.
coll | The collection to extract the attribute from. | |
attrname | The name of the attribute. | |
val | The integer value of the attribute will be saved in this pointer. |
Definition at line 928 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.
dag | The collection DAG. | |
collname | The name of the collection to find. | |
nsid | The namespace id. |
Definition at line 903 of file collection.c.
Referenced by bind_all_references(), xmms_collection_find(), xmms_collection_get(), xmms_collection_rename(), and xmms_collection_save().
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.
dag | The collection DAG. | |
source | The collection to query. |
Definition at line 1008 of file collection.c.
xmms_coll_dag_t* xmms_collection_init | ( | xmms_playlist_t * | playlist | ) |
Initializes a new xmms_coll_dag_t.
Definition at line 215 of file collection.c.
Referenced by xmms_playlist_init().
GList* xmms_collection_list | ( | xmms_coll_dag_t * | dag, | |
const gchar * | namespace, | |||
xmms_error_t * | err | |||
) |
Lists the collections in the given namespace.
dag | The collection DAG. | |
namespace | The namespace to list collections from (can be ALL). | |
err | If an error occurs, a message is stored in it. |
Definition at line 605 of file collection.c.
GList* xmms_collection_query_ids | ( | xmms_coll_dag_t * | dag, | |
xmmsv_coll_t * | coll, | |||
guint | lim_start, | |||
guint | lim_len, | |||
xmmsv_t * | order, | |||
xmms_error_t * | err | |||
) |
Find the ids of the media matched by a collection.
dag | The collection DAG. | |
coll | The collection used to match media. | |
lim_start | The beginning index of the LIMIT statement (0 to disable). | |
lim_len | The number of entries of the LIMIT statement (0 to disable). | |
order | The list of properties to order by (empty to disable). | |
err | If an error occurs, a message is stored in it. |
Definition at line 768 of file collection.c.
Referenced by xmms_collection_get_random_media(), and xmms_playlist_add_collection().
GList* xmms_collection_query_infos | ( | xmms_coll_dag_t * | dag, | |
xmmsv_coll_t * | coll, | |||
guint | lim_start, | |||
guint | lim_len, | |||
xmmsv_t * | order, | |||
xmmsv_t * | fetch, | |||
xmmsv_t * | group, | |||
xmms_error_t * | err | |||
) |
Find the properties of the media matched by a collection.
dag | The collection DAG. | |
coll | The collection used to match media. | |
lim_start | The beginning index of the LIMIT statement (0 to disable). | |
lim_len | The number of entries of the LIMIT statement (0 to disable). | |
order | The list of properties to order by, prefix by '-' to invert (empty to disable). | |
fetch | The list of properties to be retrieved. | |
group | The list of properties to group by (empty to disable). | |
err | If an error occurs, a message is stored in it. |
Definition at line 816 of file collection.c.
Referenced by xmms_collection_query_ids().
gboolean xmms_collection_remove | ( | xmms_coll_dag_t * | dag, | |
const gchar * | name, | |||
const gchar * | namespace, | |||
xmms_error_t * | err | |||
) |
Remove the given collection from the DAG.
If to be removed from ALL namespaces, then all matching collections are removed.
dag | The collection DAG. | |
name | The name of the collection to remove. | |
namespace | The namespace where the collection to remove is (can be ALL). | |
err | If an error occurs, a message is stored in it. |
Definition at line 419 of file collection.c.
gboolean xmms_collection_rename | ( | xmms_coll_dag_t * | dag, | |
const gchar * | from_name, | |||
const gchar * | to_name, | |||
const gchar * | namespace, | |||
xmms_error_t * | err | |||
) |
Rename a collection in a given namespace.
dag | The collection DAG. | |
from_name | The name of the collection to rename. | |
to_name | The new name of the collection. | |
namespace | The namespace to consider (cannot be ALL). | |
err | If an error occurs, a message is stored in it. |
Definition at line 696 of file collection.c.
gboolean xmms_collection_save | ( | xmms_coll_dag_t * | dag, | |
const gchar * | name, | |||
const gchar * | namespace, | |||
xmmsv_coll_t * | coll, | |||
xmms_error_t * | err | |||
) |
Save the given collection in the DAG under the given name in the given namespace.
dag | The collection DAG in which to save the collection. | |
name | The name under which to save the collection. | |
namespace | The namespace in which to save th collection. | |
coll | The collection structure to save. | |
err | If an error occurs, a message is stored in it. |
Definition at line 462 of file collection.c.
gboolean xmms_collection_set_int_attr | ( | xmmsv_coll_t * | coll, | |
const gchar * | attrname, | |||
gint | newval | |||
) |
Set the attribute of a collection as an integer.
coll | The collection in which to set the attribute. | |
attrname | The name of the attribute. | |
newval | The new value of the attribute. |
Definition at line 956 of file collection.c.
Referenced by xmms_playlist_current_entry(), and xmms_playlist_insert_entry().
void xmms_collection_sync | ( | xmms_coll_dag_t * | dag, | |
xmms_error_t * | err | |||
) |
Synchronize collection data to the database (i.e.
to disk).
dag | The collection DAG. | |
err | If an error occurs, a message is stored in it. |
Definition at line 583 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.
dag | The collection DAG. | |
name | The name of the reference to update. | |
nsid | The namespace in which to locate the reference. | |
newtarget | The new collection pointed to by the reference. |
Definition at line 879 of file collection.c.