[MINC-development] MINC previews in nautilus.

Andrew Janke a.janke at gmail.com
Tue May 17 01:55:17 EDT 2011


Figured why can't we have these too...

So for the brave using nautilus (gnome file manager) try this

1. give MINC a mime type:

cai-harold:minc-thumbnailer$ cat x-minc.xml
<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info"
type="application/x-minc">
  <!--Created automatically by update-mime-database. DO NOT EDIT!-->
  <comment>MINC file</comment>
  <glob pattern="*.mnc"/>
</mime-type>

2. Copy it to:

   $HOME/.local/share/mime/application

3. Let xdg know about it:

   $ update-mime-database $HOME/.local/share/mime

4. Test it:

   $ xdg-mime query filetype ~/data/me/a.mnc
   application/x-minc

5. create the gnome gconf magic

   $ gconftool-2 -s
/desktop/gnome/thumbnailers/application at x-minc/command -t string
"/usr/bin/minc-thumbnailer %u %o"
   $ gconftool-2 -s
/desktop/gnome/thumbnailers/application at x-minc/enable -t boolean true

6. create /usr/bin/minc-thumbnailer:

#! /bin/sh
#
# MINC file previewer
#
# Andrew Janke - a.janke at gmail.com

USAGE="[OPTION] <input> <output>
  -h, -?   print this message"

if [ $1 = "-h" ]
then
   echo -e usage: $0 "$USAGE" >&2
   exit 1
fi

infile=${1#file://}
outfile=$2

export PATH=$PATH:/usr/local/bic/bin

/usr/local/bic/bin/mincpik -triplanar -tilesize 100 \
   -horizontal -sagittal_offset_perc 10 "$infile" "png:$outfile"

7. Now you might have to clear out all the old cached pngs from when
nautilus failed to create pngs from MINC files in the past and
couldn't as it didn't know how:

   $ rm -f $HOME/.thumbnails/fail/gnome-thumbnail-factory/*

8. restart nautilus:

   $ nautilus -q

9. Go to a directory with .mnc files in it and bask in your glory.

YMWV and if I can get this to work fairly consistently I will include
it in the mincbundle ubuntu package.  ie: PLEASE PLEASE test this.
I'll upload the various bits and pieces to github soon.




a

refs:
http://wiki.ubuntuusers.de/OpenDocument_Thumbnails
http://jens.triq.net/thumbnail-spec/index.html


More information about the MINC-development mailing list