CHM Thumbnailer



Hi,

I have e-books in the CHM format and I wanted to add a Nautilus
thumbnailer similar to evince-thumbnailer for the PDF format.

While I succesfully wrote a small script to do it with chmlib, I can't
integrate it with Nautilus. I installed a schema and while it appears to
be setup properly, Nautilus isn't calling my script even after being
reloaded.

Here's the script :

#!/bin/bash

input=$1
output=$2

temp=`mktemp -d`
extract_chmLib "$input" "$temp" > /dev/null

thumb=0
max=0

toc=`find "$temp" -iname toc*`
for image in `egrep -o '\w*\.(jpg|jpeg)' "$toc"`
do
        path=`find "$temp" -name "$image"`
        size=`stat --printf=%s "$path"`
        if [ $size>$max ]
        then
                max=$size
                thumb=$path
        fi
done

convert "$thumb" "png:$output"
rm -rf "$temp"


and here's the schema :

<gconfschemafile>
    <schemalist>

        <schema>

<key>/schemas/desktop/gnome/thumbnailers/application x-chm/enable</key>

<applyto>/desktop/gnome/thumbnailers/application x-chm/enable</applyto>
            <owner>chm-thumbnailer</owner>
            <type>bool</type>
            <default>true</default>
            <locale name="C">
                <short></short>
                <long></long>
            </locale>
        </schema>

        <schema>

<key>/schemas/desktop/gnome/thumbnailers/application x-chm/command</key>

<applyto>/desktop/gnome/thumbnailers/application x-chm/command</applyto>
            <owner>chm-thumbnailer</owner>
            <type>string</type>
            <default>chm-thumbnailer.sh %i %o</default>
            <locale name="C">
                <short></short>
                <long></long>
            </locale>
        </schema>

    </schemalist>
</gconfschemafile>

Can anyone test it or spot the problem?

Cheers,
Martin



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