Auto assigning a category to entries from a drop folder in Kaltura

Drop folders are a very convenient way of adding media to Kaltura. One of the drop folder features is to auto assign a category to entries from it. Recently, I’ve been asked by one of our clients to add this feature to his Kaltura drop folder configuration. Well, it wasn’t as easy as I thought.

The easiest part was to find where the configuration is done. Naturally, it’s located in the drop folder configuration form in the admin console. ‘Metadata Profile ID’ and ‘Categories Metadata Field Name’ are the fields we need:

Drop folder configuration

As you can see, the configuration is not that trivial. It took me a while to understand what to do, but eventually I got it. 🙂
So, in this post I will show you how to auto assign a category to entries that are uploaded to your Kaltura from the drop folder.

Brief Introduction:

The configuration steps are shown below, but basically the auto assignment of the categories is done by assigning metadata to the ‘batchUser’. ‘batchUser’ is the user that uploads the entries from the drop folder to Kaltura. What we need to do is to create a metadata profile and assign a metadata object that contains the desired category ID to the ‘batchUser’. After that, the assignment of the categories to the entries is done automatically by the ‘batchUser’.

The Steps:

1. Create a dedicated category for drop folder entries

In order to assign a category to the entry, you need to create one first. Creating a category in Kaltura is very simple and done in the KMC, in the ‘Categories’ tab, which is located in the ‘Content’ tab. You can choose an existing category instead of creating a new one. Create/choose a category and save the category id for later use.

2. Create a metadata profile

Creating the metadata profile is done via the ‘Developer’ tab in the admin console.
Choose the ‘metadataProfile’ service and fill the required fields, as shown below:

Creating metadata profile

The fields:

metadataObjectTypeUSER (the metadata profile will be used for the ‘batchUser’ user, therefore the type is USER).
nameCategoryFromDropfolder (This is not important. You can use whatever name you like).
xsdDataThe xsd of the metadata profile. Metadata in Kaltura is represented by an xsd document. I have already created an xsd for the task, so you can just use mine:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="metadata">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element id="md_8D12600A-25F9-1266-0B8D-092A4B444DF6" name="CategoryId" minOccurs="0" maxOccurs="1" type="textType">
          <xsd:annotation>
            <xsd:documentation></xsd:documentation>
            <xsd:appinfo>
              <label>CategoryId</label>
              <key>CategoryId</key>
              <searchable>true</searchable>
              <timeControl>false</timeControl>
              <description></description>
            </xsd:appinfo>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:complexType name="textType">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string"/>
    </xsd:simpleContent>
  </xsd:complexType>
  <xsd:complexType name="dateType">
    <xsd:simpleContent>
      <xsd:extension base="xsd:long"/>
    </xsd:simpleContent>
  </xsd:complexType>
  <xsd:complexType name="objectType">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string"/>
    </xsd:simpleContent>
  </xsd:complexType>
  <xsd:simpleType name="listType">
    <xsd:restriction base="xsd:string"/>
  </xsd:simpleType>
</xsd:schema>

Notice, that the key name I use is ‘CategoryId’. You can use whatever key name you like, Just remember to use the same key name in the following steps.

Click ‘Send’ and create the metadata profile.
Save the metadata profile id for later use (You can find the newly created metadata profile id in the returned xml on the right).

3. Create a metadata object and assign it to the batchUser

Creating a metadata profile is done via the ‘Developer’ tab in the admin console.
Choose the ‘metadata’ service and fill the required fields, as shown below:

Create metadata object

The fields:

metadataProfileIdid of the metadata profile from the previous section.
objectTypeUSER
objectIdbatchUser
xmlData

<?xml version="1.0"?> <metadata> <CategoryId>1785</CategoryId> </metadata> 

Set the drop folder category id that you have created in section 1. Don’t forget to change the ‘CategoryId’ key name, in case you used a different one in section 2.

4. Set the drop folder configuration

The relevant fields in the drop folder configuration are ‘Metadata Profile ID’ and ‘Categories Metadata Field Name’.
Set the fields with the metadata profile id and the key name from section 3 as shown below, and save the configuration.

Drop folder configuration

That’s it!

Feel free to post your comments and/or questions in the designated section below. Oh, and don’t forget to visit our website! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *