Re: Better PDF/PS/Dia thumbnailers



On 25 Mar 2003, Peter Harvey wrote:

> On Tue, 2003-03-25 at 01:52, Alexander Larsson wrote:
> > On 20 Mar 2003, Peter Harvey wrote:
> > 
> > > Hi all,
> > > 
> > > Since I have a large collection of PostScript and PDF files I found the
> > > thumbnailers posted (by Keith Conger?) very useful, but not fast enough.
> > > So I have modified them to improve both quality and speed. When
> > > installed these new scripts provide nice 128x128 thumbnails for:
> > >  - PDF files
> > >  - PostScript files
> > >  - Dia diagrams
> > 
> > Uhm. Doesn't all these scripts generate 80x80 thumbnails?
> 
> Thanks for that. :) I used to have them generating 128x128 thumbnails,
> but changed it to 80x80 because they were too large - I wanted them the
> same size as my desktop icons, which are all 64x64. I've updated the
> scripts (and the description with them) to use the %s thing you
> mentioned. However, it doesn't seem to be working for me, so I won't
> upload the (minor) changes just yet. The following dumps from my
> terminal should show that:
> 
> harvey samwise:~$ gconftool-2 -a /desktop/gnome/thumbnailers/application pdf
>  command = gnome-thumbnail-pdf %u %o %s
>  enable = true
> 
> harvey samwise:~$ touch CPLEX75_getstart.pdf ; ps -u harvey -o pid,args |grep thumbnail
>  1795 /bin/sh /usr/local/bin/gnome-thumbnail-pdf file:///home/harvey/CPLEX75_getstart.pdf /tmp/.gnome_thumbnail.rPMIHR
>  1797 grep thumbnail
>  1798 /bin/sh /usr/local/bin/gnome-thumbnail-pdf file:///home/harvey/CPLEX75_getstart.pdf /tmp/.gnome_thumbnail.rPMIHR
>  1799 /bin/sh /usr/local/bin/gnome-thumbnail-pdf file:///home/harvey/CPLEX75_getstart.pdf /tmp/.gnome_thumbnail.rPMIHR

That's strange. It should work... Lemme look at it.

> Not only is the script not being run with the size argument, it's also
> being run 3 times following a single touch. I've noticed that sometimes
> files which are currently being written to (by pdflatex or dvips for
> example) don't end up with a thumbnail. Probably because the file was
> finished *while* the script was running (haven't downloaded the Nautilus
> source, so can't verify this). There may be some problems with the way
> Nautilus handles file updated (reported by fam, right?).

That looks very strange. It should only redo it once if you touch it. And 
looking at the code it seems like it can't launch it several times with 
the same temp-name. I need to experiment a bit with this.

There can be some problems when writing files due to fam. If the first 
thumbnailing starts when the file is not finished the thumbnailing may 
fail. Then a failed-thumbnailing file will be written, so the file won't 
be thumbnailed again. However, if the file is later written to the mtime 
should change and the thumbnail be rewritten. There might be a race 
condition here though, since mtime only have seconds resolution. Can you 
experiment a bit and see how it is failing?
 
> Where can I find a list of the arguments which can be passed to my
> scripts? Is %u %o and %s all there are? Also, what would be the
> recommended way to specify that thumbnails should be around the same
> size as my icons?

%u expands to the uri of the source file, %i expands to the filename of 
the source file (which means the script will be called on local files 
only), %o is the output filename, and %s is supposed to be the target 
thumbnail size.

The thumnbail spec says thumbnails are supposed to be 128x128, and the app 
is meant to scale it to the size it wants. Nautilus currently scales all 
thumbnails 96x96 (at 100% zoom level), in order to make it easier to see 
how they look. This can't be changed at the moment.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an ungodly playboy sorceror who must take medication to keep him sane. 
She's a pregnant thirtysomething magician's assistant who dreams of becoming 
Elvis. They fight crime! 




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