TrackerDecorator

TrackerDecorator — A miner tasked with listening for DB resource changes and extracting metadata

Synopsis

#include <libtracker-miner/tracker-miner.h>

struct              TrackerDecorator;
struct              TrackerDecoratorClass;
                    TrackerDecoratorInfo;
void                tracker_decorator_delete_ids        (TrackerDecorator *decorator,
                                                         gint *ids,
                                                         gint n_ids);
const gchar **      tracker_decorator_get_class_names   (TrackerDecorator *decorator);
const gchar *       tracker_decorator_get_data_source   (TrackerDecorator *decorator);
guint               tracker_decorator_get_n_items       (TrackerDecorator *decorator);
GType               tracker_decorator_get_type          (void);
const gchar *       tracker_decorator_info_get_mimetype (TrackerDecoratorInfo *info);
TrackerSparqlBuilder * tracker_decorator_info_get_sparql
                                                        (TrackerDecoratorInfo *info);
GTask *             tracker_decorator_info_get_task     (TrackerDecoratorInfo *info);
const gchar *       tracker_decorator_info_get_url      (TrackerDecoratorInfo *info);
const gchar *       tracker_decorator_info_get_urn      (TrackerDecoratorInfo *info);
void                tracker_decorator_next              (TrackerDecorator *decorator,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
TrackerDecoratorInfo * tracker_decorator_next_finish    (TrackerDecorator *decorator,
                                                         GAsyncResult *result,
                                                         GError **error);
void                tracker_decorator_prepend_ids       (TrackerDecorator *decorator,
                                                         gint *ids,
                                                         gint n_ids);

Object Hierarchy

  GObject
   +----TrackerMiner
         +----TrackerDecorator
               +----TrackerDecoratorFS

Implemented Interfaces

TrackerDecorator implements GInitable.

Description

Details

struct TrackerDecorator

struct TrackerDecorator;

Abstract miner object.


struct TrackerDecoratorClass

struct TrackerDecoratorClass {
	TrackerMinerClass parent_class;

	void (* items_available) (TrackerDecorator *decorator);
	void (* finished)        (TrackerDecorator *decorator);
};

An implementation that takes care of extracting extra metadata specific to file types by talking to tracker-extract.

Based on TrackerMinerClass.

TrackerMinerClass parent_class;

parent object class.

items_available ()

Called when there are resources to be processed.

finished ()

Called when all resources have been processed.

TrackerDecoratorInfo

typedef struct _TrackerDecoratorInfo TrackerDecoratorInfo;

tracker_decorator_delete_ids ()

void                tracker_decorator_delete_ids        (TrackerDecorator *decorator,
                                                         gint *ids,
                                                         gint n_ids);

Deletes resources needing extended metadata extraction from the queue. IDs parsed in ids are based on the same IDs emitted by tracker-store when the database is updated for consistency. For details, see the GraphUpdated signal.

decorator :

a TrackerDecorator.

ids :

an array of IDs.

n_ids :

size of ids array.

Since 0.18


tracker_decorator_get_class_names ()

const gchar **      tracker_decorator_get_class_names   (TrackerDecorator *decorator);

This function returns a string list of class names which are being updated with extended metadata. An example would be 'nfo:Document'.

decorator :

a TrackerDecorator.

Returns :

a const gchar** or NULL. [transfer none]

Since 0.18


tracker_decorator_get_data_source ()

const gchar *       tracker_decorator_get_data_source   (TrackerDecorator *decorator);

The unique string identifying this TrackerDecorator that has extracted the extended metadata. This is essentially an identifier so it's clear WHO has extracted this extended metadata.

decorator :

a TrackerDecorator.

Returns :

a const gchar* or NULL if an error happened.

Since 0.18


tracker_decorator_get_n_items ()

guint               tracker_decorator_get_n_items       (TrackerDecorator *decorator);

decorator :

a TrackerDecorator.

Returns :

the number of items queued to be processed, always >= 0.

Since 0.18


tracker_decorator_get_type ()

GType               tracker_decorator_get_type          (void);

tracker_decorator_info_get_mimetype ()

const gchar *       tracker_decorator_info_get_mimetype (TrackerDecoratorInfo *info);

A MIME¹ type is a way of describing the content type of a file or set of data. An example would be 'text/plain' for a clear text document or file.

¹: http://en.wikipedia.org/wiki/MIME

info :

a TrackerDecoratorInfo.

Returns :

the MIME type for TrackerDecoratorInfo on success or NULL on error.

Since 0.18


tracker_decorator_info_get_sparql ()

TrackerSparqlBuilder * tracker_decorator_info_get_sparql
                                                        (TrackerDecoratorInfo *info);

A TrackerSparqlBuilder allows the caller to extract the final SPARQL used to insert the extracted metadata into the database for the resource being processed.

This function calls g_task_get_task_data() on the return value of tracker_decorator_info_get_task().

info :

a TrackerDecoratorInfo.

Returns :

a TrackerSparqlBuilder on success or NULL on error. [transfer none]

Since 0.18


tracker_decorator_info_get_task ()

GTask *             tracker_decorator_info_get_task     (TrackerDecoratorInfo *info);

When processing resource updates in the database, the GTask APIs are used. This function returns the particular GTask used for info.

info :

a TrackerDecoratorInfo.

Returns :

the GTask on success or NULL on error. [transfer none]

Since 0.18


tracker_decorator_info_get_url ()

const gchar *       tracker_decorator_info_get_url      (TrackerDecoratorInfo *info);

A URL is a Uniform Resource Locator and should be a location associated with a resource in the database. For example, 'file:///tmp/foo.txt'.

info :

a TrackerDecoratorInfo.

Returns :

the URL for TrackerDecoratorInfo on success or NULL on error.

Since 0.18


tracker_decorator_info_get_urn ()

const gchar *       tracker_decorator_info_get_urn      (TrackerDecoratorInfo *info);

A URN is a Uniform Resource Name and should be a unique identifier for a resource in the database.

info :

a TrackerDecoratorInfo.

Returns :

the URN for TrackerDecoratorInfo on success or NULL on error.

Since 0.18


tracker_decorator_next ()

void                tracker_decorator_next              (TrackerDecorator *decorator,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Processes the next resource in the queue to have extended metadata extracted. If the item in the queue has been completed already, it signals it's completion instead.

This function will give a GError if the miner is paused at the time it is called.

decorator :

a TrackerDecorator.

cancellable :

a GCancellable.

callback :

a GAsyncReadyCallback.

user_data :

user_data for callback.

Since 0.18


tracker_decorator_next_finish ()

TrackerDecoratorInfo * tracker_decorator_next_finish    (TrackerDecorator *decorator,
                                                         GAsyncResult *result,
                                                         GError **error);

Should be called in the callback function provided to tracker_decorator_next() to return the result of the task be it an error or not.

decorator :

a TrackerDecorator.

result :

a GAsyncResult.

error :

return location for a GError, or NULL.

Returns :

(boxed): a TrackerDecoratorInfo on success or NULL on error. [transfer full]

Since 0.18


tracker_decorator_prepend_ids ()

void                tracker_decorator_prepend_ids       (TrackerDecorator *decorator,
                                                         gint *ids,
                                                         gint n_ids);

Adds resources needing extended metadata extraction to the queue. IDs parsed in ids are based on the same IDs emitted by tracker-store when the database is updated for consistency. For details, see the GraphUpdated signal.

decorator :

a TrackerDecorator.

ids :

an array of IDs.

n_ids :

size of ids array.

Since 0.18

See Also

TrackerDecoratorFSTrackerDecorator watches for signal updates based on file changes in the database. When new files are added initially, only simple metadata exists, for example, name, size, mtime, etc. The TrackerDecorator queues files for extended metadata extraction (i.e. for tracker-extract to fetch metadata specific to the file type) for example 'nmm:whiteBalance' for a picture.