[haiku-development] Re: Any interest in an advanced MIME db replacement?

  • From: Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 7 Feb 2017 17:56:55 +0100

Hi,

On Tue, Feb 7, 2017 at 4:56 PM, Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
wrote:

7 février 2017 16:45 "Dario Casalinuovo" <b.vitruvio@xxxxxxxxx> a écrit:



* Binary and textual files are distinguished from start being one or the
other category (this has
nothing to do with the filetype section though)

Do you handle various text file encodings? Because not everything text
looks like ASCII (UTF16, EBCDIC, ...).


Actually I'm using a fairly simple rule like "if there's a nul character
then it's a binary", that's just what other tools like grep use too. I'm
mostly concerned at the abstract parsing model right now more than specific
details. I will look into that, thanks for pointing out!



* Binary files are recognized by the magic number or defaults to generic
binary type otherwise.

Our MIME rules can scan up to the first 512 bytes of the file, and even
that is sometimes barely enough to detect the format. Our sniffing rules
can do things a little more flexible than just recognizing a fixed magic
number.


I've just pointed out the generic features of the project, I will look into
it too.



* Textual files are recognized using prebuilt (made by human or machine
generated) rules or
defaults to plain text otherwise.

I have the freedom to release it as an open source library (possibly
LGPL), so I'm wondering, is
there any interest having something like that integrated in Haiku?
As long as I'm in an early stage I can make things works on both linux
and Haiku.

Why not?
I don't know from your short description how far you plan to go. If it
does as good as our existing MIME sniffer or better, and it is as fast, we
would definitely replace the MIME sniffer with something more powerful. The
transition would be easier if there is some tool to convert our existing
MIME rules to the new format, however. Or maybe we can make something where
the MIME sniffing can be made by several add-ons, and the existing MIME
sniffer and your new tool can collaborate?


I'm not entirely sure there's any need to have a custom format or multiple
add-ons.

My general aim is to make something that can be used everywhere, but it's
entirely possible to work out the code in a way it will stay backward
compatible.

Bye,
Dario

Other related posts: