Document, jsnode, asset API?

I’m still working on the JavaScript reference. I’m also in the progress of making a new interface for it, so you can write custom nodes in JavaScript, instead of pasting JS into a specific node…

At any rate- I’ve just added a public API to the latest version of Retrobatch for getting and setting metadata values in JavaScript. Here’s what it looks like:

function processAsset(document, jsnode, asset) {
    
    // List all values and keys. asset.metaData() returns a dictionary.
    console.log(asset.metaData());
    
    // Or retrieve a specific metadata value.
    console.log(asset.metaValueForPropertyName_inMetaDictionaryName_("CopyrightNotice", "{IPTC}"));
    
    console.log(asset.metaValueForPropertyName_inMetaDictionaryName_("ColorModel", null));
    
    // Or set a value:
    asset.setMetaValue_forPropertyName_inMetaDictionaryName_("(c) Flying Meat Inc", "CopyrightNotice", "{IPTC}");
    
    return true;
}

You’ll need the latest build of Retrobatch to use it: Latest Builds from Flying Meat

If you’d like to use the newer interface I’m working on (scheduled for v1.2), I’ve got an example on this forum post: Sort by aspect ratio

I think once I finish this up, it’ll be the way to go.

1 Like