Skip to content

queue API methods metadata

Steve edited this page Apr 29, 2020 · 1 revision

batchGetMetaData(options: IMetaDataOptions = {}):void ~> boolean

Reads metadata for each item in the batch content list. This will populate the metaData property of each entry in the list with iMetaData.

batchDeleteMetaData(data: IMetaData), options: IMetaDataOptions):void ~> boolean

Delete metadata items for each entry in the batch content list. The values of the metadata items will be ignored.

const metaData = {
  "iptc": {
    "Caption":false,
    "Time Created":false
  },
  "exif":{
    "Copyright holder":false
  } 
}

queue.batchDeleteMetaData(metaData);

batchDeleteMetaData((entry: IListEntry) => Promise<IMetaData | null>, options: IMetaDataOptions):void ~> boolean

Delete metadata items for each entry in the batch content list using a custom method.

// read metadata (as we want to check against existing data)
queue.batchGetMetaData();

// delete metadata if the entries metaData.iptc.Caption === "foo" 
queue.batchDeleteMetaData(
  (entry) => {
   return new Promise((resolve) => {
    let ret = null;
    if (entry.metaData && entry.metaData.iptc.Caption === "foo") {
    	ret = {
          "iptc":{
            "Caption":false
          }
        }
      }
      return resolve(ret);
   });
  }
);

batchRestoreMetaData(data: IMetaData), options: IMetaDataOptions):void ~> boolean

Restore metadata items for each entry in the batch content list from the source. The values of the metadata items will be ignored.

batchRestoreMetaData((entry: IListEntry) => Promise<IMetaData | null>, options: IMetaDataOptions):void ~> boolean

Restore metadata items for each entry in the batch content list using a custom method from the source.

batchSetMetaData(data: IMetaData), options: IMetaDataOptions):void ~> boolean

Set metadata items for each entry in the batch content list.

const metaData = {
  "iptc": {
    "Caption":"foor",
    "Time Created":"bar"
  },
  "exif":{
    "Copyright holder":"foo"
  } 
}

queue.batchSetMetaData(metaData);

batchSetMetaData((entry: IListEntry) => Promise<IMetaData | null>, options: IMetaDataOptions):void ~> boolean

Set metadata items for each entry in the batch content list using a custom method.

// read metadata (as we want to use existing data)
queue.batchGetMetaData();

// set metaData.iptc.Credit to metaData.iptc.Caption 
queue.batchSetMetaData(
  (entry) => {
   return new Promise((resolve) => {
    let ret = null;
    if (entry.metaData && entry.metaData.iptc.Caption) {
    	ret = {
          "iptc":{
            "Credit":entry.metaData.iptc.Caption
          }
        }
      }
      return resolve(ret);
   });
  }
);

Note: the methods above just add the commands to the queue. Execution starts when calling queue.run() or queue.runWithResults(). The ~> indicates the result type.
Clone this wiki locally