Re: [Tracker] Question about retrieving Tracker‘s detailed indexing information



On 18/10/13 09:27, chen bin wrote:
Hi guys,

Hello Chen,

I am using Tracker to implement a service to retrieve the metadatas of
musics under a given path. I want to notify the upper layers the
indexing process by emitting some signals to them.
I was requested to emit the URI of file being processed during the
indexing process, and I have implement the indexing of a given path by
using tracker_miner_manager_index_file.  However, I have no idea how to
get the file being processed, but I noticed a signal "process-file" of
TrackerMinerFS. Can I use it to implement my function? If yes, can you
give me some hints to implement it?

Sadly not. That signal is given by libtracker-miner, which is a generic crawling / mining library. The "process-file" signal is used by miners that use libtracker-miner (like tracker-miner-fs) to know when a file is processed.

We do have a kind of status system, but not to the file level. If you look at tracker-control, you will see we can follow status for all miners there with:

  tracker-control -F

Here is the source for that:


https://git.gnome.org/browse/tracker/tree/src/tracker-control/tracker-control-status.c#n507

This will give you *progress* (between 0.0 and 1.0) and a *status*, but sadly, what the miners tell you is not standardised. We do try to stick to some common statuses which you can see with:

  $ tracker-control -C
  Common statuses include:
    Unavailable
    Initialising
    Processing…
    Fetching…
    Crawling single directory '%s'
    Crawling recursively directory '%s'
    Paused
    Idle

But sadly, we don't cover the file level because we would be spamming dbus with signals constantly.

HOWEVER, :) you could periodically poll the database to see which files have been updated/added. Something like this might work:

$ tracker-sparql -q "select nie:url(?p) nie:url(?f) tracker:added(?f) where { ?f a nfo:FileDataObject ; nfo:belongsToContainer ?p . FILTER(fn:starts-with(nie:url(?p),'file:///home/martyn/Pictures')) } ORDER BY DESC tracker:added(?f) LIMIT 5"
Results:
file:///home/martyn/Pictures, file:///home/martyn/Pictures/bar.txt, 2013-10-18T14:24:11Z file:///home/martyn/Pictures/desktop, file:///home/martyn/Pictures/desktop/IMG_8151.JPG, 2013-10-11T07:20:45Z file:///home/martyn/Pictures/desktop, file:///home/martyn/Pictures/desktop/IMG_8152.JPG, 2013-10-11T07:20:45Z file:///home/martyn/Pictures/desktop, file:///home/martyn/Pictures/desktop/IMG_8153.JPG, 2013-10-11T07:20:45Z file:///home/martyn/Pictures/desktop, file:///home/martyn/Pictures/desktop/IMG_8154-small.JPG, 2013-10-10T14:23:43Z

So you can see all files ordered by when they were added filterd by a prefix and limited by 5 or whatever you want.

If you need better granularity, you can listen to the tracker-store's signals for updating the graph. There is a wiki page on this here:

  https://wiki.gnome.org/Tracker/Documentation/SignalsOnChanges

Hope this helps, :)

--
Regards,
Martyn

Founder & Director @ Lanedo GmbH.
http://www.linkedin.com/in/martynrussell


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