You are here

public function KalturaHelpers::getMetadataProfile in Kaltura 7.3

Retrieves metadata profile.

Parameters

int $profile_id: Profile ID.

Return value

\KalturaMetadataProfile|null Metadata profile object.

File

kaltura_client/kaltura_helpers.php, line 371

Class

KalturaHelpers
Class KalturaHelpers.

Code

public function getMetadataProfile($profile_id) {
  $profiles =& drupal_static('KalturaHelpers::getMetadataProfile', array());
  if (!isset($profiles[$profile_id])) {
    $cid = 'kaltura:metadata_profile:' . $profile_id;
    if ($cache = cache_get($cid)) {
      $profiles[$profile_id] = $cache->data;
    }
    else {
      try {
        $client = $this
          ->getKalturaClient(TRUE);
        $plugin = KalturaMetadataClientPlugin::get($client);
        $profiles[$profile_id] = $plugin->metadataProfile
          ->get($profile_id);
      } catch (Exception $e) {
        watchdog_exception('kaltura', $e);
      }
      if (!empty($profiles[$profile_id])) {
        cache_set($cid, $profiles[$profile_id]);
      }
    }
  }
  return !empty($profiles[$profile_id]) ? $profiles[$profile_id] : NULL;
}