Script: Thumbnail Maintenance

Discuss and share scripts and script files...
Post Reply
Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Amazing that you could pull this off without relying on massive programming background. I do realize (and appreciate) how much time and energy and head-racking went into this project. And I am glad you stuck it out to deliver this version.

Honestly, I cannot imagine anyone NOT needing this script unless he uses a separate image browser. In which case I encourage everybody to switch to XY and try your script. No waiting for the thumbs-cache to build up folder by folder, no more apprehensions about changing thumbs-sizes or carrying obsolete overhead storage.

Not to mention feeling in control of this cache-conundrum underneath. Which threatened to grow to monstrous proportions before you came along. :P

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Script: Thumbnail Maintenance

Post by bdeshi »

You must link to this and future latest versions in the first post.
Hardly anybody's going to "scroll down "."four pages"."to the latest version of the Thumbnail Maintenance script.";
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

lian00
Posts: 354
Joined: 09 Jul 2014 17:12

Re: Script: Thumbnail Maintenance

Post by lian00 »

SammaySarkar wrote:You must link to this and future latest versions in the first post.
Hardly anybody's going to "scroll down "."four pages"."to the latest version of the Thumbnail Maintenance script.";
I agree. It's much more convenient to have the download in first post.
Windows 10 64 bits

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Script: Thumbnail Maintenance

Post by klownboy »

Thanks guys, I did change the first post so that we have a direct link to the download post.

Hi Stef123, I've been taking a huge amount of photos lately so between that and re-sizing/cropping wallpapers to fit my different monitor aspect ratios, my <xythumbs> folder was well over 1.5 gig. Now it's down to a slim 750 meg. :) :whistle:
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

klownboy wrote: my <xythumbs> folder was well over 1.5 gig. Now it's down to a slim 750 meg. :) :whistle:
I've got similar success stories to report: an overweight USB stick shed well over 1 gig, my backup SD card lost 1.8 gig. It feels like tax returns from the IRS - more disposable income to use otherwise. :appl:

More fun and freedom too. Dietary restrictions are history, I now indulge in changing thumb sizes and sampling from fat backup drives. I let it pluck and digest whole trees, not worrying about thumb-intake. Your script will burn those extra calories on the next work-out session. :biggrin:

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

When I build the cache (current folder & subs), the latest version allows me to pick one or more thumb sizes. Which is great. If only it wouldn't ask for each and every subfolder. This requires too much interaction for my taste, it spoils the idea of getting a whole tree cached without having to sit and wait and supervise. Is there a way or tweak to make my initial checkbox selection stick?

Every now and then I get the following error messages:
Error1.png
Error1.png (8.8 KiB) Viewed 4144 times
Error2.png
Error2.png (12.42 KiB) Viewed 4144 times
Cannot tell you the exact circumstances yet. Will try to narow it down to what triggers it.
All I said refers to foreground maintenance.
I also chanced upon various warnings and error messages. Very thought-through and informative.

Thanks
Stef

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi Stef123, sorry to hear about your issue. I ran that menu item on a folder with a couple of subs and didn't experience an issue but I'll see if I can duplicate your problem. From what I see it doesn't look like there was a proper match up of thumbnail size to arrive at the proper thumbnail view number or cid. If you can supply an additional info you can PM me.

Regarding the selecting of thumbnail sizes on each sub folder, I was wondering if people would rather not have the prompt for thumb size. I had my doubts. I'm surprised if you're looking for less user interaction that you wouldn't use the other options, "Refresh [folder and subs]" or "Delete and Rebuild [folder and subs]" instead. Refresh will do the same but with the existing thumbnail sizes and Delete & Rebuild (currently incorrectly labeled Build and Delete) will allow you to pick a thumbnail size and apply that through out the folder and all subs without any user prompting. It will also delete any caches in sizes other than the one you selected. The Rebuild [folder and subs] menu option is alright I suppose if you only have a few subs but with many it's not so nice. If there are no objections from others, I'll either have a prompt after the first folder selection of thumb size, to ask the user if they would like to use that thumbnail size selected to all the subs or be prompted on each and every sub. Though, I dislike having to add additional prompting though (i.e., more user interaction that's why the other options may be better for you). I'm not sure yet about the reporting of database file size changes. I'll probably just show that at the very end of all the subs no matter what option is selected instead of after each folder/sub. Any thoughts? I don't want to get to carried away since there are other options out there.

EDIT: I was assuming the error you received was in the menu option "Build Thumbnail Cache [current folder && subs]" since you were initially discussing that option, but it's in the "Delete && Rebuild Thumbnail Cache [current folder && subs]" option so you must have used it at least once. :) Unfortunately I left a "step" and "unstep" in the uploaded version that I had in there while troubleshooting. Please remove the "step;" in line 229 and "unstep;" in line 236. I'll correct in the next upload.
Thanks,
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Thanks for the quick feedback.
I removed {step; $match = "1"; break;} from line 229 and "unstep;" from line 236. Will report back via PM in case this didn't help.

Sorry for not being more precise - you are right, I did use "Delete & Rebuild Thumbnail Cache [current folder && subs]" and not "Build" when the problem occured.
klownboy wrote: I'm surprised if you're looking for less user interaction that you wouldn't use the other options, "Refresh [folder and subs]" or "Delete and Rebuild [folder and subs]" instead.
I don't see how either of them would allow me to cache tree branches from scratch. Not to mention how to add another thumb size.

"Refresh" even tells me I should use "Build" instead. When I first generate a few thumbs to give it a base to work with, then run "Refresh (folder + subs)" again, it won't cover the subs unless I go into each one and create at least one thumb there first. Which - again - spoils the idea of having an easy (unsupervised) way to pre-create a cache for whole branches.
Creating all 3 thumb sizes via "Refresh" takes even more manual clicks to provide the script with enough material to work with.

"Delete and Rebuild [folder and subs]" deletes the other sizes I want to keep. When I run it on an empty cache, I get this error
error3.png
error3.png (11.69 KiB) Viewed 4121 times
klownboy wrote: I dislike having to add additional prompting though (i.e., more user interaction that's why the other options may be better for you).
A tweak or general setting or checkbox were fine with me. I never need the size option while the script is running. Don't know if other users make that decision based on subfolder names. To me those names are meaningless. In work on foreign drives, not knowing in advance how many (sometimes hundreds) of subs will surface, and not knowing their content, either. My main concern is getting deeply nested folders cached without tedious browsing.
klownboy wrote: I'm not sure yet about the reporting of database file size changes. I'll probably just show that at the very end of all the subs no matter what option is selected instead of after each folder/sub. Any thoughts?
I fully agree. One single report at the end is better.

Thanks for your considerations
Stef

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi Stef123, I tracked down the last error you received, "file missing". I believe the only way that you can receive that error in that particular place in the script is if you are running it on a computer that initially has no database of thumbnails cache(s) at all. In testing, I received it myself when I ran "Delete & Rebuild" on a empty <xythumbs> folder. I've taken care of it at least for the next update. If you want to correct before then, add the following line "if($dat2file == "") {continue;}" in the "_DATA" label section such that lines 391-393 will look like this...

Code: Select all

    foreach($dat2file, $dat2, "<crlf>") {
	   if($dat2file == "") {continue;}
      $filehash = getpathcomponent($dat2file, "base");      //gets the base file name which is the "hash"
So that boils down to the "Rebuild Thumbnails [current folder and subs]", as we discussed I'm going to go ahead and provide just one choice of thumbnails initially for the folder and all its subs. Of course the user can still select multiple sizes as before. They will no longer be prompted at each sub-folder and hopefully I can achieve one report at the end of it all. If not I'll get rid of reporting completely for that option :) Thanks.

And yes, "refresh" would only be used if you have an existing thumbnail cache for that folder - which at home most people would.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Thanks Ken, for considering the "unsupervised" option. Guess my scenarios are way off the beaten track, and yet, I really think regular users will also - on occasion - build a whole cache from scratch. On new installs, or to build separate caches for external drives, or to start over with different thumb sizes altogether.
klownboy wrote: running it on a computer that initially has no database of thumbnails cache(s) at all.
Yes, very likely the reason I ran into this error. I keep several caches, careful not to mix customers or people's thumbs. That's why I start with an empty cache, and build whole folder structures from zero.
klownboy wrote:I'm going to go ahead and provide just one choice of thumbnails initially for the folder and all its subs. Of course the user can still select multiple sizes as before. They will no longer be prompted at each sub-folder and hopefully I can achieve one report at the end of it all. If not I'll get rid of reporting completely for that option
Great. All of it. Couldn't envision a better handling. Looking forward to the update. Take your time, though.
Thank you very much.
Stef

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi again, this update v1.11 of Thumbnail Maintenance, other than some minor tweaks and fixes, improves on one specific menu item "Build Thumbnail Cache [current folder && subs]". The user is now prompted just once to make selections of the thumbnail size(s) desired for the current folder and all its subs. You will no longer be prompted for thumbnail size(s) for each sub folder as in the previous version. Also changed, you will receive a report on the before and after cache size for each folder and each selected thumbnail size but the reports will come at the end not at each folder. As I did earlier with the "Delete and Rebuild" menu options, I built a little more smartness into this option as well. If it determines if there is no thumbnail database for the folder at the given thumb size, it will "goto" the folder which will generate the thumbs in itself without the additional need to accomplish a refresh using cid #501. This shaves some time by not rebuilding the thumbnail database twice when there wasn't one initially.

The options which utilize the <xythumbs> database may be a bit slow displaying the inputselect dialog box especially for first time use in a session. The script is internally reading in binary every thumbnail cache file, potential hundreds or thousands (of thumbnails cache "dat2" files). It's also checking every folder associated with the cache files and determining if it is empty of files or if the folder no longer exist. So you may have to be patient for a few seconds.
ThumbnailMaintenance_v1.11.zip
(320.44 KiB) Downloaded 182 times
Thanks for trying it out and hopefully enjoy.
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Thanks again, Ken,
I am happy with the options dialog popping up at the beginning only. Script runs fine and reliable as far as I can tell from first trials. For the heavy duty tests I need to be at work, but I will give it a few more spins on my private material over the weekend.
klownboy wrote:The options which utilize the <xythumbs> database may be a bit slow displaying the inputselect dialog box especially for first time use in a session.
No problem at all. But good to know about it. An important hint for new users who run the script on existing thumbs-databases.

This whole thing has really come of age. Overall handling and messages give the impression of a full-fledged mini-program. :appl: 8)

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Script: Thumbnail Maintenance

Post by klownboy »

Thanks Stef123, I'm glad you like the modifications made to "Build Thumbnail Cache [current folder && subs]" menu option after all they were your suggestions. :) :whistle: I don't think my original intention on the previous revision was to prompt for thumb sizes at each folder only report the size, but somehow it ended up that way. I like it much better with the report at the very end and the single prompt for sizes at the beginning. Thanks.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi, this post is for updating ThumbnailMaintenance to version 1.12. It's a relatively minor update. I noticed that for background thumbnail maintenance using the thumbnail database, menu item "Refresh Thumbnail Cache [by folder using cache DB]" that the script wasn't performing the rebuild on multiple selections only one. Fixed. This was not an issue with the similar named menu item for Foreground Thumbnail Maintenance. Thanks.
ThumbnailMaintenance_v1.12.zip
(249.17 KiB) Downloaded 171 times
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Thank you klownboy, for staying committed to your script.

Another small issue (have not tried 1.12 yet) concerns the status bar. It often shows "Done", even though it is still at work. Then after a while it resumes processing again, provided you wait long enough. With deeply structured subfolders I have managed to crash the script by getting too impatient and pressing ESC and I don't remember what other clicks before that.

It's not that bad with "Build cache" once you know there will be a summary report at the end. I trained myself to Alt-Tab through all open windows to verify the script has finished working. But with "Refresh" there is no summary report and it's really hard to tell whether the script has finished or not when you come back to your machine. With "Done" referring to subtasks only, there is no telling if the specific sub-task was the last one or if there are others to follow.

My suggestion - at least for those operations that include nested subfolders - were to simplify the status bar to show something like "Busy with Thumb Maintenance" and "Done", the latter at the very end only, when the script has completely run its course.

Still using your script heavily. Thanks.
Stef

Post Reply