Medialib
[XMMSServer]

Medialib caches metadata. More...

Defines

#define XMMS_MEDIALIB_SOURCE_SERVER   "server"
#define XMMS_MEDIALIB_SOURCE_SERVER_ID   1
#define XMMS_MEDIALIB_RETRV_PROPERTY_SQL   "SELECT IFNULL (intval, value) FROM Media WHERE key=%Q AND id=%d ORDER BY xmms_source_pref(source, %Q) LIMIT 1"
 Retrieve a property from an entry.

Functions

guint32 xmms_medialib_source_to_id (xmms_medialib_session_t *session, const gchar *source)
xmms_medialib_txmms_medialib_init (xmms_playlist_t *playlist)
 Initialize the medialib and open the database file.
xmms_medialib_session_t_xmms_medialib_begin (gboolean write, const char *file, int line)
 Session handling.
void xmms_medialib_end (xmms_medialib_session_t *session)
xmmsv_t * xmms_medialib_entry_property_get_value (xmms_medialib_session_t *session, xmms_medialib_entry_t entry, const gchar *property)
gchar * xmms_medialib_entry_property_get_str (xmms_medialib_session_t *session, xmms_medialib_entry_t entry, const gchar *property)
 Retrieve a property from an entry.
gint xmms_medialib_entry_property_get_int (xmms_medialib_session_t *session, xmms_medialib_entry_t entry, const gchar *property)
 Retrieve a property as a int from a entry.
gboolean xmms_medialib_entry_property_set_int (xmms_medialib_session_t *session, xmms_medialib_entry_t entry, const gchar *property, gint value)
 Set a entry property to a new value, overwriting the old value.
gboolean xmms_medialib_entry_property_set_int_source (xmms_medialib_session_t *session, xmms_medialib_entry_t entry, const gchar *property, gint value, guint32 source)
gboolean xmms_medialib_entry_property_set_str (xmms_medialib_session_t *session, xmms_medialib_entry_t entry, const gchar *property, const gchar *value)
 Set a entry property to a new value, overwriting the old value.
gboolean xmms_medialib_entry_property_set_str_source (xmms_medialib_session_t *session, xmms_medialib_entry_t entry, const gchar *property, const gchar *value, guint32 source)
void xmms_medialib_entry_send_update (xmms_medialib_entry_t entry)
 Trigger a update signal to the client.
void xmms_medialib_entry_send_added (xmms_medialib_entry_t entry)
 Trigger an added siginal to the client.
void xmms_medialib_entry_remove (xmms_medialib_entry_t entry)
 Remove a medialib entry from the database.
void xmms_medialib_entry_cleanup (xmms_medialib_session_t *session, xmms_medialib_entry_t entry)
void xmms_medialib_add_recursive (xmms_medialib_t *medialib, const gchar *playlist, const gchar *path, xmms_error_t *error)
void xmms_medialib_insert_recursive (xmms_medialib_t *medialib, const gchar *playlist, gint32 pos, const gchar *path, xmms_error_t *error)
xmms_medialib_entry_t xmms_medialib_entry_new_encoded (xmms_medialib_session_t *session, const char *url, xmms_error_t *error)
xmms_medialib_entry_t xmms_medialib_entry_new (xmms_medialib_session_t *session, const char *url, xmms_error_t *error)
 Welcome to a function that should be called something else.
GList * xmms_medialib_info_list (xmms_medialib_t *medialib, guint32 id, xmms_error_t *err)
GList * xmms_medialib_select (xmms_medialib_session_t *session, const gchar *query, xmms_error_t *error)
 Get a list of GHashTables 's that matches the query.

Detailed Description

Medialib caches metadata.

Controls metadata storage.


Define Documentation

#define XMMS_MEDIALIB_RETRV_PROPERTY_SQL   "SELECT IFNULL (intval, value) FROM Media WHERE key=%Q AND id=%d ORDER BY xmms_source_pref(source, %Q) LIMIT 1"
#define XMMS_MEDIALIB_SOURCE_SERVER   "server"

Definition at line 140 of file medialib.c.

#define XMMS_MEDIALIB_SOURCE_SERVER_ID   1

Function Documentation

xmms_medialib_session_t* _xmms_medialib_begin ( gboolean  write,
const char *  file,
int  line 
)

Session handling.

This will only happen when OLD_SQLITE_VERSION is set.

Definition at line 384 of file medialib.c.

void xmms_medialib_add_recursive ( xmms_medialib_t medialib,
const gchar *  playlist,
const gchar *  path,
xmms_error_t error 
)

Definition at line 859 of file medialib.c.

void xmms_medialib_end ( xmms_medialib_session_t session  ) 
void xmms_medialib_entry_cleanup ( xmms_medialib_session_t session,
xmms_medialib_entry_t  entry 
)

Definition at line 801 of file medialib.c.

xmms_medialib_entry_t xmms_medialib_entry_new ( xmms_medialib_session_t session,
const char *  url,
xmms_error_t error 
)

Welcome to a function that should be called something else.

Returns a entry for a URL, if the URL is already in the medialib the current entry will be returned otherwise a new one will be created and returned.

Todo:
rename to something better?
Parameters:
session The medialib session to be used for the transaction.
url URL to add/retrieve from the medialib
error If an error occurs, it will be stored in there.
Returns:
Entry mapped to the URL

Definition at line 1007 of file medialib.c.

Referenced by xmms_medialib_init().

xmms_medialib_entry_t xmms_medialib_entry_new_encoded ( xmms_medialib_session_t session,
const char *  url,
xmms_error_t error 
)

Definition at line 951 of file medialib.c.

Referenced by xmms_medialib_entry_new().

gint xmms_medialib_entry_property_get_int ( xmms_medialib_session_t session,
xmms_medialib_entry_t  entry,
const gchar *  property 
)

Retrieve a property as a int from a entry.

Parameters:
session The medialib session to be used for the transaction.
entry Entry to query.
property The property to extract. Strings passed should be defined in medialib.h
Returns:
Property as integer, or -1 if it doesn't exist.

Definition at line 542 of file medialib.c.

gchar* xmms_medialib_entry_property_get_str ( xmms_medialib_session_t session,
xmms_medialib_entry_t  entry,
const gchar *  property 
)

Retrieve a property from an entry.

Parameters:
session The medialib session to be used for the transaction.
entry Entry to query.
property The property to extract. Strings passed should be defined in medialib.h
Returns:
Newly allocated gchar that needs to be freed with g_free

Definition at line 515 of file medialib.c.

xmmsv_t* xmms_medialib_entry_property_get_value ( xmms_medialib_session_t session,
xmms_medialib_entry_t  entry,
const gchar *  property 
)

Definition at line 483 of file medialib.c.

gboolean xmms_medialib_entry_property_set_int ( xmms_medialib_session_t session,
xmms_medialib_entry_t  entry,
const gchar *  property,
gint  value 
)

Set a entry property to a new value, overwriting the old value.

Parameters:
session The medialib session to be used for the transaction.
entry Entry to alter.
property The property to extract. Strings passed should be defined in medialib.h
value gint with the new value, will be copied in to the medialib
Returns:
TRUE on success and FALSE on failure.

Definition at line 570 of file medialib.c.

Referenced by xmms_sample_converter_to_medialib().

gboolean xmms_medialib_entry_property_set_int_source ( xmms_medialib_session_t session,
xmms_medialib_entry_t  entry,
const gchar *  property,
gint  value,
guint32  source 
)

Definition at line 581 of file medialib.c.

Referenced by xmms_medialib_entry_property_set_int().

gboolean xmms_medialib_entry_property_set_str ( xmms_medialib_session_t session,
xmms_medialib_entry_t  entry,
const gchar *  property,
const gchar *  value 
)

Set a entry property to a new value, overwriting the old value.

Parameters:
session The medialib session to be used for the transaction.
entry Entry to alter.
property The property to extract. Strings passed should be defined in medialib.h
value gchar with the new value, will be copied in to the medialib
Returns:
TRUE on success and FALSE on failure.

Definition at line 620 of file medialib.c.

Referenced by xmms_sample_converter_to_medialib().

gboolean xmms_medialib_entry_property_set_str_source ( xmms_medialib_session_t session,
xmms_medialib_entry_t  entry,
const gchar *  property,
const gchar *  value,
guint32  source 
)

Definition at line 631 of file medialib.c.

Referenced by xmms_medialib_entry_property_set_str().

void xmms_medialib_entry_remove ( xmms_medialib_entry_t  entry  ) 

Remove a medialib entry from the database.

Parameters:
session The medialib session to be used for the transaction.
entry Entry to remove

Todo:
safe ?

Definition at line 709 of file medialib.c.

void xmms_medialib_entry_send_added ( xmms_medialib_entry_t  entry  ) 

Trigger an added siginal to the client.

This should be called when a new entry has been added to the medialib

Parameters:
entry Entry to signal an add for.

Definition at line 687 of file medialib.c.

Referenced by xmms_medialib_entry_new_encoded().

void xmms_medialib_entry_send_update ( xmms_medialib_entry_t  entry  ) 

Trigger a update signal to the client.

This should be called when important information in the entry has been changed and should be visible to the user.

Parameters:
entry Entry to signal a update for.

Definition at line 673 of file medialib.c.

GList* xmms_medialib_info_list ( xmms_medialib_t medialib,
guint32  id,
xmms_error_t err 
)

Definition at line 1181 of file medialib.c.

xmms_medialib_t* xmms_medialib_init ( xmms_playlist_t playlist  ) 

Initialize the medialib and open the database file.

Parameters:
playlist the current playlist pointer
Returns:
TRUE if successful and FALSE if there was a problem

Create a global session, this is only used when the sqlite version doesn't support concurrent sessions

this dummy just wants to put the default song in the playlist

Definition at line 314 of file medialib.c.

Referenced by xmms_playlist_init().

void xmms_medialib_insert_recursive ( xmms_medialib_t medialib,
const gchar *  playlist,
gint32  pos,
const gchar *  path,
xmms_error_t error 
)

Definition at line 872 of file medialib.c.

Referenced by xmms_medialib_add_recursive().

GList* xmms_medialib_select ( xmms_medialib_session_t session,
const gchar *  query,
xmms_error_t error 
)

Get a list of GHashTables 's that matches the query.

Parameters:
session The medialib session to be used for the transaction.
query SQL query that should be executed.
error In case of error this will be filled.
Returns:
GList containing GHashTables. Caller are responsible to free all memory.

Definition at line 1379 of file medialib.c.

Referenced by xmms_collection_dag_restore(), and xmms_collection_dag_save().

guint32 xmms_medialib_source_to_id ( xmms_medialib_session_t session,
const gchar *  source 
)

Definition at line 260 of file medialib.c.


Generated on Tue Feb 23 18:14:36 2010 for XMMS2 by  doxygen 1.6.1