Re: Better PDF/PS/Dia thumbnailers



OK, this thread kind of died a while ago, but I thought I should write
the end of it now that I got over some Uni work which really needed to
be done.

On Tue, 2003-03-25 at 19:52, Alexander Larsson wrote: 
> On 25 Mar 2003, Peter Harvey wrote:
> 
> > 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?).
> 
> 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?

All my experiments couldn't repeat the problem. However, I did find that
I could get an equivalent problem to happen with gv. When writing to a
PostScript file, gv would sometimes fail to refresh properly (it'd just
have a blank screen). Then, on a few occasions when writing to the file,
it would print some weird message saying that the file was corrupt. I
think what's happening is that gs was failing with a non-zero exit value
occasionally. By putting an "exit 0" at the end of each script, I think
it should solve the problem. One day I really should download the
nautilus source though...

>  
> > 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.

Yep, %s works. But I would have thought that %i would expand to a
filename. I get the following instead. If it really is supposed to be a
file URL, not a filename, just tell me to shutup:

harvey samwise:~$ gconftool-2 -a /desktop/gnome/thumbnailers/application postscript
 command = gnome-thumbnail-postscript %i %o %s
 enable = true

harvey samwise:~$ touch algorithms.ps ; ps -u harvey -o pid,ppid,args |grep thumb
 6880  6407 grep thumb
 6881  6878 /bin/sh /usr/local/bin/gnome-thumbnail-postscript file:///home/harvey/algorithms.ps /tmp/.gnome_thumbnail.NwI8ws 128
 6882  6881 /bin/sh /usr/local/bin/gnome-thumbnail-postscript file:///home/harvey/algorithms.ps /tmp/.gnome_thumbnail.NwI8ws 128


I also had a problem previously with 3 instances of "/bin/sh
gnome-thumbnail-postscript" being run for every time I touched a file.
Well, now it's down to 2 instances. Still don't know why. Again, I
should probably look at the code myself when I have the time.

Thanks.

-- 
Peter Harvey <pah06 uow edu au>





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