You are here

function scald_dailymotion_video in Scald: Media Management made easy 6

Get information on a specific video.

Parameters

$id: The video id

Return value

object An object containing the video informations. For information on the object format, see @scald_dailymotion_feed.

1 call to scald_dailymotion_video()
scald_dailymotion_register in scald_dailymotion/scald_dailymotion.module
Creates an atom based on a DailyMotion video id or an object containing the video informations..

File

scald_dailymotion/scald_dailymotion.module, line 216
Defines a DailyMotion provider for Scald.

Code

function scald_dailymotion_video($id) {
  $url = DAILYMOTION_OEMBED . '?url=' . urlencode(DAILYMOTION_WEB . $id) . '&format=json';
  $response = drupal_http_request($url);
  if ($response->code >= 200 && $response->code < 400) {
    $data = json_decode($response->data);
    $item = new stdClass();
    $item->id = $id;
    $item->title = $data->title;
    $item->thumbnail = array(
      'src' => $data->thumbnail_url,
      'width' => $data->thumbnail_width,
      'height' => $data->thumbnail_height,
    );
    $item->author = $data->author_name;
  }
  else {
    $item = FALSE;
  }
  return $item;
}