Page 4 of 6
Re: Slow thumbnails
Posted: 24 Jan 2018 10:46
by highend
8 bytes in hex would probably the best option
Re: Slow thumbnails
Posted: 24 Jan 2018 10:56
by admin
Give me an example how you would use them. XY scripting has no data typing so I'm not sure what you expect when you say "8 bytes in hex".
Re: Slow thumbnails
Posted: 24 Jan 2018 11:09
by highend
Code: Select all
function ConvertToVBDate(date) {
...
return result
}
Code: Select all
text ConvertToVBDate("24.01.2018 11:08:02")
outputs:
or whatever would match for that example
Once we see how the converting is done, we can expand / modify the function ourselves...
Re: Slow thumbnails
Posted: 24 Jan 2018 11:14
by kileytoo
Sorry to cut in, the scripts are very interesting and definitely useful. I was able to reproduce the issue in which thumbnails are recreated when it is not needed...
Usually if I rename or move a folder within XYplorer, the thumbs are not recreated, as expected. However sometimes they are, for example in this scenario. Let's say you have three folders
A────
└ B──
└ C─
with the image files in C. If you create a new folder under A, for example BB, and move C under it the thumbs are always recreated. It only happens if BB is new and was not visited before. If you click on BB first, and then move C there, the thumbs are not recreated, as expected. There may be other scenarios, this is the one I was able to catch and reproduce.
Re: Slow thumbnails
Posted: 24 Jan 2018 11:23
by admin
highend wrote:Code: Select all
function ConvertToVBDate(date) {
...
return result
}
Code: Select all
text ConvertToVBDate("24.01.2018 11:08:02")
outputs:
or whatever would match for that example
Once we see how the converting is done, we can expand / modify the function ourselves...
Ah, you mean to do the conversion through scripting. Well, that's kind of hard. VB date seems to be the nanoseconds passed since 1899-12-30 00:00:00. Crazy!
I can give you a function that converts any date into an 8 character string that you can write to that DAT file. But all the math and calendar knowledge going on here is not exposed.
I added the special format "8char" to SC hexdump. This will work in next beta, and the hexdump will show you the 8 hex values:
Code: Select all
text hexdump(formatdate("24.01.2018 11:08:02", "8char"),,"r"); //69 0E 5E D8 8E 0E E5 40
Re: Slow thumbnails
Posted: 24 Jan 2018 11:36
by klownboy
Concerning the date fomat, I noticed on the second line of the thumbs.txt file, the date format is:
2018-01-23 14:00:36
That date must be written when the log is changed after performing a Thumbnail refresh CID #501. I say that 'cause I'm not sure which format is used in the dat2 file or if in the end they are the same when translated to hex.

Re: Slow thumbnails
Posted: 24 Jan 2018 11:47
by admin
Those dates are not necessarily the same. The the log is written only when a new cache is added, not when a cache is updated.
Re: Slow thumbnails
Posted: 24 Jan 2018 12:15
by admin
kileytoo wrote:Sorry to cut in, the scripts are very interesting and definitely useful. I was able to reproduce the issue in which thumbnails are recreated when it is not needed...
Usually if I rename or move a folder within XYplorer, the thumbs are not recreated, as expected. However sometimes they are, for example in this scenario. Let's say you have three folders
A────
└ B──
└ C─
with the image files in C. If you create a new folder under A, for example BB, and move C under it the thumbs are always recreated. It only happens if BB is new and was not visited before. If you click on BB first, and then move C there, the thumbs are not recreated, as expected. There may be other scenarios, this is the one I was able to catch and reproduce.
Yes, confirmed, there is something fishy. I'll check that later...
UPDATE: Yep, bug found and fixed!

Re: Slow thumbnails
Posted: 24 Jan 2018 13:48
by highend
text hexdump(formatdate("24.01.2018 11:08:02", "8char"),,"r"); //69 0E 5E D8 8E 0E E5 40
That's good enough, thanks!
Re: Slow thumbnails
Posted: 24 Jan 2018 15:36
by klownboy
admin wrote:Those dates are not necessarily the same. The the log is written only when a new cache is added, not when a cache is updated.
OK, thanks Don. You probably told me that a few years ago. So in this particular case where I'm rewritting the dat2 file with the new folder information and renaming the dbits file with the new hash, I should be updating XYthumbs.txt.
On second thought since there's an existing entry for the old "folder|thumb|hash", instead of deleting the entry and writing a new one, I could modify the existing one (i.e., change the folder path and hash, but keeping the thumbnail size since it doesn't change.
Re: Slow thumbnails
Posted: 24 Jan 2018 16:14
by admin
Should work.
Re: Slow thumbnails
Posted: 24 Jan 2018 22:11
by klownboy
On your beta example:
Code: Select all
text hexdump(formatdate("24.01.2018 11:08:02", "8char"),,"r"); //69 0E 5E D8 8E 0E E5 40
I had to use "-' instead of "." I assume that's simply a language thing. When I changed the "." to "-", I got the right answer.
So in the case of the VB date in the dat2 file script would this work?
Code: Select all
$VBdate = hexdump(formatdate(, "8char"),,"r");
Since "8char" is the format field, I assume will that give me the format result needed for the dat2 file - writing the 8 bytes starting at 277.
Re: Slow thumbnails
Posted: 24 Jan 2018 22:22
by admin
Yes, a language thing.
No, the hexdump is just for visual check. For your purpose you use it like this:
Re: Slow thumbnails
Posted: 24 Jan 2018 22:48
by admin
BTW, it would be easy for me to add a scripting command that does the whole job:
Code: Select all
Syntax: ThumbsCacheRename PathOld, PathNew
Interested?
Re: Slow thumbnails
Posted: 24 Jan 2018 23:32
by klownboy
Interested? Yes, sure I would. I've spent a bit of time on this and it all works (minus the VBdate input). I even got the XYthumb.txt file updated, but I can chock it up as another good learning experience. Besides I'd still have to put the new SC in a script. The "z" Zoom-to-fill designation in the dat2 file isn't affected. I haven't checked on 'paper', but I'm not concerned about the paper designation really. Thanks Don.
Edit: Obviously, it's up to you Don. I spent some time on it and started wondering why since not many (including me) would end up using it at least not very often. It would have been helpful when I setup a new laptop and the all my images were on a different drive than the desktop. So I guess it depends on how much work is involved.