You are here

function kaltura_import_entry in Kaltura 5

Same name and namespace in other branches
  1. 6.2 includes/kaltura.admin.inc \kaltura_import_entry()
  2. 6 includes/kaltura.admin.inc \kaltura_import_entry()
  3. 7.2 includes/kaltura.admin.inc \kaltura_import_entry()
1 call to kaltura_import_entry()
kaltura_import_entries in includes/kaltura.admin.inc

File

includes/kaltura.admin.inc, line 554

Code

function kaltura_import_entry($entry_details) {
  global $user;
  $node = new stdClass();
  if ($entry_details['type'] == 1) {
    $type = 'entry';
  }
  elseif ($entry_details['type'] == 2) {
    $type = 'mix';
  }
  else {
    $type = '';
  }
  $node->type = 'kaltura_' . $type;
  $node->title = $entry_details['name'];
  $node->kaltura_entryId = $entry_details['id'];
  $node->uid = $user->uid;
  $node->body = '';
  $node->status = 0;
  $node->created = time();
  $node->comment = FALSE;
  $node->changed = time();
  $node->promote = 0;
  $node->sticky = 0;
  $node->kstatus = $entry_details['status'];
  $node->kaltura_entry_data = serialize($entry_details);
  $node->kaltura_tags = $entry_details['tags'];
  $node->kaltura_admin_tags = '';
  $node->kaltura_media_type = $entry_details['mediaType'];
  $node->kaltura_duration = $entry_details['length_in_msecs'] ? (int) ($entry_details['length_in_msecs'] / 1000) : $entry_details['duration'];
  $node->kaltura_thumbnail_url = $entry_details['thumbnailUrl'];
  $node->kaltura_partner_data = 'imported ' . $type;
  $node->kaltura_source = $entry_details['source'];
  $node->kaltura_source_id = $entry_details['sourceId'];
  $node->kaltura_source_link = $entry_details['sourceLink'];
  $node->kaltura_width = $entry_details['width'];
  $node->kaltura_height = $entry_details['height'];
  $node->kaltura_download_url = $entry_details['downloadUrl'];
  $node->kaltura_media_date = $entry_details['mediaDate'];
  $node->kaltura_views = $entry_details['views'];
  $node->kaltura_plays = $entry_details['plays'];
  $node->kaltura_votes = $entry_details['votes'];
  $node->kaltura_rank = $entry_details['rank'];
  $node->kaltura_total_rank = $entry_details['total_rank'];
  node_save($node);
  module_invoke('node_kaltura_' . $type, 'hook_insert', $node);
  drupal_set_message('Kaltura item imported: ' . l($node->title, 'node/' . $node->nid) . ' (id: ' . $node->kaltura_entryId . ')');
}