I would assume, that this procedure should be quite fast
Yep, but it's not. Here's a log from a test folder. It took 4.3 seconds to generate the files with ExifTool and then 15 seconds to copy the modify data:
Remove time from the entry. Quicktime-MediaDuration is a string that confuses the script, which then returns the current date. I might add a new type to handle entries like that.
script seems not to work on network-shares
True, the current version blocks networks. To unblock, simply delete
if (item.path.drive == 0) return;
from the script. That's line 159 in the original version.
First of all, Your speed & quality answering is awsome! Thanks!
OK, I understand, ... but why do You set the lastmodiefieddate?
I thought of just read the FileModifyDate from movie-file and just read the FileCreateDate from the correspondig exif-metadata-cachefile - at that point, at which you want to open that for reading the cached exif-metadata. Not looking for that information inside, look for the desired date of the moviefile & cachefile itself.
with that check the first file above-left should not need a recreation of cachefile, because left one hasn't been altered after cache creation.
The second one has on the left side a FileModifyDateafter the FileCreateDate on the right - possibly changed metadata, could lead to recreation of right fil
Shocking, the "Time" and "Network"-Thing works now like charme!
... also having an idea regarding special characters?
Found a solution for that "lastmodified"-thing... could be maybe nicer, but works! I didn't program in JS before...
Now, cachefile will automatically be actualised, if moviefile has been altered. Checking for maxCacheAge isn't needed anymore. And generating of new cachefiles will only be done for new files, not the whole folder anymore.
(Re)generating of cachefiles seems to be as fast as before, but recreating procedure (after maxCacheAge is reached) is significantally faster. This is remarkable for folders with many files in it.
Canged part of function onColumn(scripColData) as described below:
function OnColumn(scriptColData) {
var item = scriptColData.item;
if (item.is_dir) return;
/* if (item.path.drive == 0) return; */
var cacheFile = fsu.GetItem(cacheFolder + '\\' + String(item.realpath).replace(':', '') + '.txt');
var cutOffDate = DOpus.Create().Date();
cutOffDate.Sub(maxCacheAge, 'm'); // Current date minus ... minutes
// Inserted this IF for touching existing cacheFile only if mediafile has been altered AFTER generated cachefile and then only for that single file
if (fsu.GetItem(cacheFile).modify<fsu.GetItem(item).modify) {
cmd.RunCommand('Delete FORCE QUIET FILE="' + cacheFile + '"');
Log('Processing altered File "' + item.name + '" in "' + item.path + '" with ExifTool...');
var cmdLine = '"' + exeExifTool + '" -short -duplicates -unknown -groupNames -tab -textOut! "' + cacheFile.path + '\\%f.%e.txt" -extension "*" "' + String(item).replace(/\\$/, '') + '"';
wsh.Run(cmdLine, 0, true);
cmd.RunCommand('SetAttr FILE="' + cacheFile.path + '" META "lastmodifieddate:' + DOpus.Create().Date().Format('D#yyyy-MM-dd T#HH:mm:ss') + '"');
Log('... done!');
}
// changed following exiftool command for ignoring maxCacheAge and then only processing single files instead of the whole folder in one step
if (!fsu.Exists(cacheFile)) {/* || fsu.GetItem(cacheFile.path).modify.Compare(cutOffDate) < 0) */
Log('Processing new File "' + item.name + '" in "' + item.path + '" with ExifTool...');
var cmdLine = '"' + exeExifTool + '" -short -duplicates -unknown -groupNames -tab -textOut! "' + cacheFile.path + '\\%f.%e.txt" -extension "*" "' + String(item).replace(/\\$/, '') + '"';
wsh.Run(cmdLine, 0, true);
cmd.RunCommand('SetAttr FILE="' + cacheFile.path + '" META "lastmodifieddate:' + DOpus.Create().Date().Format('D#yyyy-MM-dd T#HH:mm:ss') + '"');
Log('... done!');
}
// nothing changed afterwards comparing to original script ...
if (!fsu.Exists(cacheFile)) {
Log('*** Error: cache file could not be created! ***');
Log('item: ' + item);
Log('cacheFile: ' + cacheFile);
Log('');
Log('cmdLine:');
Log(cmdLine);
Log('');
return;
}
so for me only the part of special letters like Ä or ß are still up... and, as I personally only need "quicktime" metadata, I will look for a possibility to filter exiftool output for that.... Any idea?
UTF8 encoded metadata (Umlauts etc.) is displayed properly. Almost everywhere... who can spot the exceptions?
Cache will be rebuilt, if the item's modify date is more current than the cache folder's
Cache will be rebuilt, if the flag onAnyChange is true and the item's modify date differs from the cache file's (slower because of enhanced record keeping)
Logging reveals more info
Any testing and feedback is welcome. I'll update the main post after a bit of waiting time.
Works very fine as far as I see... with one exception...
The metadata itself will be displayed correctly with 'Umlaute', but the columntitle won't:
This should be 'Auflösung' new DefineColumn('Composite', 'ImageSize', '', 'Auflösung', 'Auflösung', '', '', ''),
And, two questions:
If one single file is being updatet, the single cachefile will be re-done. But all modify dates of cachefiles inside that folder will be raised. Why?
I tried a "comment-out" for all "SetATTR"-lines, but it still will be altered...
Is it possible to implement a function like a blacklist for filetypes shouldn't be cached?
Display of UTF8 encoded stuff is even better, but still not perfect.
Now cache files will only be generated or renewed for files that are visible in the tab. Files that are hidden by a filter or are siblings of files in collections are skipped.
The set extToIgnore can be filled with extensions the script should always ignore.
Cache will be rebuilt, if the item's modify date is more current than the cache file's (was: folder).
Removed the onAnyChange flag
Removed the maxCacheAge option
New syntax for column definition
The column definition syntax has changed. If you want to copy your modifications to the new script,
Thank you. I am grateful and excited to try the new version, but I keep getting an error message when I add the file:
The only thing I changed in the file was the path to Exiftool on my system, which I copied and pasted from the file I previously used that did not have errors. I checked that line carefully to make it was identical.
I don't know how to determine what the error is.
Can someone please help?
Thank you Leo. Because of your comment, I looked at the punctuation, and I had a curly/curved single quote mark. I replaced it with a straight one and now it works.
This script is very helpful to me, but not all metadata fields with dates are displaying those dates.
Because adding a Date Taken to a photo with Directory Opus results in that date being added to the Exif DateTimeOriginal field only, I made a button with a command to copy the Exif DateTimeOriginal to other date fields. When I use that button/command, I can see (using ExifToolGUI and another application) that the dates have been copied to the fields I specified, but they are not displaying in Directory Opus. I refreshed, closed and re-opened Directory Opus, and the dates are still not being displayed. I even re-started my PC just to be sure.
The fields that are not displaying a date that IS present are: Exif CreateDate and XMP CreateDate:
If you have modified column definitions, you need to replace push_back(DefineColumn( with push_back(GetColumnMap( after copying them to the new version
If you used the specialExt feature, you need to recreate it as a wildcard. Should be easy, examples are in the script.
I've tried about 16 variations on the path but am still getting "no exif tool found"
Is there something missing from what I've done?
// -- Adjust to your system. Copy the path to exiftool.exe with 'Edit - Copy Other - Copy Full Pathnames (Double Backslashes)'
var exeExifTool = fsu.Resolve('C:\\exiftool\\exiftool.exe');
// -- Adjust to your preferences. Use double backslashes.
var cacheFolder = fsu.Resolve('/profile\\C:\\Users\\bri\\ExifToolCache');