Every now and then you may want to perform certain operations on the metadata OF EVERY image of an album project, including sub folders. You may for instance want to clear all comments from images, convert the case, add a certain keyword to all images, copy the comments to the titles fields or vice versa, or swap them etc etc. We could in theory write up tools or make user interfaces for these needs but I want to show just how flexible it is to use jAlbum's system console with its interactive scripting language executor.
All examples here are assuming you're at least using jAlbum 17.1 and using the Groovy scripting engine.
Say you wish to copy the comments of each image to the title field, this can be done with the following scriptlet that relies on the very central AlbumObject API that jAlbum provides:
I hope you get the idea . I happened to show two ways of iterating all album objects: the classic for loop and the forEach method and lambda expressions. Use whatever you prefer. With basic stuff like this it doesn't matter which one you choose. The lambda based construct allows for more advanced stuff like this example that finds and prints the full path of all album objects that contains "David" in the keyword list:
This version scans and prints all album objects containing the keyword "David" in parallel, i.e. by using multiple threads. If the operation performed on each object is of a heavier kind, then such things matter. Here's for instance an example that prints the name of each image of an album along with its shutter speed:
This example is using Groovy's nifty null safe dereferencing (?.) as some images may not have camera metadata, and hence no "meta" object to look up EXIF data in. It also demonstrates Groovy's shorthand syntax for looking up values in maps. "meta" is actually a key in the vars map, so you'd ordinarily need to write ao.vars.get("meta") but Groovy allows the neat shorthand ao.vars.meta
If you want to manipulate objects in the current folder only, simply change "decendants" to "children".