Script: Thumbnail Maintenance

Discuss and share scripts and script files...
klownboy
Posts: 4090
Joined: 28 Feb 2012 19:27

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi sireddie, based on your comment:
Before: NA cache did not exist. After: NA no images in folder.
Could you try using one of the options that doesn't provide Before/After sizing data (e.g., the 3rd menu option - Build Thumbnail Cache...current folder and subs) to see if that might work? The sizing data options do have to perform quite a bit of additional work which could interfere with getting a handle on why it isn't working for the network locations.

When you have done a thumbnail rebuild in one of those network folders manually without using the script, could you tell me what is displayed in the data table when you use the very first option (if you can/if that option works)? If you right click on one of those network folders listed in the data table that are displayed when you use the first menu item, you can copy the line to the clipboard.

Could you also try using the 4th menu option where you "Select folder (and subs) to build...". I'm curious if you can properly access and then build using that option.

The key is XYplorer has to go to these folders to accomplish a thumbnail build. The folder has to be the current folder so I'm not sure if that is happening for your network locations.

Until I'm able to set up a network the above checks may help. Thank you and obviously no rush on this.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

sireddie
Posts: 6
Joined: 15 Oct 2014 02:13

Re: Script: Thumbnail Maintenance

Post by sireddie »

OK, so I tried using the 3rd menu option and that didn't work either. Actually tried all the options I think.

Here is the line from the data table after doing a manual thumbnail refresh and running the first option:

Code: Select all

\\192.168.1.123\d$\Temp\11\ ● 64x64 ● 2021-01-22 09:07 ● 6c09445df78400f0df559470cf40f9ba ● 0,60 MB
The forth option for me is "Build Thumbnail Cache...current folder only - Size Data", but the 5th option which is "Build Thumbnail Cache....current folder & subs - Size Data". I ran both which gave the same output:

Code: Select all

Thumbnail Database Size before and after rebuild:

Thumbnail or Tile size [z denotes Zoom to Fill]:

Folder [\\192.168.1.123\d$\Temp\11\]
[64x64]
Before: 610 KB                               After: 610 KB
Perhaps I'm using a different version since I don't have the menu option of selecting a folder? I'm running ThumbnailMaintenance_v1.19

Thanks for taking time to look into this

sireddie
Posts: 6
Joined: 15 Oct 2014 02:13

Re: Script: Thumbnail Maintenance

Post by sireddie »

Upon further testing it seems that my problem isn't related to network paths at all as it doesn't seem to work for my local test folder either.
Will get back once I do some more digging.

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

Re: Script: Thumbnail Maintenance

Post by klownboy »

OK sireddie, let me know. I had forgotten that I was working with version 1.20 (still working on it). In that version I have a new option which will bring up an input folder box and allow the user to point to the folder they want to rebuild. Sorry that's the 4th menu item I was referring to earlier. I'll PM you a copy of that one to check that menu item. Obviously you may have some other issue. Thanks
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

sireddie
Posts: 6
Joined: 15 Oct 2014 02:13

Re: Script: Thumbnail Maintenance

Post by sireddie »

Np, finally found the issue. Seems that my settings screwed things up.

I had ticked the setting "Show cached thumbnails only" thinking that the script would do the same as View > Caches > Refresh Thumbnails/Create Missing thumbnails.
But I'm guessing that the script actually just traverses the folder structure in the different thumbnail views to create the thumbs that way.

I would like to only display any pre-cached thumbnails so I don't have to wait for them to be created. If they are missing (i.e. new/renamed folder), I could manually trigger a refresh with a click of a button/keyboard shortcut.

Perhaps turning this setting could be checked/turned off during the time the script does it thing? Not a biggie, I could just keep the setting unticked.

Cheers!

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

Re: Script: Thumbnail Maintenance

Post by klownboy »

Thanks sireddie on the follow-up info. Strange though because in the script, in the "_Initiate" section which runs in the beginning, I have setting "cachethumbsreadonly", 0; It's in your version 1.19 as well as 1.20. This is suppose to turn off CacheThumbsReadOnly: Show Cached Thumbnails Only as shown in the Help file under Scripting Commands - Setting.

So that setting for "Show Cached Thumbnails Only" is supposed to be turned off. I checked it by stepping through the script (try turning on Stepping before running the script to see if that statement is executed). You could also try running, setting "cachethumbsreadonly", 0;; or setting "cachethumbsreadonly", 1; from the address bar or from the Scripting window. It will be reflected in Configuration.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

ksarnelli
Posts: 154
Joined: 13 Dec 2014 04:48

Re: Script: Thumbnail Maintenance

Post by ksarnelli »

Any plans to make this script work with the "Resolve cache path from the current folder" option? I have my cache paths in a folder at the root of each drive/share.

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

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi ksarnelli, I was aware of the option though I hadn't looked into it yet. It looks like it's all caches in one place (i.e., the normal method) or thumbnail caches in the current folder. It doesn't look like it can be a combo of the 2 options. If I incorporate it, I'm thinking I would not provide all those current menu items options for the "new" current folder cache option. Since you could have these thumbnail caches scattered across the entire computer, though possible, I wouldn't necessarily want to grab all those folders across the entire computer that have a "current" folder thumbnail caches. Any thoughts?
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

ksarnelli
Posts: 154
Joined: 13 Dec 2014 04:48

Re: Script: Thumbnail Maintenance

Post by ksarnelli »

klownboy wrote: 16 Nov 2021 12:46 Hi ksarnelli, I was aware of the option though I hadn't looked into it yet. It looks like it's all caches in one place (i.e., the normal method) or thumbnail caches in the current folder. It doesn't look like it can be a combo of the 2 options. If I incorporate it, I'm thinking I would not provide all those current menu items options for the "new" current folder cache option. Since you could have these thumbnail caches scattered across the entire computer, though possible, I wouldn't necessarily want to grab all those folders across the entire computer that have a "current" folder thumbnail caches. Any thoughts?
Hi Klownboy - there are actually a few use cases for the Resolve cache path from current folder option. One is like you described (thumbnail cache in the current folder), but the feature also supports a placeholder that resolves to the current drive/share.

Screenshot - 20211116_090234.png
Screenshot - 20211116_090234.png (24.57 KiB) Viewed 3187 times

I personally use the placeholder approach, so basically my thumbnail caches are in a single folder per drive/share. This should be easier to handle in your script than the "thumbnail cache in the current folder" approach.

For the individual functions see my comments below:

Refresh Thumbnail Cache...by folder using cache DB
Thumbnail Cache Clean-Up...by folder using cache DB

Derive thumbnail cache location from current folder. These options wouldn't be very useful for the "thumbnail cache in the current folder" approach, but it shouldn't hurt to leave them in.

Build Thumbnail Cache...current folder only - Size Data
Derive thumbnail cache location from current folder.

Refresh Existing Cache...current folder & subs
Refresh Thumbnail Cache...current folder & subs
Build Thumbnail Cache...current folder & subs - Size data
Delete & Build Thumbnail Cache...current folder & subs
Thumbnail Cache Clean-up...current folder & subs

Derive thumbnail cache location from current folder and derive it again from within each subfolder.

Empty Entire Thumbnail Cache
Derive thumbnail cache location from current folder. Again, not very useful for the "thumbnail cache in the current folder" approach, but it shouldn't hurt to leave it in.

Update Thumbnail DB for Image Folder Relocation
I've never used this, but I'm guessing it wouldn't be as useful if you're using the "Resolve cache path from the current folder" option.

Cleanup Residue and Backup folder
No idea what this does :lol:

Anyway, thanks for listening. Let me know your thoughts.

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

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hey ksarnelli, thanks for getting me up to speed on the new option. I'm not sure I'll incorporate that for my own personal use. In some ways, I like the idea of having all my thumbnails in the same location on my SSD and my photos, pdfs, wallpapers, etc on spinning disk drives. Though I can certainly see where one location per drive or even per current folder approach would be useful.

In any case I have to explore further obviously. My thought now (and it may change) is to not mess with the current menu options (i.e., not try to meld the current folder or drive option into the existing methods using a single centralized cache database), but instead provide an option or two that would scan a drive for dbits and dat2 cache files and allow the user to selectively check which caches to rebuild. Maybe another option that would rebuild the current folder and subs.

Unfortunately, I have much going on at the moment and with the holidays coming, it may take awhile, but I'll start looking at it. I see Don just added a new SC get("thumbs_cache") which will returns the full path of the currently used thumbnails cache file. That will be helpful.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

ksarnelli
Posts: 154
Joined: 13 Dec 2014 04:48

Re: Script: Thumbnail Maintenance

Post by ksarnelli »

Thanks klownboy - I totally understand...this time of year is crazy busy for everyone. As far as how you implement support for the new option I'm sure I'll be happy with whatever you come up with. My main goal is just to be able to generate thumbnails for an entire drive at a time and to be able to remove moved/deleted paths from the cache easily.

I personally use the new option because it makes it so I can move removable disks from machine to machine and still use the same thumbnail cache. Also it comes in handy with SMB shares since the cache can stay on the share and be available to any machine that accesses it.

Thanks again!

CFTwFSgJaLsDUrLv
Posts: 19
Joined: 28 Jul 2020 13:07

Re: Script: Thumbnail Maintenance

Post by CFTwFSgJaLsDUrLv »

klownboy wrote: 22 Jan 2021 17:11 OK sireddie, let me know. I had forgotten that I was working with version 1.20 (still working on it). In that version I have a new option which will bring up an input folder box and allow the user to point to the folder they want to rebuild. Sorry that's the 4th menu item I was referring to earlier. I'll PM you a copy of that one to check that menu item. Obviously you may have some other issue. Thanks
HI

Is 1.19 still the latest release (as amended by replacing a line and putting quotes round KB in a different line)? Or did you get 1.20 finished?

I'm trying to get this useful script to work. I'm using the third item to build cache for folder and subs. The script gives a message saying it has completed thumbnail creation for the folder and its subfolders (VERY QUICKLY),but does not seem to have done anything in the subfolders. When opening any subfolder, XYplorer initially shows no thumbs but the message field shows them being created on the fly. For example, one folder (372 images) that took far longer to create the thumbs than the script took to finish.

I changed line 47 but am now getting an error:
Screenshot 2022-05-21 XYplorer - THumbnail Maintenance Script error 3.jpg
Screenshot 2022-05-21 XYplorer - THumbnail Maintenance Script error 3.jpg (134.5 KiB) Viewed 2472 times
Windows 10 v21H2. Dell XPS17 L702, i7 2720QM, 16GB RAM, 1920*1080 on external display.

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

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi CFTwFSgJaLsDUrLv and thanks for the comments. No, unfortunately I still haven't published verion 1.20, but I'll get back to it. It's basically done. I just wanted to do a bit more testing. That particular error is corrected on my 1.20 version by changing the subject lines to:

Code: Select all

sub 'THUMB_DB'; setting "AllowRecursion", 1;sub 'BG_THUMB_REFRESH'; end 1;
Instead of bothering to tweak your version, I'll PM you a copy of the latest version 1.20. There are quite a few changes in it over 1.19. Probably the biggest is recognizing if a user is using local drive caches in lieu of a single one. Let me know if it's working alright for you. Thanks.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

CFTwFSgJaLsDUrLv
Posts: 19
Joined: 28 Jul 2020 13:07

Re: Script: Thumbnail Maintenance

Post by CFTwFSgJaLsDUrLv »

Thanks very much. As requested, feedback on my experience with the v1.20 script.

:( I'm not able to get it to work as I expect it to. Strange things happen. It does not appear to FULLY create thumbs for subfolders. My laptop has a C drive where the programmes reside, and an E drive where the pictures folder lives.

Having had problems with 1.19 I'd first used the script to "Empty Entire Thumbnail Cache" so that I was starting with a clean sheet.

I chose a folder from 2014 which has subfolders for each month, and started with a Left Mouse button click to activate the 3rd menu option - "Build Thumbnail Cache... current folder & subs". It takes only a very few seconds, then says it has completed, but there are no thumbnails.
Thumbnail cashe rebilding complete.jpg
Thumbnail cashe rebilding complete.jpg (16.38 KiB) Viewed 2449 times

If I use the 6th option including size data, it appears to work but doesn't. Every subfolder has tens of images, the biggest has 738! The script takes only 2 to 3 seconds per folder while displaying the message "Busy rebuilding thumbnails"
Screenshot 2022-05-21 XYplorer - THumbnail Maintenance Script 1.20 busy rebuilding.jpg
Screenshot 2022-05-21 XYplorer - THumbnail Maintenance Script 1.20 busy rebuilding.jpg (9.1 KiB) Viewed 2449 times

The script completes and gives the popup saying there were no images.
Screenshot 2022-05-21 XYplorer - THumbnail Maintenance Script 1.20 no images.jpg
Screenshot 2022-05-21 XYplorer - THumbnail Maintenance Script 1.20 no images.jpg (88.26 KiB) Viewed 2449 times

But there very clearly are images :?


So I used the standard menu item in XYp to create all thumbnails for January, which it did. Then I ran your script again. It showed a thumbnail cache for January, but still none before or after for any other subfolder.
Thumbnail Database Rebuild - after using XYp to create the thumbs in January.jpg
Thumbnail Database Rebuild - after using XYp to create the thumbs in January.jpg (49.52 KiB) Viewed 2449 times

Annoyingly, whenever the script changes folders, it takes focus from what I am doing, so I found that what I was typing in here while waiting for it to finish was not being recorded in full - I got words that started or ended, or combined because the space was typed while the focus was on the script.


:biggrin: If I use CTRL+LMB on menu item 6 then the script cycles through the folders on screen, creating thumbnails, and completes as expected with a cache for each subfolder.
Thumbnails CTRL+LMB completed.jpg
Thumbnails CTRL+LMB completed.jpg (97.85 KiB) Viewed 2449 times

:? But I don't understand the cache sizes. All thumbs are at 300*200.
January was 79 images and had thumbs created by XYp - 11,707 KB of cache.
February has 74 jpgs with thumbs created by script - 2,492 KB of cache
June has 472 jpg images - cache size 2,738 KB.
The reason seems to be that the thumbs were NOT all created by the script. In XYplorer, as I scrolled down within the June subfolder, thumbs were not there, and XYp created them on the fly.

So I re-ran the script option 6 just on the June subfolder. The cache size is now 78,754 KB. Opening that subfolder, the thumbs are all there even if I jump to the bottom of the folder. :D
Thumbnail rebuild - one folder.jpg
Thumbnail rebuild - one folder.jpg (33.93 KiB) Viewed 2449 times

Experiment- Use script menu item to "Delete & Build Thumbnail cache..." for that subfolder only. It completed almost immediately. :?
THumbnail - delete and rebuild cache - result.jpg
THumbnail - delete and rebuild cache - result.jpg (10.72 KiB) Viewed 2449 times
But I don't know what it has done. The cache appears now to be 3.17 MB (from the first menu option of "Refresh Thumbnail Cache...")

So I used the 6th menu item again to build. That shows a cache of 3,246 KB before and 78,754 KB afterwards. So it appears that the delete part of menu item 7 had nearly happened, and the build part had not.

If I ran item 7 in the foreground using CTRL+LMB, nothing actually happened - the screen flickered once, and it said it had completed.

Next experiment:
Item 1 in the menu, run on subfolder May.
THumbnail - rebuild cache from DB.jpg
THumbnail - rebuild cache from DB.jpg (152.96 KiB) Viewed 2449 times

It took about 30 seconds, and the cache for that folder increased from 2.32 MB to 91.30 MB.


Next: Menu item 6 on just the March subfolder which had 463 jpg images. The cache went up from 2513 to 22250. So running that same script on the folder above hadn't created all the thumbs.

I went back to Script menu item 1, and selected all subfolders, to create at current sizes. That took almost 9 minutes. At one point I got an "Error 91" popup from XYplorer, but it disappeared before I could screenshot it, and I didn't see what it referred to.
Every other folder cache was now significantly bigger, and opening a folder showed the thumbs were successfully created by this action.
THumbnail - rebuild cache from DB - select all subfolders - result.jpg
THumbnail - rebuild cache from DB - select all subfolders - result.jpg (156.52 KiB) Viewed 2449 times

I hope that all of this helps you understand what is happening, and improve the script.
Windows 10 v21H2. Dell XPS17 L702, i7 2720QM, 16GB RAM, 1920*1080 on external display.

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

Re: Script: Thumbnail Maintenance

Post by klownboy »

Hi CFTwFSgJaLsDUrLv, I guess it wasn't ready for prime time. We may have to take one issue at a time like the 3rd option. Anyway, I suspect many or most of the issues are with the "OneDrive" folder. I ran some tests on options 3 and 6 without issues. With option 4, where you select a drive to rebuild, I did have an issue. Once corrected, the option ran fine.

Is the OneDrive folder on a drive physically on your laptop or is it a cloud drive? If you select a folder on your local drive "C:" and then you type in goto "E:\OneDrive\Pictures\2014\"; in the address bar or in the menu, Scripting > Run script, does that take you to the OneDrive or not? I don't use it, but I ask because my OneDrive folders are off C:\ like "C:\Users\ken\OneDrive\Documents". Is it mirrored or subst or actual?
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Post Reply