Re: python script as a beagle backend



Hi,

On 8/31/07, Hugo Melo <hugo melo gmail com> wrote:
> I have a script that extracts mails and its informations from a mail
> file and I want to create a backend using it, not reimplementing it
> using C#.
> Does Beagle has a way of do it?

Yes, you can use the "indexing service" for this.  You have two
options: you can use the libbeagle Python API to send the data to the
daemon, or you can drop files into a known location which Beagle will
index automatically.

For the latter, you will need to drop a file with the content of the
message into ~/.beagle/ToIndex.  You will also need to drop a file
along side of it which describes the metadata.  This file has the same
name as the content file, except prepended with a dot.

So, if you have "message-1" with the content, you'll need to also have
a ".message-1" file with the metadata.

The format of that dot-file is like so:

First line: The URI of the data being indexed.  This is the URI used
to open the file later.
Second line: Hit type - You'll want to use MailMessage for this.
Third line: MIME type - this will depend on the content, but you'll
probably want message/rfc822 for this.
Zero or more additional lines: additional metadata properties to set,
in the form "type:key=value", where "type" is either 't' for text or
'k' for keyword.

So one of your files might look like:

file:///home/joe/mymail/folder1/message1
MailMessage
message/rfc822
k:fixme:client=myclient
k:fixme:folder=folder1

If you want to use the API, you can take a look at the libbeagle API
for that.  It should be linked off the wiki.

Joe



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