## RBExtDB

RBExtDB — store for external metadata such as album art

## Functions

void | ( *RBExtDBRequestCallback ) ()
RBExtDB * | rb_ext_db_new ()
char * | rb_ext_db_lookup ()
gboolean | rb_ext_db_request ()
void | rb_ext_db_store_uri ()
void | rb_ext_db_store ()
void | rb_ext_db_store_raw ()

## Types and Values

enum | RBExtDBSourceType
struct | RBExtDB
struct | RBExtDBClass

## Description

This class simplifies searching for and providing external metadata such as album art or lyrics. A metadata provider connects to a signal on the database and in response provides a URI, a buffer containing the data, or an object representation of the data (such as a GdkPixbuf). A metadata requestor calls rb_ext_db_request and specifies a callback, or alternatively connects to a signal to receive all metadata as it is stored.

## Functions

### RBExtDBRequestCallback ()

    void
    (*RBExtDBRequestCallback) (RBExtDBKey *key,
                               RBExtDBKey *store_key,
                               const char *filename,
                               GValue *data,
                               gpointer user_data);

### rb_ext_db_new ()

    RBExtDB *
    rb_ext_db_new (const char *name);

Provides access to a metadata store instance.

#### Parameters

name | name of the metadata store |

#### Returns

named metadata store instance

### rb_ext_db_lookup ()

    char *
    rb_ext_db_lookup (RBExtDB *store,
                      RBExtDBKey *key,
                      RBExtDBKey **store_key);

Looks up a cached metadata item.

#### Parameters

store | metadata store instance |
key | metadata lookup key |
store_key | optionally returns the matching storage key. | [out][transfer full][allow-none]

#### Returns

name of the file storing the cached metadata item

### rb_ext_db_request ()

    gboolean
    rb_ext_db_request (RBExtDB *store,
                       RBExtDBKey *key,
                       RBExtDBRequestCallback callback,
                       gpointer user_data,
                       GDestroyNotify destroy);

Requests a metadata item. If the item is cached, the callback will be called synchronously. Otherwise, metadata providers will provide results asynchronously.

#### Parameters

store | metadata store instance |
key | metadata lookup key |
callback | callback to call with results |
user_data | user data to pass to the callback |
destroy | destroy function for `user_data` |

#### Returns

`TRUE` if results may be provided after returning

### rb_ext_db_store_uri ()

    void
    rb_ext_db_store_uri (RBExtDB *store,
                         RBExtDBKey *key,
                         RBExtDBSourceType source_type,
                         const char *uri);

Stores an item identified by `uri` in the metadata store so that lookups matching `key` will return it.

#### Parameters

store | metadata store instance |
key | metadata storage key |
source_type | metadata source type |
uri | URI of the item to store. | [allow-none]

### rb_ext_db_store ()

    void
    rb_ext_db_store (RBExtDB *store,
                     RBExtDBKey *key,
                     RBExtDBSourceType source_type,
                     GValue *data);

Stores an item in the metadata store so that lookups matching `key` will return it. `data` should contain an object that must be transformed using the RBExtDB::store signal before being stored. For example, the album art cache expects GdkPixbuf objects here, rather than buffers containing JPEG encoded files.

#### Parameters

store | metadata store instance |
key | metadata storage key |
source_type | metadata source type |
data | data to store. | [allow-none]

### rb_ext_db_store_raw ()

    void
    rb_ext_db_store_raw (RBExtDB *store,
                         RBExtDBKey *key,
                         RBExtDBSourceType source_type,
                         GValue *data);

Stores an item in the metadata store so that lookpus matching `key` will return it. `data` should contain the data to be written to the store, either as a string or as a GByteArray.

#### Parameters

store | metadata store instance |
key | metadata storage key |
source_type | metadata source type |
data | data to store. | [allow-none]

## Types and Values

### enum RBExtDBSourceType

#### Members

RB_EXT_DB_SOURCE_NONE |  |
RB_EXT_DB_SOURCE_SEARCH |  |
RB_EXT_DB_SOURCE_EMBEDDED |  |
RB_EXT_DB_SOURCE_USER |  |
RB_EXT_DB_SOURCE_USER_EXPLICIT |  |

### struct RBExtDB

    struct RBExtDB {
    	GObject parent;

    	RBExtDBPrivate *priv;
    };

### struct RBExtDBClass

    struct RBExtDBClass {
    	GObjectClass parent;

    	/* requestor signals */
    	void		(*added) (RBExtDB *store,
    					 RBExtDBKey *key,
    					 const char *filename,
    					 GValue *data);

    	/* provider signals */
    	gboolean (*request) (RBExtDB *store,
    					 RBExtDBKey *key,
    					 guint64 last_time);

    	/* data format conversion signals */
    	GValue * (*store) (RBExtDB *store,
    					 GValue *data);
    	GValue * (*load)		(RBExtDB *store,
    					 GValue *data);
    };