Hello everybody, recently I've been working on a set of scripts for pre-generating thumbnails of video and picture files in a set of given directories. The idea is to be able to run thumbnail-generation in the background, per cron, per cmdline, not-in-X, not-using-nautilus, etc. I've been reading a lot of documentation regarding this topic and I think I have come quite far in understanding all the details and requirements. However I still need a little help (obviously...), but first, let me share my work with you... Here is my three scripts: batch_thumbnailer: http://pastebin.com/Z0QNz0Eb vids_thumbnailer: http://pastebin.com/e4mQ4Lca pics_thumbnailer: http://pastebin.com/fd6yUUHM batch_thumbnailer is the main scripts that calls vids+pics_thumbnailer, if in $PATH. The syntax is: batch_thumbnailer [<dir> ...] What it does is basically: 1. search the given directories (non-recursive) for files 2. determine the files mimetype and filter out all of type video/*, image/* 3. create a batch list for video files and process it with vids_thumbnailer 4. create a batch list for picture files and process it with pics_thumbnailer The steps 3 and 4 are similar and can be broken down in sub-steps: a. for each file, determine absolute path (file -> /path/to/file) b. for each file, determine URI (/path/to/file -> file:///path/to/file) c. for each URI, determine MD5 checksum (echo -n file:///path/to/file | md5sum | cut -c -32) d. for each file, determine modification time (file.mtime = $(stat -c "%Y" file)) e. for each file, store a thumbnail under $HOME/.thumbnails/normal/$MD5.png with required metadata Thumb::URI := $URI and Thumb::MTime := file.mtime (f.) if thumbnail generation has failed, move thumbnail to $HOME/.thumbnails/fail[/$0]/$MD5.png The one place to start reading about thumbnails is probably: [1] http://jens.triq.net/thumbnail-spec/ So that's that. Now I've created a whole batch of thumbnails with my scripts, however my problem is that nautilus is still recreating every single media file when I change to it's directory. I notice this because obviously it takes some time to display the thumbnails and also the mtime of the thumbnail is updated when re-/overwritten. My idea in the first place was to have the thumbnails created and then nautilus is just displaying them superfast, since they already exist. However, this is not the case. I spent some time figuring out the differences between my thumbnails and nautilus thumbnails, but I cant really tell the differences nor explain the "overwriting/recreating" behavior of nautilus. What I have tried so far is, I noticed another optional tag in the pings "Software: GNOME::ThumbnailFactory" and recreated that in my scripts, ... still with no change. Nautilus seems to allways overwrite my thumbnails. That makes me wanna stop any further work on my scripts, because I must first know what the real problem is or else I waste my time. FYI, these are my thumbnailers in nautilus (gconf-editor -> /desktop/gnome/thumbnailers/...): - image x-pict := /usr/bin/gm convert -size %s -resize %s +profile "*" %i[0] %o - video@<any> := /usr/bin/ffmpegthumbnailer -s %s -c png -f -t 50%% -i %i -o %o I would like to know in what way GNOME's thumbnail creation standard differs from the one described in [1] or whether nautilus/gnome stores extra-information elsewhere (outside $HOME/.thumbnails). My goal is the pre-create thumbnails in my scripts, that nautilus can actually use and instantly display, without re-creation/overwrites. Thank you for all support, answers and feedback in advance, it's all welcome. Bye, Pasxalis. PS: I've been forwarded to nautilus-list gnome org from gnome-list gnome org: http://mail.gnome.org/archives/gnome-list/2010-October/msg00009.html |