Re: [Tracker] Using tracker extractors from other applications
- From: Nikolaus Rath <Nikolaus rath org>
- To: tracker-list gnome org
- Subject: Re: [Tracker] Using tracker extractors from other applications
- Date: Wed, 17 Nov 2010 10:16:29 -0500
Martyn Russell <martyn-bhGbAngMcJvQT0dZR+AlfA public gmane org> writes:
On 17/11/10 00:02, Nikolaus Rath wrote:
Hello,
Hi,
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
For examples, see how miner-fs uses it:
http://git.gnome.org/browse/tracker/tree/src/miners/fs/tracker-miner-files.c#n2045
Ok, I came up with the following code:
bus = dbus.SessionBus()
proxy = bus.get_object('org.freedesktop.Tracker1.Extract',
'/org/freedesktop/Tracker1/Extract')
tracker = dbus.Interface(proxy, 'org.freedesktop.Tracker1.Extract')
tracker.GetMetadata('file:///home/nikratio/misc/Transaktionen.ods',
'application/vnd.oasis.opendocument.spreadsheet')
This gives me the following result:
(dbus.String(u''),
dbus.String(u' a nfo:PaginatedTextDocument ;\n\t nie:contentCreated
"2009-11-07T20:21:16" ;\n\t nco:publisher [ a nco:Contact ;\n\t
nco:fullname "Nikolaus Rath"] ;\n\t nie:generator
"OpenOffice.org/3.2$Linux OpenOffice.org_project/320m12$Build-9483"
;\n\t nie:plainTextContent "\\n ////Datum[....]'))
So it seems that I still have to parse the entire string. Is there a way
to get the data in more structured form?
Also, with a plain text document
tracker.GetMetadata('file:///home/nikratio/misc/Victoria.tex', 'text/plain')
I do not get any contents:
(dbus.String(u''), dbus.String(u' a nfo:PlainTextDocument .\n'))
Am I doing something wrong?
And finally, is there a way to omit the mime type and have tracker
determine it automatically?
Thanks!
-Nikolaus
--
ÂTime flies like an arrow, fruit flies like a Banana.Â
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]