Document, jsnode, asset API?


#1

Hello! New to Retrobatch. I like what I see! Is there an API for document, jsnode, and asset in the JS node callbacks? How can I read specific properties like lat/long in EXIF? The examples are a good start:

https://flyingmeat.com/retrobatch/docs/javascript/#printing-out-useful-information-about-an-image

but is there any way to explore what’s available?

Thanks much!


#2

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: http://flyingmeat.com/download/latest/#retrobatch

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.


#3

That’ll work! And I like the plugin concept as well. :rocket:


#4

We’ve got some new documentation available online now: https://flyingmeat.com/retrobatch/jsapi/

Feedback is always welcome.