[haiku-development] Re: [haiku-commits] Re: haiku: hrev47664 - src/kits/tracker headers/private/tracker

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 19 Aug 2014 01:36:38 +0200

On 08/18/2014 09:48 PM, pulkomandy wrote:
Currently you can't get these infos from the Media Kit. There never was
an API for this, as the idea is to... use file attributes to store the
data, and have apps look for it there.

Huh? How is MediaPlayer doing it then?

Likewise, the translator API doesn't expose the EXIF data from JPEG
files.

It actually does using the BMessage I/O interface; I implemented that a few years ago now :-)

Again, we are already doing node monitoring in Tracker so it's a
matter or calling the right hook functions when a file is created or
the modification time of the file changes.
This has the big downside that just browsing folders becomes an
operation that writes to disk. This is something I'd rather avoid. It
would be surprising to me to discover that the system magically set up
attributes, but only on the folders I opened. This is an operation I'd
rather trigger manually with a tool like ArmyKnife, or handle when a
file is actually played by MediaPlayer.

Please have a look at the index server in our repository. While I'm not sure how far it has gotten, it was pretty much his job to extract info from files to attributes.

Opening a folder already easily causes writing to it, btw. For example when detecting the MIME type of files which is triggered by various actions (IMO it should actually be done when the file is first shown already, as that would be the easiest to understand).

While you and I are used to the current behavior, I don't think it's the best way to do it. It isn't really costly, as it will only happen that one time, anyway.

A simpler solution (implemented in APlayer for example) is to add the
tags to a file when the media player plays it.

This is pretty much the status quo, yes. I don't really like that approach, though, and I often find myself opening movies with MediaPlayer just to let them have their attributes.

You don't need thousands of files in a folder to make this a big
performance hit. Here's a rough outline of what currently happens when
you open a folder:
[...]
Overall, this increases disk access by an order of magnitude.

So what? Why should it do that every time? And when it does it for the first and only time, why should it do it synchronously? MIME type settings also works pretty much instantaneously, and may look into the files, too.

I don't think Tracker should do the job, but it should trigger it just as it does now for identifying files. Just a bit more automatic.

Bye,
   Axel.


Other related posts: