[Clipart] Re: SVG support for getID3

Sarita Crites saritasan2 at gmail.com
Thu Mar 16 20:58:06 PST 2006


On 15 Mar 2006 10:11:11 -0500, Jonadab the Unsightly One
<jonadab at bright.net> wrote:
> Bryce Harrington <bryce at bryceharrington.org> writes:
>
> > > > Hmm, I also notice that mimetype is able to correctly determine the
> > > > SVG-ness of the file:
> > > >
> > > > $ mimetype daggers.svg
> > > > daggers.svg: image/svg+xml
> >
> > It's a perl script written by Japp G. Karssenberg in 2003.  Its manpage
> > mentions the File::MimeInfo module.
>
> Finally got around to looking at this.  It is matching the filename
> against a list of patterns.  Here's the code that's doing it:
>
>        if ($file =~ /\.(\w+(\.\w+)*)$/) {
>                my @ext = split /\./, $1;
>                while (@ext) {
>                        my $ext = join('.', @ext);
>                        print STDERR "> Checking for extension '.$ext'\n" if $DEBUG;
>                        warn "WARNING: wantarray behaviour of globs() will change in the future.\n" if wantarray;
>                        return wantarray
>                                ? ($extension{$ext}, $ext)
>                                : $extension{$ext}
>                                if exists $extension{$ext};
>                        shift @ext;
>                }
>        }
>
> Here is the result:
>
> jonadab at vestibule$ rm test.svg
> jonadab at vestibule$ touch test.svg
> jonadab at vestibule$ mimetype test.svg
> test.svg: image/svg+xml
> jonadab at vestibule$
>
> --
> Open Clip Art Library:  Drawing Together
> http://www.openclipart.org/
>
> _______________________________________________
> clipart mailing list
> clipart at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/clipart
>
Please Remove from all Lists! Thank you.

--
Sarita



More information about the clipart mailing list