![]() |
![]() |
![]() |
Grilo Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#include <grilo.h> enum GrlMetadataResolutionFlags; enum GrlMetadataWritingFlags; GrlMetadataSource; void (*GrlMetadataSourceResolveCb) (GrlMetadataSource *source
,GrlMedia *media
,gpointer user_data
,const GError *error
); void (*GrlMetadataSourceSetMetadataCb) (GrlMetadataSource *source
,GrlMedia *media
,GList *failed_keys
,gpointer user_data
,const GError *error
); GrlMetadataSourceResolveSpec; GrlMetadataSourceSetMetadataSpec; enum GrlSupportedOps; GrlMetadataSourceClass; GrlSupportedOps grl_metadata_source_supported_operations (GrlMetadataSource *source
); const GList * grl_metadata_source_supported_keys (GrlMetadataSource *source
); const GList * grl_metadata_source_slow_keys (GrlMetadataSource *source
); GList * grl_metadata_source_filter_supported (GrlMetadataSource *source
,GList **keys
,gboolean return_filtered
); GList * grl_metadata_source_filter_slow (GrlMetadataSource *source
,GList **keys
,gboolean return_filtered
); GList * grl_metadata_source_filter_writable (GrlMetadataSource *source
,GList **keys
,gboolean return_filtered
); const GList * grl_metadata_source_key_depends (GrlMetadataSource *source
,GrlKeyID key_id
); const GList * grl_metadata_source_writable_keys (GrlMetadataSource *source
); void grl_metadata_source_resolve (GrlMetadataSource *source
,const GList *keys
,GrlMedia *media
,GrlMetadataResolutionFlags flags
,GrlMetadataSourceResolveCb callback
,gpointer user_data
); GrlMedia * grl_metadata_source_resolve_sync (GrlMetadataSource *source
,const GList *keys
,GrlMedia *media
,GrlMetadataResolutionFlags flags
,GError **error
); void grl_metadata_source_set_metadata (GrlMetadataSource *source
,GrlMedia *media
,GList *keys
,GrlMetadataWritingFlags flags
,GrlMetadataSourceSetMetadataCb callback
,gpointer user_data
); GList * grl_metadata_source_set_metadata_sync (GrlMetadataSource *source
,GrlMedia *media
,GList *keys
,GrlMetadataWritingFlags flags
,GError **error
); const gchar * grl_metadata_source_get_id (GrlMetadataSource *source
); const gchar * grl_metadata_source_get_name (GrlMetadataSource *source
); const gchar * grl_metadata_source_get_description (GrlMetadataSource *source
);
"source-desc" gchar* : Read / Write / Construct "source-id" gchar* : Read / Write / Construct "source-name" gchar* : Read / Write / Construct
GrlMetadataSource is the abstract base class needed to construct a source of metadata that can be used in a Grilo application.
The metadata sources fetch metadata from different online or local databases and store them in the passed GrlMedia.
In opposition to GrlMediaSource, GrlMetadataSource does not create new GrlMedia instances, just fill them up with the metadata provided by the specific GrlMetadataSource.
For example, GrlLastfmAlbumartSource only provides album's covers, and they will be used in the GrlMedia generated by another GrlMediaSource plugin.
The main method is grl_metadata_source_resolve()
which will retrieve
a list of GrlKeyID requested for the passed GrlMedia.
typedef enum { GRL_RESOLVE_NORMAL = 0, /* Normal mode */ GRL_RESOLVE_FULL = (1 << 0), /* Try other plugins if necessary */ GRL_RESOLVE_IDLE_RELAY = (1 << 1), /* Use idle loop to relay results */ GRL_RESOLVE_FAST_ONLY = (1 << 2), /* Only resolve fast metadata keys */ } GrlMetadataResolutionFlags;
GrlMetadata resolution flags
typedef enum { GRL_WRITE_NORMAL = 0, /* Normal mode */ GRL_WRITE_FULL = (1 << 0), /* Try other plugins if necessary */ } GrlMetadataWritingFlags;
Flags for metadata writing operations.
void (*GrlMetadataSourceResolveCb) (GrlMetadataSource *source
,GrlMedia *media
,gpointer user_data
,const GError *error
);
Prototype for the callback passed to grl_metadata_source_resolve()
|
a metadata source |
|
a GrlMedia transfer object. [transfer full] |
|
user data passed to grl_metadata_source_resolve()
|
|
possible GError generated when resolving the metadata. [not-error][type uint] |
void (*GrlMetadataSourceSetMetadataCb) (GrlMetadataSource *source
,GrlMedia *media
,GList *failed_keys
,gpointer user_data
,const GError *error
);
Prototype for the callback passed to grl_metadata_source_set_metadata()
|
a metadata source |
|
a GrlMedia transfer object. [transfer full] |
|
GList of keys that could not be updated, if any. [element-type GObject.ParamSpec][transfer container GObject.ParamSpec] |
|
user data passed to grl_metadata_source_set_metadata()
|
|
possible GError generated when updating the metadata. [not-error][type uint] |
typedef struct { GrlMetadataSource *source; GList *keys; GrlMedia *media; GrlMetadataResolutionFlags flags; GrlMetadataSourceResolveCb callback; gpointer user_data; } GrlMetadataSourceResolveSpec;
Represents the closure used by the derived objects to fetch, store and return the transfer object to the client's code.
GrlMetadataSource * |
a metadata source |
GList * |
the GList of GrlKeyID to fetch and store |
a GrlMedia transfer object | |
GrlMetadataResolutionFlags |
bitwise mask of GrlMetadataResolutionFlags with the resolution strategy |
GrlMetadataSourceResolveCb |
the callback passed to grl_metadata_source_resolve()
|
gpointer |
user data passed to grl_metadata_source_resolve()
|
typedef struct { GrlMetadataSource *source; GrlMedia *media; GList *keys; GrlMetadataWritingFlags flags; GrlMetadataSourceSetMetadataCb callback; gpointer user_data; GList *failed_keys; } GrlMetadataSourceSetMetadataSpec;
Represents the closure used by the derived objects to operate.
GrlMetadataSource * |
a metadata source |
a GrlMedia transfer object | |
GList * |
List of keys to be stored/updated. |
GrlMetadataWritingFlags |
Flags to control specific bahviors of the set metadata operation. |
GrlMetadataSourceSetMetadataCb |
the callback passed to grl_metadata_source_set_metadata()
|
gpointer |
user data passed to grl_metadata_source_set_metadata()
|
GList * |
for internal use of the framework only. |
typedef enum { GRL_OP_NONE = 0, GRL_OP_METADATA = 1, GRL_OP_RESOLVE = 1 << 1, GRL_OP_BROWSE = 1 << 2, GRL_OP_SEARCH = 1 << 3, GRL_OP_QUERY = 1 << 4, GRL_OP_STORE = 1 << 5, GRL_OP_STORE_PARENT = 1 << 6, GRL_OP_REMOVE = 1 << 7, GRL_OP_SET_METADATA = 1 << 8, GRL_OP_MEDIA_FROM_URI = 1 << 9, GRL_OP_NOTIFY_CHANGE = 1 << 10, } GrlSupportedOps;
Bitwise flags which reflect the kind of operations that a GrlMediaPlugin supports.
no operation is supported | |
Fetch specific keys of metadata based on the media id. | |
Fetch specific keys of metadata based on other metadata. | |
Retrieve complete sets of GrlMedia | |
Look up for GrlMedia given a search text | |
Look up for GrlMedia give a service specific query | |
Store content in a service | |
Store content as child of a certian parent category. | |
Remove content from a service. | |
Update metadata of a GrlMedia in a service. | |
Create a GrlMedia instance from an URI representing a media resource. | |
Notify about changes in the GrlMediaSource. |
typedef struct { GrlMediaPluginClass parent_class; GrlSupportedOps (*supported_operations) (GrlMetadataSource *source); const GList * (*supported_keys) (GrlMetadataSource *source); const GList * (*slow_keys) (GrlMetadataSource *source); const GList * (*key_depends) (GrlMetadataSource *source, GrlKeyID key_id); const GList * (*writable_keys) (GrlMetadataSource *source); void (*resolve) (GrlMetadataSource *source, GrlMetadataSourceResolveSpec *rs); void (*set_metadata) (GrlMetadataSource *source, GrlMetadataSourceSetMetadataSpec *sms); } GrlMetadataSourceClass;
Grilo MetadataSource class. Override the vmethods to implement the element functionality.
GrlMediaPluginClass |
the parent class structure |
the operations that can be called | |
the list of keys that can be handled | |
the list of slow keys that can be fetched | |
the list of keys which key_id depends on
|
|
the list of keys which value can be written | |
resolve the metadata of a given transfer object | |
update metadata values for a given object in a permanent fashion |
GrlSupportedOps grl_metadata_source_supported_operations
(GrlMetadataSource *source
);
By default the derived objects of GrlMetadataSource can only resolve.
|
a metadata source |
Returns : |
a bitwise mangle with the supported operations by the source. [type uint] |
Since 0.1.1
const GList * grl_metadata_source_supported_keys (GrlMetadataSource *source
);
Get a list of GrlKeyID, which describe a metadata types that this source can fetch and store.
|
a metadata source |
Returns : |
a GList with the keys. [element-type GObject.ParamSpec][transfer none GObject.ParamSpec] |
Since 0.1.1
const GList * grl_metadata_source_slow_keys (GrlMetadataSource *source
);
Similar to grl_metadata_source_supported_keys()
, but this keys
are marked as slow because of the amount of traffic/processing needed
to fetch them.
|
a metadata source |
Returns : |
a GList with the keys. [element-type GObject.ParamSpec][transfer none GObject.ParamSpec] |
Since 0.1.1
GList * grl_metadata_source_filter_supported (GrlMetadataSource *source
,GList **keys
,gboolean return_filtered
);
Compares the received keys
list with the supported key list by the
metadata source
, and will delete those keys which are supported.
|
a metadata source |
|
the list of keys to filter out. [element-type GObject.ParamSpec][transfer container GObject.ParamSpec][allow-none GObject.ParamSpec][inout GObject.ParamSpec] |
|
if TRUE the return value shall be a new list with
the matched keys
|
Returns : |
if return_filtered is TRUE will return the list of intersected keys;
otherwise NULL . [element-type GObject.ParamSpec][transfer container GObject.ParamSpec]
|
Since 0.1.1
GList * grl_metadata_source_filter_slow (GrlMetadataSource *source
,GList **keys
,gboolean return_filtered
);
Similar to grl_metadata_source_filter_supported()
but applied to
the slow keys in grl_metadata_source_slow_keys()
|
a metadata source |
|
the list of keys to filter out. [element-type GObject.ParamSpec][transfer container GObject.ParamSpec][allow-none GObject.ParamSpec][inout GObject.ParamSpec] |
|
if TRUE the return value shall be a new list with
the matched keys
|
Returns : |
if return_filtered is TRUE will return the list of intersected keys;
otherwise NULL . [element-type GObject.ParamSpec][transfer container GObject.ParamSpec]
|
Since 0.1.1
GList * grl_metadata_source_filter_writable (GrlMetadataSource *source
,GList **keys
,gboolean return_filtered
);
Similar to grl_metadata_source_filter_supported()
but applied to
the writable keys in grl_metadata_source_writable_keys()
|
a metadata source |
|
the list of keys to filter out. [element-type GObject.ParamSpec][transfer container GObject.ParamSpec][allow-none GObject.ParamSpec][inout GObject.ParamSpec] |
|
if TRUE the return value shall be a new list with
the matched keys
|
Returns : |
if return_filtered is TRUE will return the list of intersected keys;
otherwise NULL . [element-type GObject.ParamSpec][transfer container GObject.ParamSpec]
|
Since 0.1.4
const GList * grl_metadata_source_key_depends (GrlMetadataSource *source
,GrlKeyID key_id
);
Get the list of GrlKeyID which are needed a priori, in order to fetch
and store the requested key_id
|
a metadata source |
|
the requested metadata key. [type GObject.ParamSpec] |
Returns : |
a GList with the keys, or NULL if it can not resolve key_id . [element-type GObject.ParamSpec][transfer none GObject.ParamSpec]
|
Since 0.1.1
const GList * grl_metadata_source_writable_keys (GrlMetadataSource *source
);
Similar to grl_metadata_source_supported_keys()
, but these keys
are marked as writable, meaning the source allows the client
to provide new values for these keys that will be stored permanently.
|
a metadata source |
Returns : |
a GList with the keys. [element-type GObject.ParamSpec][transfer none GObject.ParamSpec] |
Since 0.1.4
void grl_metadata_source_resolve (GrlMetadataSource *source
,const GList *keys
,GrlMedia *media
,GrlMetadataResolutionFlags flags
,GrlMetadataSourceResolveCb callback
,gpointer user_data
);
This is the main method of the GrlMetadataSource class. It will fetch the metadata of the requested keys.
This function is asynchronous and uses the Glib's main loop.
|
a metadata source |
|
the GList of GrlKeyID to retrieve. [element-type GObject.ParamSpec][allow-none GObject.ParamSpec] |
|
Transfer object where all the metadata is stored. |
|
bitwise mask of GrlMetadataResolutionFlags with the resolution strategy |
|
the callback to execute when the media metadata is filled up. [scope notified]
|
|
user data set for the callback
|
Since 0.1.4
GrlMedia * grl_metadata_source_resolve_sync (GrlMetadataSource *source
,const GList *keys
,GrlMedia *media
,GrlMetadataResolutionFlags flags
,GError **error
);
This is the main method of the GrlMetadataSource class. It will fetch the metadata of the requested keys.
This function is synchronous.
|
a metadata source |
|
the GList of GrlKeyID to retrieve. [element-type GObject.ParamSpec][allow-none GObject.ParamSpec] |
|
Transfer object where all the metadata is stored |
|
bitwise mask of GrlMetadataResolutionFlags with the resolution strategy |
|
a GError, or NULL
|
Returns : |
the updated GrlMedia. [transfer full] |
Since 0.1.6
void grl_metadata_source_set_metadata (GrlMetadataSource *source
,GrlMedia *media
,GList *keys
,GrlMetadataWritingFlags flags
,GrlMetadataSourceSetMetadataCb callback
,gpointer user_data
);
This is the main method of the GrlMetadataSource class. It will
get the values for keys
from media
and store it permanently. After
calling this method, future queries that return this media object
shall return this new values for the selected keys.
This function is asynchronous and uses the Glib's main loop.
|
a metadata source |
|
the GrlMedia object that we want to operate on. |
|
a list of GrlKeyID whose values we want to change. [element-type GObject.ParamSpec][allow-none GObject.ParamSpec] |
|
Flags to configure specific behaviors of the operation. |
|
the callback to execute when the operation is finished. [scope notified] |
|
user data set for the callback
|
Since 0.1.4
GList * grl_metadata_source_set_metadata_sync (GrlMetadataSource *source
,GrlMedia *media
,GList *keys
,GrlMetadataWritingFlags flags
,GError **error
);
This is the main method of the GrlMetadataSource class. It will
get the value for key
from media
and store it permanently. After
calling this method, future queries that return this media object
shall return this new value for the selected key.
This function is synchronous.
|
a metadata source |
|
the GrlMedia object that we want to operate on |
|
a list of GrlKeyID whose values we want to change. [element-type GObject.ParamSpec][allow-none GObject.ParamSpec] |
|
Flags to configure specific behaviors of the operation. |
|
a GError, or NULL
|
Returns : |
a GList of keys that could not be updated, or NULL . [element-type GObject.ParamSpec][transfer container GObject.ParamSpec]
|
Since 0.1.6
const gchar * grl_metadata_source_get_id (GrlMetadataSource *source
);
|
a metadata source |
Returns : |
the ID of the source
|
Since 0.1.1
const gchar * grl_metadata_source_get_name (GrlMetadataSource *source
);
|
a metadata source |
Returns : |
the name of the source
|
Since 0.1.1
const gchar * grl_metadata_source_get_description (GrlMetadataSource *source
);
|
a metadata source |
Returns : |
the description of the source
|
Since 0.1.1
"source-desc"
property"source-desc" gchar* : Read / Write / Construct
A description of the source
Default value: ""
"source-id"
property"source-id" gchar* : Read / Write / Construct
The identifier of the source.
Default value: ""
"source-name"
property"source-name" gchar* : Read / Write / Construct
The name of the source.
Default value: ""