Re: using deprecated gnome_mime instead of gnome_vfs_mime (was file moniker patch)
- From: Michael Meeks <michael helixcode com>
- To: Darin Adler <darin eazel com>
- Cc: Miguel de Icaza <miguel helixcode com>, gnome-components-list gnome org, gnome-vfs helixcode com
- Subject: Re: using deprecated gnome_mime instead of gnome_vfs_mime (was file moniker patch)
- Date: Thu, 30 Nov 2000 17:46:54 -0500 (EST)
Hi,
On Thu, 30 Nov 2000, Darin Adler wrote:
> Why do you call the MIME database and MIME sniffing a trivial hack?
> It's a piece of code that's hard to get right, and we've been working
> on making it better for months.
This reminds me ( on a totaly different track ); I was recently
reading through some parts of the gnome-vfs api and I noticed these APIs:
const char *gnome_vfs_get_mime_type_for_buffer
(GnomeVFSMimeSniffBuffer *buffer);
I assume this function uses the mime magic information to try and
determine the type, and returns NULL if it can't characterize it
precicely. Then I saw:
gboolean gnome_vfs_sniff_buffer_looks_like_text
(GnomeVFSMimeSniffBuffer *buffer);
And I thought fair enough, perhaps text is a very special case for
sniffing; then I saw:
gboolean gnome_vfs_sniff_buffer_looks_like_mp3
(GnomeVFSMimeSniffBuffer *buffer);
And I was slightly worried. Are we going to gather a great series
of looks_like_my_grandma type calls ? or should the (fuzzy) sniffing API
be something like:
gboolean gnome_vfs_sniff_buffer_looks_like (buffer, char *mime_type);
So; then I looked at the implementation to try and work out what's
going on and I see in the get_mime_type_for_buffer function:
/* if no match, try the algorithmic sniffers */
if (gnome_vfs_sniff_buffer_looks_like_mp3 (buffer)) {
return "audio/x-mp3";
}
But no sniff for text.
And it looks ( from the comment ) as if a more general framework
was intended, with perhaps pluggable mime type sniffers; is this the
case? it would seem more reasonable ( to me ), to register a list of
sniffer functions that could be handled genericly, perhaps with a degree
of certainty ranking depending on how smelly the stream is to them ?
Regards,
Michael.
--
mmeeks gnu org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]