Sidecar metadata

When scanning a storage, you can attach metadata via sidecar files. Those can be in the format XML, CSV or JSON. You also have the ability to call an external URL to convert the sidecar metadata in to the format required by iconik. The metadata has to match the Metadata View that has been associate to the storage in the Scan settings.

File naming

A sidecar file will be matched if it has the same name as the original file but with an .xml, .csv or .json extension. Either replacing the original extension, or in addition to it.

Examples:

filename.mp4
filename.json
filename.mp4
filename.mp4.xml

Sidecar metadata format

The format is the same as the API for metadata. An example JSON sidecar looks like this:

{
    "metadata_values": {
        "_gcvi_tags": {
            "field_values": [
                {
                    "value": "comedy"
                },
                {
                    "value": "romance"
                },
                {
                    "value": "drama"
                }
            ]
        },
        "episode": {
            "field_values": [
                {
                    "value": "2"
                }
            ]
        },
        "path": {
            "field_values": [
                {
                    "value": "/movies/movie_1/movie-001.mp4"
                }
            ]
        },
        "season": {
            "field_values": [
                {
                    "value": "1"
                }
            ]
        }
    }
}

Example XML sidecar:

<metadata_view>
    <metadata_values>
        <_gcvi_tags>
            <field_values>
                <score>1</score>
                <value>Car</value>
            </field_values>
        </_gcvi_tags>
        <age>
            <field_values>
                <value>2</value>    
            </field_values>
        </age>
        <description>
            <field_values>
                <value>Description</value>
            </field_values>
        </description>
        <first_name>
            <field_values>
                <value>Test Name</value>
            </field_values>
        </first_name>
    </metadata_values>
</metadata_view>

Example CSV sidecar:

_gcvi_tags,age,description,first_name
Car (1),2,Description,Test Name

Metadata conversion

If you don't have sidecars that has the correct format you can call an external URL for translation. It will do a POST request to the URL with the content of the file, and expect a JSON in the format above as a result.

Example Google Cloud Function (In Python) that converts a file of the format key=value to an iconik metadata JSON:

import functions_framework

@functions_framework.http
def hello_http(request):

    data = request.get_data().decode("utf-8")

    print("DATA: %s" % str(data))

    res = {
        "metadata_values": {
        }
    }

    for line in data.split("\n"):
        print("LINE: %s" % line)
        if "=" in line:
            key, value = line.split("=")
            res['metadata_values'][key] = {
                    "field_values": [
                        {
                            "value": value
                        },
                    ]
                }

    print("RES: %s" % str(res))
    return res

Example key value pair input to the above function:

_gcvi_tags=Car (1)
age=2
description=Video of a car
first_name=John

Learn more