XMMS2
Macros | Typedefs | Enumerations | Functions
collection.c File Reference

Manages collections. More...

#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_collsync.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"
#include "collection_ipc.c"

Go to the source code of this file.

Macros

#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

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. More...
 
void xmms_collection_sync (xmms_coll_dag_t *dag)
 Synchronize collection data to the database (i.e. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
gboolean xmms_collection_get_int_attr (xmmsv_coll_t *coll, const gchar *attrname, gint *val)
 Extract an attribute from a collection as an integer. More...
 
gboolean xmms_collection_set_int_attr (xmmsv_coll_t *coll, const gchar *attrname, gint newval)
 Set the attribute of a collection as an integer. More...
 
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. More...
 
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. More...
 
xmms_collection_namespace_id_t xmms_collection_get_namespace_id (const gchar *namespace)
 Find the namespace id corresponding to a namespace string. More...
 
const gchar * xmms_collection_get_namespace_string (xmms_collection_namespace_id_t nsid)
 Find the namespace name (string) corresponding to a namespace id. More...
 
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. More...
 
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. More...
 
void xmms_collection_apply_to_collection (xmms_coll_dag_t *dag, xmmsv_coll_t *coll, FuncApplyToColl f, void *udata)
 Apply a function of type FuncApplyToColl to the given collection. More...
 
void bind_all_references (xmms_coll_dag_t *dag, xmmsv_coll_t *coll, xmmsv_coll_t *parent, void *udata)
 If a reference, add the operator of the pointed collection as an operand. More...
 

Detailed Description

Manages collections.

Definition in file collection.c.

Macro Definition Documentation

◆ XMMS_COLLECTION_CHANGED_MSG

#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 176 of file collection.c.

Typedef Documentation

◆ add_metadata_from_tree_user_data_t

typedef struct add_metadata_from_tree_user_data_St add_metadata_from_tree_user_data_t

Enumeration Type Documentation

◆ coll_find_state_t

Enumerator
XMMS_COLLECTION_FIND_STATE_UNCHECKED 
XMMS_COLLECTION_FIND_STATE_MATCH 
XMMS_COLLECTION_FIND_STATE_NOMATCH 

Definition at line 73 of file collection.c.

Function Documentation

◆ bind_all_references()

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

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

Definition at line 1503 of file collection.c.

◆ xmms_collection_apply_to_all_collections()

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
dagThe collection DAG.
fThe function to apply to all the collections.
udataAdditional user data parameter passed to the function.

Definition at line 1393 of file collection.c.

◆ xmms_collection_apply_to_collection()

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

Apply a function of type FuncApplyToColl to the given collection.

Parameters
dagThe collection DAG.
collThe collection on which to apply the function.
fThe function to apply to all the collections.
udataAdditional user data parameter passed to the function.

Definition at line 1412 of file collection.c.

◆ xmms_collection_changed_msg_new()

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.

◆ xmms_collection_changed_msg_send()

void xmms_collection_changed_msg_send ( xmms_coll_dag_t colldag,
GTree *  dict 
)

Definition at line 163 of file collection.c.

◆ xmms_collection_foreach_in_namespace()

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
dagThe collection DAG.
nsidThe namespace id.
fThe function to apply to all the collections.
udataAdditional user data parameter passed to the function.

Definition at line 1373 of file collection.c.

Referenced by xmms_collection_dag_save(), and xmms_playlist_remove_by_entry().

◆ xmms_collection_get_namespace_id()

xmms_collection_namespace_id_t xmms_collection_get_namespace_id ( const gchar *  namespace)

Find the namespace id corresponding to a namespace string.

Parameters
namespaceThe namespace string.
Returns
The namespace id.

Definition at line 1297 of file collection.c.

Referenced by bind_all_references().

◆ xmms_collection_get_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.

Parameters
nsidThe namespace id.
Returns
The namespace name (string).

Definition at line 1320 of file collection.c.