Script: Thumbnail Maintenance

Discuss and share scripts and script files...
Post Reply
klownboy
Posts: 4477
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi, I'm posting version 1.15 of ThumbnailMaintenance script. The update includes:
1) The script now recognizes Don's changes which permit flexible user defined tile sizes and that they may or may not be the same as the thumbnail sizes. You can save yourself some cache(s) and therefore diskspace (if you care) if you have tile sizes the same as thumbnail sizes since they'll share the same cache.
2) It will now recognize paperfolders in the thumbnail database (i.e., the DB options). In the "current folder" type options, the script will recognize if you are currently in a paperfolder viewing images and permit their deletion or rebuilding as it does in the DB options.
3) It takes advantage of Don's undocumented (other than beta notes) SC unthumb, changes to SC exists to recognize paperfolders, and the relatively new SC property #Empty along with a number of other improvements. Hopefully some of these will help in the speed department.
4) I left the option in the script which will zip through the entire database and check if you have any stray dat2 files or dbits files. That issue with XYplorer should not be happening anymore since Don plugged the holes which caused that to happen especially when a user turns thumbnail caching on and off... though it doesn't hurt to check. The option will also allow you to sync your XY backup of the thumbnail folder to the XY thumbnail folder. The backup can grow bigger than it should be since it can leave behind "old" cache files.

Once again please let me know if you have any issues.
Thanks,
Ken
ThumbnailMaintenance_v1.15.zip
To see the attached files, you need to log into the forum.

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Thanks Ken,
On first trial runs, I do notice an increase in speed. XY itself has also improved in that respect, it seems, and it no longer chokes on long lists which can now be scrolled w/o waiting for XY to catch up.
klownboy wrote:I left the option in the script which will zip through the entire database and check if you have any stray dat2 files or dbits files.
Glad to hear that. I have quite a few leftovers I need to clean up. Got under pressure during the busy Xmas season and - Murphy's Law- that's when the stray dat-files turned up, when I duplicated thumb-databases to protect them from contamination, when I made mistakes and messed it all up.

Will tackle it again in a more relaxed manner, or at least use it on my private machines, where I have more time and more leeway for mistakes.

klownboy
Posts: 4477
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Script: Thumbnail Maintenance

Post by klownboy »

Thanks Stef123, I hope you continue to get some use out of it.
Ken

Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Re: Script: Thumbnail Maintenance

Post by Enternal »

So far it seems to work much better than the old script. Love the fact that it can now detect that paper folder exists natively instead of the method before. So far so good! Thanks!

klownboy
Posts: 4477
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Script: Thumbnail Maintenance

Post by klownboy »

Thanks Enternal, I really didn't have any actual detection of paperfolders until v1.15. For your info, other than the database [DB] type menu options, paperfolders will only work with the ""Build Thumbnail Cache [current folder only]" menu item. The other options, like "Build Thumbnail Cache [Current Folder and Subs]" will take you to the "Build Thumbnail Cache [current folder only] menu item when the script detects your in a paperfolder.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Script: Thumbnail Maintenance

Post by bdeshi »

hey, another feature request: when building thumbnail cache for a folder [& subs], perhaps current viewmode (if it's thumbnail-enabled) could be pre-checked in the "Select Thumbnail Sizes" dialog.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

klownboy
Posts: 4477
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi Sammay, that sounds logical. Would you be alright if it uses that same thumbnail/tile size in the current folder throughout all its sub folders (if any)? I really don't want to stop and ask a user at each sub-folder. It would be way too cumbersome. I would think that most people would want that since they may be building thumbs for the first time in the thumb view mode they currently have displayed and they would probably want he same thumb sizes for the sub folders.

In re-checking that Rebuild option for current folder and subs, I see the dialog already states what the current view is so, I'm getting that information already. That script option also flags any existing thumbnail sizes which exist in the database with a big fat dot. So I have to figure out if I can manage to have the current view (if it's a thumbnail/tile view) pre-checked along with maintaining the dot(s) to note the thumb sizes currently in the DB.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Script: Thumbnail Maintenance

Post by bdeshi »

klownboy wrote:Hi Sammay, that sounds logical. Would you be alright if it uses that same thumbnail/tile size in the current folder throughout all its sub folders (if any)?
Yes.
klownboy wrote:I would think that most people would want that since they may be building thumbs for the first time in the thumb view mode they currently have displayed and they would probably want he same thumb sizes for the sub folders.
..That's the point! :D
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: Script: Thumbnail Maintenance

Post by Filehero »

Now is the right time: Ken, this is a very helpful script and done very well!

In brief: it's great :D :appl:

klownboy
Posts: 4477
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Script: Thumbnail Maintenance

Post by klownboy »

Sammay I wanted to make sure we were on the same page or should I say, on the same thumbnail. Thanks. Hopefully I can start working on a revision this weekend.

Thanks Filehero, it's always nice to get some feedback especially positive. I hope you get some use out of it.

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Had a bunch of errors popping up. However, upon running the same situations at home to reproduce and give you more specifics, everything works fine. I'll post the error msg anyway, maybe you have use for it:
error.png
It came up when running Refresh Existing [current + subs]. Probably due to broken caches that got messed up before Xmas when the confusion with XY's realtime caching was in the air. Completely rebuilding those caches will hopefully fix it, but I'll have to do it one at a time, over the course of the next weeks.

Delete and Rebuild current and subs - multi-selecting from the sizes-dialog were nice-to-have. No big deal to trigger it several times in a row .... but each time the other sizes are lost again. Makes for a nice pastime, perpetual fun that never ends. :P

Empty entire cache leads to an error msg in some cases (.dbit file still in use) - it might help other users to let them know more, what they can do about it.
To see the attached files, you need to log into the forum.

klownboy
Posts: 4477
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi Stef123, thanks for the comments. I've seen that very same error message concerning the command ID #$thumb_cid is invalid and I think we've talked about it once before. Unfortunately, it seems so inconsistent. It may have something to do with the current view (i.e., when the current view is not one of the thumb/tile views in the replacelist line, it throws an error for the resultant $thumb_cid. The whole idea there was to eliminate going into a thumb\tile view if you were already in that view thereby eliminating an unnecessary rebuild...because if not it would happen twice. I've already made a change that will improve that situation for the next version 1.16, but I will revisit it again. I may be able to trap it in a better way.

Concerning the Delete and Rebuild menu item, the whole idea on the at one was to strip out all the other caches other than the "one" you really want to keep. So right now anyway I'm thinking I'd rather keep it that way and if you need to rebuild multiple size use the other options.

While working on this next version, I ran across the in use message also one time when trying to delete the strays. I think XY is still doing something there that is holding some strays from being deleted. (i.e., still in memory). I remember discussing this with Don on another thread. I think sometimes it's probably better to do an exit and restart before using that option. I've never had a problem on a restart of XY. Maybe I should build a restart into that menu option though it would have to prompt the user.

Hopefully within the next week I'll issue version 1.16. It will incorporate a change that Sammay requested where the current view will be pre-checked on some options. Such that if you want to rebuild the current folder and subs in the current view, it will obtain the view and have it pre-checked in the inputselect dialog box. That wasn't difficult, but another thing I changed was. Now "all" the thumb or tile sizes which exist in the database will be flagged (with the big fat dot - BEL) not just one when there are multiples in one size. So for example if you have a small tile size of 128 and your small thumbsize is also 128x128 and then of course your "Detail with thumbnail #1" will also be 128, all three will be flagged.
Thanks,
Ken

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Thanks Ken,
good idea to flag all relevant entries with the big flat dot. I noticed it picks just the first one - although I didn't even have thumbs for that, but since it was the same size ....
Anyway, it didn't seem important enough to mention it. BTW, my feedback concerns foreground tasks only, for some weird reason I was not able to run second instances. Must have been company-restrictions, low resources or whatever. Caused crashes and sometimes the script just ran ahead in the foreground anyway.
klownboy wrote:Concerning the Delete and Rebuild menu item, the whole idea on the at one was to strip out all the other caches other than the "one" you really want to keep. So right now anyway I'm thinking I'd rather keep it that way and if you need to rebuild multiple size use the other options.
Yep, using the other option did occur to me, of course. Besides, you explicitly caution the user what he is about to lose. And yet a few days later, I picked it again by accident or out of habit, on a deeply nested folder that processed for an hour or so. No big deal, I just wondered if those checkboxes could be used in Del&Rebuild as well.
klownboy wrote:I think XY is still doing something there that is holding some strays from being deleted. (i.e., still in memory). I remember discussing this with Don on another thread. I think sometimes it's probably better to do an exit and restart before using that option. I've never had a problem on a restart of XY. Maybe I should build a restart into that menu option though it would have to prompt the user.
Or just some info what he can do about it. It might even suffice to leave the folder and browse to a non-picture location. This seemed to work in some instance, if I remember correctly.
klownboy wrote:It will incorporate a change that Sammay requested where the current view will be pre-checked on some options.
I also like that suggestion.
Residue cleanup is great, too. It worked wonders on some folders. :tup:

klownboy
Posts: 4477
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi, well I've been testing this next version 1.16 for a week now fixing issues as they popped up. Enough testing...here goes. The update includes:
- In the Rebuild Thumbnails and Delete and Rebuild menu options, the inputselect dialog box will pre-check the current view if and only if the current view is a tile or thumbnail view. Before it only informed you of the current view. Though it still does that as well regardless if it's tile or thumbnail view. Thanks Sammay for the requests - it's a nice addition.
- In the Delete and Rebuild menu options, the script will now allow the user to select more than one thumbnail/tile size to rebuild. Thanks Stef123 for the request - also a nice addition.
- Worked to eliminate (hopefully) a couple of error messages, one concerning the variable, $thumb_cid not being valid. The script now list all the potential views a user could be in not only the tile or thumbnail views in the replacelist. I haven't received it in the last week of testing. The other message concerns the cache still in memory. Not sure if we'll ever totally eliminate this one - too many variables, but I attempted to minimize it by using SC unthumb in a number of situations before attempting to delete the cache.
- In the inputselect dialog box, the script will now flag with the 'bel' symbol (the big fat dot), all thumbnail or tile size views that exist in the database. So for example, if you have a cache for the Small Tile size that is 128x128, and your Thumbnail #1 size is also that 128x128, then as a result, the Details with Thumbnails #1, Thumbnails #1 and Small Tile sizes will all be flagged. It makes sense since those 3 views would share the same cache.
Again please let me know if you experience any issues.
Thanks,
Ken
Edit: Updated the Zip file to resolve an issue concerning the paperfolder check discussed in the post below.
ThumbnailMaintenance_v1.16.zip
To see the attached files, you need to log into the forum.
Last edited by klownboy on 07 Feb 2015 23:35, edited 1 time in total.

Stef123

Re: Script: Thumbnail Maintenance

Post by Stef123 »

Thanks Ken,
for raising the comfort level yet another notch. I especially appreciate the multi-select in Delete & Rebuild. Quite a time saver with large and nested folders. These take time to generate, so I usually let it runs its course unattended. When coming back I no longer need to follow up with a second round of Build Thumbs. :D :appl:

I use it a lot on other machines, after directing XY to the local cache that I left there. As a quick and sure-fire approach to get the real status quo, including changes that the refresh-option may or may not capture. Very convenient that you allow the targeting of selected branches only.

Will keep an eye on the $thumb_cid error should it really come up again.

Post Reply