OK, I just installed LibMagic... it's a wrapper for libmagic which is a wrapper for an upgraded file command. The new file command is much better than the original but still not perfect. For example, scribus files are reported as ascii text when in fact they are not. However, svg files are now correctly reported as image files. Thanks again for the tip. I will be using this to find the file type when Swish::Filter can't figure it out from the extension.
--Thanks and God bless!
----- Original Message ----
From: Bill Moseley <firstname.lastname@example.org>
To: Swish-e Users Discussion List <email@example.com>
Sent: Monday, July 14, 2008 2:21:16 PM
Subject: Re: [swish-e] Swish::Filter not working?
On Mon, Jul 14, 2008 at 10:21:35AM -0700, firstname.lastname@example.org wrote:
> Is it not working or am I misunderstanding what it's supposed to do? Here's what I did:
> I ran the existing DirTree.pl on some simple files:
> DirTree.pl worked as expected. (Plain.txt was indexed and picture.jpg was skipped because it's a binary.) However, changing the filenames to:
> plain.txt => fake.jpg
> picture.jpg => fake.txt
> completely threw off Swish::Filter. The plain.txt file was no longer indexed and the fake.txt was indexed.
> Isn't Swish::Filter supposed to be using mime types to determine the file type? (and not the extension?)
Yes, it uses content type, but those are coming from the extension.
It only uses the perl module MIME::Types which is a simple lookup.
I think at one point I was using File::LibMagic, but that requires
having the libmagic and database installed which was probably too
restrictive for some users and requires inspecting each file.
Really, SWISH::Filter probably should look for File::LibMagic first,
then try MIME::Types as a fallback.
You could easily hack your version to use that module if you need that
Unsubscribe from or help with the swish-e list:
Help with Swish-e:
Users mailing list
Users mailing list
Received on Tue Jul 15 11:07:19 2008