src/xmms/collection.c File Reference


Detailed Description

Manages collections.

Definition in file collection.c.

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <math.h>
#include "xmmspriv/xmms_collection.h"
#include "xmmspriv/xmms_playlist.h"
#include "xmmspriv/xmms_collquery.h"
#include "xmmspriv/xmms_collserial.h"
#include "xmmspriv/xmms_xform.h"
#include "xmmspriv/xmms_streamtype.h"
#include "xmms/xmms_ipc.h"
#include "xmms/xmms_config.h"
#include "xmms/xmms_log.h"

Go to the source code of this file.

Defines

#define XMMS_COLLECTION_CHANGED_MSG(type, name, namespace)   xmms_collection_changed_msg_send (dag, xmms_collection_changed_msg_new (type, name, namespace))

Typedefs

typedef struct
add_metadata_from_tree_user_data_St 
add_metadata_from_tree_user_data_t

Enumerations

enum  coll_find_state_t { XMMS_COLLECTION_FIND_STATE_UNCHECKED, XMMS_COLLECTION_FIND_STATE_MATCH, XMMS_COLLECTION_FIND_STATE_NOMATCH }

Functions

 XMMS_CMD_DEFINE (collection_get, xmms_collection_get, xmms_coll_dag_t *, COLL, STRING, STRING)
 XMMS_CMD_DEFINE (collection_list, xmms_collection_list, xmms_coll_dag_t *, LIST, STRING, NONE)
 XMMS_CMD_DEFINE3 (collection_save, xmms_collection_save, xmms_coll_dag_t *, NONE, STRING, STRING, COLL)
 XMMS_CMD_DEFINE (collection_remove, xmms_collection_remove, xmms_coll_dag_t *, NONE, STRING, STRING)
 XMMS_CMD_DEFINE (collection_find, xmms_collection_find, xmms_coll_dag_t *, LIST, UINT32, STRING)
 XMMS_CMD_DEFINE3 (collection_rename, xmms_collection_rename, xmms_coll_dag_t *, NONE, STRING, STRING, STRING)
 XMMS_CMD_DEFINE (collection_from_pls, xmms_collection_idlist_from_pls, xmms_coll_dag_t *, COLL, STRING, NONE)
 XMMS_CMD_DEFINE (collection_sync, xmms_collection_sync, xmms_coll_dag_t *, NONE, NONE, NONE)
 XMMS_CMD_DEFINE4 (query_ids, xmms_collection_query_ids, xmms_coll_dag_t *, LIST, COLL, UINT32, UINT32, STRINGLIST)
 XMMS_CMD_DEFINE6 (query_infos, xmms_collection_query_infos, xmms_coll_dag_t *, LIST, COLL, UINT32, UINT32, STRINGLIST, STRINGLIST, STRINGLIST)
GTree * xmms_collection_changed_msg_new (xmms_collection_changed_actions_t type, const gchar *plname, const gchar *namespace)
void xmms_collection_changed_msg_send (xmms_coll_dag_t *colldag, GTree *dict)
xmms_coll_dag_txmms_collection_init (xmms_playlist_t *playlist)
 Initializes a new xmms_coll_dag_t.
gboolean xmms_collection_remove (xmms_coll_dag_t *dag, gchar *name, gchar *namespace, xmms_error_t *err)
 Remove the given collection from the DAG.
gboolean xmms_collection_save (xmms_coll_dag_t *dag, gchar *name, gchar *namespace, xmmsc_coll_t *coll, xmms_error_t *err)
 Save the given collection in the DAG under the given name in the given namespace.
xmmsc_coll_txmms_collection_get (xmms_coll_dag_t *dag, gchar *name, 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, gchar *namespace, xmms_error_t *err)
 Lists the collections in the given namespace.
GList * xmms_collection_find (xmms_coll_dag_t *dag, guint mid, 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, gchar *from_name, gchar *to_name, gchar *namespace, xmms_error_t *err)
 Rename a collection in a given namespace.
GList * xmms_collection_query_ids (xmms_coll_dag_t *dag, xmmsc_coll_t *coll, guint lim_start, guint lim_len, GList *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, xmmsc_coll_t *coll, guint lim_start, guint lim_len, GList *order, GList *fetch, GList *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, xmmsc_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, xmmsc_coll_t *newcoll)
 Update the DAG to update the value of the pair with the given key.
xmmsc_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 (xmmsc_coll_t *coll, const gchar *attrname, gint *val)
 Extract an attribute from a collection as an integer.
gboolean xmms_collection_set_int_attr (xmmsc_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, xmmsc_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, xmmsc_coll_t *source)
 Get a random media entry from the given collection.
xmms_collection_namespace_id_t xmms_collection_get_namespace_id (gchar *namespace)
 Find the namespace id corresponding to a namespace string.
const gchar * xmms_collection_get_namespace_string (xmms_collection_namespace_id_t nsid)
 Find the namespace name (string) corresponding to a namespace id.
void xmms_collection_foreach_in_namespace (xmms_coll_dag_t *dag, guint nsid, GHFunc f, void *udata)
 Apply a function to all the collections in a given namespace.
void xmms_collection_apply_to_all_collections (xmms_coll_dag_t *dag, FuncApplyToColl f, void *udata)
 Apply a function of type FuncApplyToColl to all the collections in all namespaces.
void xmms_collection_apply_to_collection (xmms_coll_dag_t *dag, xmmsc_coll_t *coll, FuncApplyToColl f, void *udata)
 Apply a function of type FuncApplyToColl to the given collection.
void bind_all_references (xmms_coll_dag_t *dag, xmmsc_coll_t *coll, xmmsc_coll_t *parent, void *udata)
 If a reference, add the operator of the pointed collection as an operand.


Define Documentation

#define XMMS_COLLECTION_CHANGED_MSG ( type,
name,
namespace   )     xmms_collection_changed_msg_send (dag, xmms_collection_changed_msg_new (type, name, namespace))

Definition at line 182 of file collection.c.

Referenced by xmms_collection_save().


Typedef Documentation

typedef struct add_metadata_from_tree_user_data_St add_metadata_from_tree_user_data_t


Enumeration Type Documentation

Enumerator:
XMMS_COLLECTION_FIND_STATE_UNCHECKED 
XMMS_COLLECTION_FIND_STATE_MATCH 
XMMS_COLLECTION_FIND_STATE_NOMATCH 

Definition at line 72 of file collection.c.


Function Documentation

void bind_all_references ( xmms_coll_dag_t dag,
xmmsc_coll_t coll,
xmmsc_coll_t parent,
void *  udata 
)

If a reference, add the operator of the pointed collection as an operand.

Definition at line 1469 of file collection.c.

Referenced by xmms_collection_dag_restore(), and xmms_collection_save().

XMMS_CMD_DEFINE ( collection_sync  ,
xmms_collection_sync  ,
xmms_coll_dag_t ,
NONE  ,
NONE  ,
NONE   
)

XMMS_CMD_DEFINE ( collection_from_pls  ,
xmms_collection_idlist_from_pls  ,
xmms_coll_dag_t ,
COLL  ,
STRING  ,
NONE   
)

XMMS_CMD_DEFINE ( collection_find  ,
xmms_collection_find  ,
xmms_coll_dag_t ,
LIST  ,
UINT32  ,
STRING   
)

XMMS_CMD_DEFINE ( collection_remove  ,
xmms_collection_remove  ,
xmms_coll_dag_t ,
NONE  ,
STRING  ,
STRING   
)

XMMS_CMD_DEFINE ( collection_list  ,
xmms_collection_list  ,
xmms_coll_dag_t ,
LIST  ,
STRING  ,
NONE   
)

XMMS_CMD_DEFINE ( collection_get  ,
xmms_collection_get  ,
xmms_coll_dag_t ,
COLL  ,
STRING  ,
STRING   
)

XMMS_CMD_DEFINE3 ( collection_rename  ,
xmms_collection_rename  ,
xmms_coll_dag_t ,
NONE  ,
STRING  ,
STRING  ,
STRING   
)

XMMS_CMD_DEFINE3 ( collection_save  ,
xmms_collection_save  ,
xmms_coll_dag_t ,
NONE  ,
STRING  ,
STRING  ,
COLL   
)

XMMS_CMD_DEFINE4 ( query_ids  ,
xmms_collection_query_ids  ,
xmms_coll_dag_t ,
LIST  ,
COLL  ,
UINT32  ,
UINT32  ,
STRINGLIST   
)

XMMS_CMD_DEFINE6 ( query_infos  ,
xmms_collection_query_infos  ,
xmms_coll_dag_t ,
LIST  ,
COLL  ,
UINT32  ,
UINT32  ,
STRINGLIST  ,
STRINGLIST  ,
STRINGLIST   
)

void xmms_collection_apply_to_all_collections ( xmms_coll_dag_t dag,
FuncApplyToColl  f,
void *  udata 
)

Apply a function of type FuncApplyToColl to all the collections in all namespaces.

Parameters:
dag The collection DAG.
f The function to apply to all the collections.
udata Additional user data parameter passed to the function.

Definition at line 1365 of file collection.c.

Referenced by xmms_collection_dag_restore(), xmms_collection_rename(), and xmms_collection_save().

void xmms_collection_apply_to_collection ( xmms_coll_dag_t dag,
xmmsc_coll_t coll,
FuncApplyToColl  f,
void *  udata 
)

Apply a function of type FuncApplyToColl to the given collection.

Parameters:
dag The collection DAG.
coll The collection on which to apply the function.
f The function to apply to all the collections.
udata Additional user data parameter passed to the function.

Definition at line 1384 of file collection.c.

Referenced by xmms_collection_save().

GTree* xmms_collection_changed_msg_new ( xmms_collection_changed_actions_t  type,
const gchar *  plname,
const gchar *  namespace 
)

Definition at line 147 of file collection.c.

Referenced by xmms_collection_rename().

void xmms_collection_changed_msg_send ( xmms_coll_dag_t colldag,
GTree *  dict 
)

Definition at line 169 of file collection.c.

Referenced by xmms_collection_rename().

void xmms_collection_foreach_in_namespace ( xmms_coll_dag_t dag,
guint  nsid,
GHFunc  f,
void *  udata 
)

Apply a function to all the collections in a given namespace.

Parameters:
dag The collection DAG.
nsid The namespace id.
f The function to apply to all the collections.
udata Additional user data parameter passed to the function.

Definition at line 1345 of file collection.c.

Referenced by xmms_collection_dag_save(), xmms_collection_find(), xmms_collection_list(), and xmms_playlist_remove_by_entry().

xmms_collection_namespace_id_t xmms_collection_get_namespace_id ( gchar *  namespace  ) 

Find the namespace id corresponding to a namespace string.

Parameters:
namespace The namespace string.
Returns:
The namespace id.

Definition at line 1270 of file collection.c.

Referenced by bind_all_references(), xmms_collection_find(), xmms_collection_get(), xmms_collection_list(), xmms_collection_remove(), xmms_collection_rename(), and xmms_collection_save().

const gchar* xmms_collection_get_namespace_string ( xmms_collection_namespace_id_t  nsid  ) 

Find the namespace name (string) corresponding to a namespace id.

Parameters:
nsid The namespace id.
Returns:
The namespace name (string).

Definition at line 1293 of file collection.c.


Generated on Wed Dec 10 18:06:45 2008 for XMMS2 by  doxygen 1.5.6