Re: [Nautilus-list] Nautilus Scripts and MIME types



on 10/9/01 1:03 PM, Ryan Muldoon at rpmuldoon students wisc edu wrote:

> Would it be at all feasible to let Nautilus scripts work for only a
> given MIME type?

The current "work-around" I have found is to do file-type checking
within the script, using the 'file' command. "file -i <filename>" will
return a mime-type and  "file <filename>" a more human-readable
description.  That way, at least you can prevent the script from
processing the wrong type of file.  Its doesn't make the scripts
disappear from the scripts menu when they aren't relevant, but I don't
know if that is as useful as one might think.  For instance, suppose you
have a script that processes text files of any kind (source code, html,
text documents, etc.), but you don't want it to process binary files
(pictures, zip files, executables, etc.)  It is not a simple task to
designate which file types you want and which you don't. Which,
apparently, is why I had to change a half-dozen entries in the mime
database when I wanted to use garchiver instead of guitar.


Example usage of "file" can be found at:

http://www-personal.umich.edu/~smueller/Nautilus-Scripts/

Specifically: 

script to display mimetype:
http://www-personal.umich.edu/~smueller/Nautilus-Scripts/scripts/File_Info/mimetype

script to display filetype:
http://www-personal.umich.edu/~smueller/Nautilus-Scripts/scripts/File_Info/filetype

omnibus printing script that checks for file type and prints the file it
if it knows how to:
http://www-personal.umich.edu/~smueller/Nautilus-Scripts/scripts/File_Processing/pprint


-- 
====================================================
  Shane Mueller                       East Hall 4424
  (734) 647-3698            Cognition and Perception
  smueller umich edu      The University of Michigan
       http://www-personal.umich.edu/~smueller
====================================================





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