Pcmanfm keeps deleting and recreating thumbnails

The dedicated forum for PCMan File Manager - http://wiki.lxde.org/en/PCManFM
Posts: 1
Joined: Tue Jan 13, 2015 3:58 pm

Pcmanfm keeps deleting and recreating thumbnails

Postby Nietzsche » Tue Jan 13, 2015 4:03 pm

I wrote a little shell script to handle cbz/cbr thumbnails in Pcmanfm instead of using Evince and every GNOME thing coming with it. The thumbnails are created and can be used normally BUT they seem to be deleted and recreated each time I come across the associated files.

Here's the script:

Code: Select all

#cbz cbr thumbnailer made to be used this way: cbz_thumbnailer.sh input (%i) size (%s) output (%o)
#dependencies: unzip unrar file imagemagick awk


if [ ! -e "$3" ]
    echo "$3 doesn't exist" >> $LOG_FILE
    echo "$3 already exist" >> $LOG_FILE
    exit 1

case $(file -b --mime-type "$1") in
    application/zip )
        FIRST_IMAGE="$(unzip -l "$1" | awk 'NR==4 {print $4}')"
        [ "$FIRST_IMAGE" = "" ] && echo "$1 is empty" >> $LOG_FILE && exit 1
        unzip -p "$1" "$FIRST_IMAGE" > $TMP_FILE
    application/x-rar )
        FIRST_IMAGE="$(unrar lb "$1" | awk 'NR==1')"
        unrar p -inul "$1" "$FIRST_IMAGE" > $TMP_FILE
    * )
        echo "$1 is not a zip nor a rar file" >> $LOG_FILE
        exit 1

case $(file -b --mime-type $TMP_FILE) in
    image/png | image/jpeg )
        convert -define jpeg:size='512x512' $TMP_FILE -thumbnail "$2x$2" "$3"

    * )
        echo "The first file of $1 isn't an image (png/jpeg)" >> $LOG_FILE
        exit 1

rm "$TMP_FILE"

And here's the file in /usr/share/thumbnailers:

Code: Select all

[Thumbnailer Entry]
Exec=cbz_cbr_thumbnailer.sh %i %s %o

I even tried to log the result of ls -Al /home/user/.thumbnails/normal at the beginning of the script, and the displayed thumbnails are indeed destroyed before calling it.

I'm at loss for words. Thanks for your attention.

Posts: 49
Joined: Sat Nov 05, 2011 5:48 pm

Re: Pcmanfm keeps deleting and recreating thumbnails

Postby LStranger » Sat May 09, 2015 12:19 pm

PCManFM stores file's modification time in the thumbnail so next time when it see that file it compares its modification time with saved value and if the file has different modification time then thumbnail will be regenerated. Do your files have not changed between visiting the folder?

Return to “PCManFM”

Who is online

Users browsing this forum: No registered users and 1 guest