libextractor
[Top][All Lists]
Advanced

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

Re: [libextractor] libextractor mime type storage


From: Christian Grothoff
Subject: Re: [libextractor] libextractor mime type storage
Date: Thu, 11 Jan 2007 23:05:52 -0700
User-agent: KMail/1.9.5

On Thursday 11 January 2007 09:40, Justin Wray wrote:
> Hello,
>
>      This may not be the correct place to initiate a question, although
> this address is listed at the bottom of the libextractor homepage.  I have
> noticed there is a mailing list, hosted through the GNU, however it seems
> to be less active now a days.  If I do not hear anything, I'll report this
> to mailing list, as well as contact the authors directly.  Either way,
> thanks in advance for any help.

This is the right place.

>      I am the Project Owner of metashell.  metashell is a command-line
> shell, the difference, metashell uses mime data types to determine how to
> launch a file, instead of forcing the user to type cumbersome commands. 
> For more information on the metashell project, please visit
> http://www.themetashell.com.
>
>      Our project (which is fairly new) plans to use libextractor as the
> library to obtain the mime data types.  Only problem, all the examples, and
> looking through the source of libextractor only point out a way to export
> the "keywords" to the screen.  I need the mime data type to be stored into
> a string/char array.  Does libextractor have a function to do this, or do
> you have any incite on how I should go about doing this?

Yes, trivial:

#include <extractor.h>

char * getMime(const char *  filename) {
 EXTRACTOR_ExtractorList * ex = EXTRACTOR_loadDefaultLibraries();
 EXTRACTOR_KeywordList * kl = EXTRACTOR_getKeywords(ex, filename);
 char * mimetype = strdup(EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE, kl);
 EXTRACTOR_freeKeywords(kl);
 EXTRACTOR_removeAll(ex);
 return mimetype;
}

>      Again, I would like to thank you in advance for your response, I look
> forward to releasing this shell, and using libextractor as the mime data
> type extractor.  If you have any questions or comments, please feel
> absolutely free to email me back directly.

Let me know if you have any further questions.

Christian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]