Skip to main content

Example Addon settings

For example, if SCENE_CLASSIFICATION addon is enabled for user, user settings "addons" is as follows (retrieved via User Settings API):

{
"addons": {
"SCENE_CLASSIFICATION": {
"title": "ML-based detection and classification of scenes in images",
"description": "ML-based detection and classification of scenes in images",
"added": true,
"enabled": true,
"settings": {
"event-hooks": {
"file-saved": {
"enabled": false,
"content_types": [
"image/*"
]
},
"file-data-updated": {
"enabled": true,
"content_types": [
"image/*"
],
"schema_criteria": {
"fields": {
"assetCode": "GM",
"originalAsset": "Y"
},
"data_schema_id": 1
}
},
"disposition": {
"update_metadata": true,
"confidence_threshold": 0.5
}
}
}
}
}
}
  • event-hooks - specifies the events for which the addon is enabled/disabled
    • file-saved , file-data-updated, etc - specifies the event when the addon is invoked (see Asset Events)
      • enabled - specifies whether the addon is enabled for the event
      • content_types - optional, specifies the content types for which the addon is enabled
      • schema_criteria - optional, specifies the Search API - Schema search criteria that the asset must satisfy (see Search API)
  • disposition - specifies the disposition of the asset after the addon is processed
    • update_metadata - if set to true , the addon will update the asset metadata if it produces any metadata, such as scene labels.
    • confidence_threshold - value can be between 0.0 and 1.0. This is used if the addon produces outputs with confidence scores. Only the outputs with confidence score above the provided value will be included in metadata (for example scene labels above confidence score of 0.5).

In the above example,

  • the addon is enabled for file-data-updatedevent for image/* asset content type.
  • The addon will be invoked for the asset metadata has assetCode=GM and originalAsset=Y and the data schema id is 1
  • the addon API will be called with the given disposition as payload

X-FileSpin-Post-Process-Service header

All services that use disposition to update asset metadata MUST set the X-FileSpin-Post-Process-Service header to the name of the service (set the value to the addon key, SCENE_CLASSIFICATION for example).
This is used to prevent the service from invoking itself recursively.