FAM/inotify/dnotify support for beagle

Hi -
I'd like to add in support for watching specific directories and
automatically updating the metadata for contained files. My current plan
is to just watch specific directories - either hard-coded (like
'~/Documents' '~/Photos' '~/Music' etc.) or folders/paths stuck in a
gconf key. Metadata wouldn't be queried immediately following events -
the daemon would wait until the file was inactive for at least a couple
of seconds before initiating an indexing run on it.
I'm writing this to the list before I start working on it as I have a
couple of questions / concerns - 

Does anyone know of a way to recursively monitor directories for file
changes (or even just creations)? I've seen this referred to as
'hierarchical monitoring' (in places like release anouncements for
inotify), but all mentions say that such a feature hasn't been
implemented yet. This would be the ideal for beagle to use, but in its
absence we can either monitor every directory in a users homedir (I've
seen references to this as being bad/slow/etc.) or only monitor certain

Thus, my second concern/question - how do we choose what directories to
monitor? My idea would just be to monitor a couple of specific
directories (like '~/Documents'), and possibly recurse down a couple of
levels in monitoring (so '~/Documents/School/' would be monitored). A
possible solution/alternative to hard-coding directories would be for
beagle-update-index to mark metadata-rich directories (so > 50%
indexable) as watchable, but I think this could have a lot of issues.
Or, instead of (or in addition to) monitoring directories that are
metadata-rich, monitor dirs that show a lot of activity (so at least a
couple of indexable files change between every indexing).

Another possible solution is to monitor all indexed files beagle knows
of, and update their metadata as necessary upon changes, and thus use
beagle-update-index only to add in new files.

I'm probably going to start writing some basic code for this within the
next couple of days (I'm finishing up a panel applet for beagle which
I'll send in to the list pretty soon).

-- Matt Jones

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