Re: [Tracker] Using tracker extractors from other applications



On 17/11/10 02:59, Nikolaus Rath wrote:
Martyn Russell<martyn-bhGbAngMcJvQT0dZR+AlfA public gmane org>  writes:
I would like to use tracker's apparently quite extensive data-extraction
facilities in my own program. It seems that "tracker-extract -f<file>"
provides all the functionality that I want, but I am wondering if there
is a way to avoid having to re-parse output.

The -f command line is a convenience for testing. There is a d-bus API
you can use which tracker-miner-fs uses, for the spec see:

http://git.gnome.org/browse/tracker/tree/data/dbus/tracker-extract.xml

Will this work if the file that I'm interested is not included in the
tracker database? Because I would like to use really just the extractor,
without having the files being indexed by tracker.

Yes, it doesn't put the data into the database for you at all and the file doesn't have to exist in the database OR on disk ;) (i.e. it handles cases where the file is missing)

The miner-fs does the task of taking the data and inserting it into the database for you.

I should add, we use the "Fast" interface, which uses file descriptor
passing to avoid memory fragmentation and copious copying. There is
also a non-fast API you can use for testing purposes or if you're not
intending to send/receive a lot of requests anyway (though we
discourage it generally if possible).

I will be using the Python dbus API, I'm not sure if this will allow fd
passing. But requests will only be generated one at a time by explicit
user interaction, so I hope that this will not be a problem.

Good question. Ivan any comment to add here?

The requests should be fine one at a time, there is no other way to do it.

It would also be nice if there would be a way to process multiple files
without having to start a new tracker-extract instance for every file.

Using d-bus you shouldn't need to worry about the invocation of
tracker-extract.

In that case I believe that I still need to start (and then stop) a
tracker instance that will provide the dbus service though...?

No. Calling the d-bus API will automatically start tracker-extract for you if it isn't already running. With tracker-extract we also automatically shutdown after 30 seconds of inactivity, so instantiation must work from using the API.

--
Regards,
Martyn



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]