Fixing Thumbnails in Nautilus

Where the h@$#$ are my thumbnails?If you are like me and many other internet users, you’ve probably downloaded movies with one P2P program or another.

If you did that downloading while using Nautilus and Gnome, you might have noticed that Nautilus fails to produce Thumbnails for downloaded movies, presenting the film-roll Icon instead.

What happens here, is that Nautilus attempts to generate thumbnails for files as soon as you enter the directory that contains them, when it comes to files that are only halfway-downloaded it fails for obvious reasons.

The problem is that when Nautilus fails to generate a thumbnail, that failure is noted down somewhere, and therefore Nautilus does not attempt to regenerate the thumbnail once the file is fully downloaded.

With this being a Linux-based system, and therefore very easy to tweak and script, it occurred to me that I might be able to somehow work around or fix the problem, so I set out to figure how exactly does Nautilus handle thumbnails.

As it turns out, Nautilus implements the “Thumbnail Managing Standard”, developed by the project, along with many other useful specifications, and should be available here.

Since I seem to have some problems accessing the Specification at the link specified above (Access forbidden? Whats with that? Its supposed to be a public specification, no?), I’ve used the “Way Back Machine” and accessed the specification here.

According to the specification, Nautilus stores thumbnails in the “.thumbnails/normal” and “.thumbnails/large” directories in the user’s home directory as PNG image files whose names are the hexadecimal representation of the MD5 digest of the original file’s URI (don’t worry if you didn’t get this part, its not that important).

When Nautilus fails to generate a thumbnail, it stores a “false” thumbnail (an empty image) in the “.thumbnails/fail/gnome-thumbnail-factory” directory, therefore, erasing the content of that directory will cause Nautilus to “forget” all the thumbnails it failed to generate and thereby attempt to regenerate them (In fact, other graphical programs such as Gimp may register failures in other directories under “.thumbnails/fail” therefore one may want to delete that directory’s entire contents).

I if you’ve been following along so far, it may occur to you already that one way around our thumbnail woes is to simply have some kind of a cron job periodically erase the files in “.thumbnails/fail“, however, since we are discussing GUI applications here, I personally would like a more interactive solution.

What I have in mind, is some kind of a “Regenerate Thumbnail” right-click action in Nautilus, this is not difficult to achieve with a Nautilus script, and in fact I did just that and published the script here.

Since it was simpler to write that way, my script actually looks for and deletes the thumbnails for selected files in all the directories under “.thumbnails“, therefore, it can be also used to trigger regeneration of successfully-created thumbnail.

I chose to write a Python rather then a shell script due to Python’s built-in MD5 support, I didn’t want the script to require the user to have some kind of a command-line MD5 tool installed, also, Python seems to be ubiquitous enough on Gnome desktops with many Gnome system utilities actually implemented with that language.

If you are having difficulties figuring out how to actually install the script, you may want to check the instruction I gave for installing the delete_as_root.bash script.

Nautilus isn’t perfect, no piece of software ever is, what makes it an awesome file manager in my opinion, is the fact that it is just customizable enough to allow one to work around its weaknesses.


6 thoughts on “Fixing Thumbnails in Nautilus

  1. Awesome . Just as I was about to code this behaviour with python (which I know near to nothing about).
    I hope this one goes upstream or at least in distributions.


  2. Pingback: Arreglando las miniaturas (thumbnails) de Nautilus « El Blog de rubensa

  3. Pingback: Regenerating nautilus thumbnails

  4. Pingback: Nautilus – Recrear miniaturas « Blogging googling

  5. I hate to break it to you, but you can also just hit F2 to rename the file, change one letter (and change it back if you like) or rename it accordingly, and Nautilus will produce a thumbnail in seconds. Thank you, however, for confirming my reasoning and logic behind why this behavior was occurring.

    • Take a look at the date of the post, Nautilus was very different 3 years ago… It seems that recent versions use file change monitoring to avoid this problem altogether…
      Thanks for the comment though.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s