Top | Description | ![]() |
![]() |
![]() |
![]() |
enum RBExtDBSourceType; struct RBExtDB; struct RBExtDBClass; void (*RBExtDBRequestCallback) (RBExtDBKey *key
,const char *filename
,GValue *data
,gpointer user_data
); RBExtDB * rb_ext_db_new (const char *name
); char * rb_ext_db_lookup (RBExtDB *store
,RBExtDBKey *key
); gboolean rb_ext_db_request (RBExtDB *store
,RBExtDBKey *key
,RBExtDBRequestCallback callback
,gpointer user_data
,GDestroyNotify destroy
); void rb_ext_db_store_uri (RBExtDB *store
,RBExtDBKey *key
,RBExtDBSourceType source_type
,const char *uri
); void rb_ext_db_store (RBExtDB *store
,RBExtDBKey *key
,RBExtDBSourceType source_type
,GValue *data
); void rb_ext_db_store_raw (RBExtDB *store
,RBExtDBKey *key
,RBExtDBSourceType source_type
,GValue *data
);
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.
typedef enum { RB_EXT_DB_SOURCE_NONE, /* nothing */ RB_EXT_DB_SOURCE_SEARCH, /* found by external search */ RB_EXT_DB_SOURCE_EMBEDDED, /* embedded in media itself */ RB_EXT_DB_SOURCE_USER, /* provided by user (eg image in same dir) */ RB_EXT_DB_SOURCE_USER_EXPLICIT /* provided explicitly by user */ } RBExtDBSourceType;
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); };
void (*RBExtDBRequestCallback) (RBExtDBKey *key
,const char *filename
,GValue *data
,gpointer user_data
);
RBExtDB * rb_ext_db_new (const char *name
);
Provides access to a metadata store instance.
|
name of the metadata store |
Returns : |
named metadata store instance |
char * rb_ext_db_lookup (RBExtDB *store
,RBExtDBKey *key
);
Looks up a cached metadata item.
|
metadata store instance |
|
metadata lookup key |
Returns : |
name of the file storing the cached metadata item |
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.
|
metadata store instance |
|
metadata lookup key |
|
callback to call with results |
|
user data to pass to the callback |
|
destroy function for user_data
|
Returns : |
TRUE if results may be provided after returning |
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.
|
metadata store instance |
|
metadata storage key |
|
metadata source type |
|
URI of the item to store. [allow-none] |
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.
|
metadata store instance |
|
metadata storage key |
|
metadata source type |
|
data to store. [allow-none] |
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.
|
metadata store instance |
|
metadata storage key |
|
metadata source type |
|
data to store. [allow-none] |