Work in progress

This site is currently undergoing an update. If you spot any problems on this page, please let me know.

Regenerating nautilus thumbnails

Sometimes nautilus will try to generate a thumbnail for a video file while it’s downloading. Then  nautilus remembers that it tried, and failed, to generate a thumbnail for that file. Once the file has finished downloading, the thumbnail remains broken. I’ve had this issue for a while, today I chose to find a solution.

I found this post by Barak Korren. Barak wrote a short nautilus script in python to allow the easy deletion of a thumbnail in Nautilus. Here’s a step by step guide to getting it working.

Download this file and put it into your ~/.gnome2/nautilus-scripts directory. The script is by Barak, I uploaded a plain text version here to make it easier to download. Make the script executable, you can run chmod +x ~/.gnome2/nautilus-scripts/ in a terminal to do this. Now go to that directory in Nautilus, and you’re in business.

To test, right click on a file with a thumbnail. You should see a new menu, Scripts, under which you’ll see “”. Click that option and the thumbnail will be deleted. Press F5 to reload the folder in nautilus, and you should see a new thumbnail generated.

Thanks for a such a handy script Barak.


gastroenteritis at 2010-06-14 15:05:55

The scheduled/automated check would occur immediately after the full image download completes, and compare the time stamp of the original to the TN. I assumed the TNs are only legitimately created _after_ the full image download completes. So somehow you config Naut to always create a TN _after_ a full image landing completes, and immediately before that TN creation, it also checks for, and deletes any existing TN it might find. I probably don't understand perfectly clearly how Naut behaves. It sounded like it tries to create a TN before the image download flow is complete. So you could maybe somehow config Naut to always do things in a perfect step, then step, order. It sounds like Naut is jumping the gun on the TN creation. Can you not tweak Naut to always wait? Or, disable the auto TN creation feature entirely, and the attach your own script, which will only kick-off the TN creation, after an image is known to be complete and final, and not in the middle of a download. I'm just brainstorming a way, that you don't have to manually review each TN with your own eyes, to determine if it's valid or not. Dunno know about you, but I'd get tired of having to review each and every TN, to see if it's corrupted, black, or partial. Even if one click would re-gen a valid one, that still requires you to always be looking over Naut's sholder, to make sure each TN gen'd is actually valid. Maybe run a batch process against a whole directory of full images, with one click, after disengaging Naut's auto-TN creation feature entirely? Admittedly, I don't have a perfect grasp on 'Nix or Naut. I suspect turning off Naut's auto/unattended-TN gen feature is either impossible or otherwise undesirable. If you automate some kind of "post download process" you don't ever assume any TN's are valid, or even exist - if you turned off the autoTN feature in Naut, they wouldn't exist. If they already do, you just assume that some are corrupted, w/o looking them over one by one, and gen a fresh TN for every single full image in the directory.

Callum at 2010-06-14 15:12:25

99% of thumbnails are good. Maybe that's the missing part of this puzzle. :-) Occasionally, I'll see a thumbnail that's bad, and I want a new one. It's a rare thing, but it happens every so often. Nautilus is the file browser on Gnome (think Windows Explorer). It only generates thumbnails when I look at a directory of files, if it doesn't have the thumbs cached already. Sometimes, depending on the download program I think, if I'm looking at a file which is in the process of downloading, it generates a nonsense thumbnail. Most of the time, Nautilus doesn't ever know a new file exists until I browse to that directory and it discovers I don't have an existing thumbnail for that file. This solution is truly the simplest idea I can think of. It's very little work, just the occasional spoiled thumbnail I'm correction.

Callum at 2010-06-14 14:03:16

I could delete everything in ~/.thumbnails/fail/ but that causes nautilus to regenerate every failed thumbnail, some of which will be legitimate fails. I like this approach, it give me a quick and easy way to delete a specific thumbnail that I think has failed. Also, some thumbnails were generated properly, but are black. Using this script, I can delete those as well. They would be much harder to find programmatically. Then there's the question of how or when I would schedule the programmatic check.

gastroenteritis at 2010-06-13 23:09:31

"To test, right click on a file with a thumbnail. You should see a new menu, Scripts, under which you’ll see “”. Click that option and the thumbnail will be deleted. Press F5 to reload the folder in nautilus, and you should see a new thumbnail generated." Couldn't you somehow automate the check for an invalid TN, and the subsequent deletion and recreation of a valid one? Or is the only judge of what's invalid/corrupted a human bean? Maybe a file size check or something... or timestamp comparison...

antonio at 2011-05-24 13:41:24

thanks, works like a charm