| 1 |
<?php |
<?php |
| 2 |
//$Id: video_youtube.module,v 1.2.4.4 2009/11/07 17:00:23 heshanmw Exp $ |
//$Id: video_youtube.module,v 1.2.4.5 2009/11/07 17:00:56 heshanmw Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Enable Youtube support for video module. |
* Enable Youtube support for video module. |
| 150 |
// we have a good URL. Let's check that the video is available on Youtube and that it is embeddable. |
// we have a good URL. Let's check that the video is available on Youtube and that it is embeddable. |
| 151 |
// the approach used here is to return errors only if Youtube explicitely says "an error has occurred" |
// the approach used here is to return errors only if Youtube explicitely says "an error has occurred" |
| 152 |
$id = _video_youtube_get_id($node->vidfile); |
$id = _video_youtube_get_id($node->vidfile); |
| 153 |
|
//test |
| 154 |
|
//$video_entry = _video_apiclient_youtube_video_entry($id); |
| 155 |
|
|
| 156 |
// jlampton changed the youtube validation url |
// jlampton changed the youtube validation url |
| 157 |
//$response = _video_apiclient_youtube_request('gdata.youtube.com/feeds/api/videos', array('video_id' => $id)); |
//$response = _video_apiclient_youtube_request('gdata.youtube.com/feeds/api/videos', array('video_id' => $id)); |
| 158 |
// if(isset($response['ERROR'])) { |
// if(isset($response['ERROR'])) { |
| 221 |
if (count($_POST)) { |
if (count($_POST)) { |
| 222 |
if ($_POST['vidfile'] == $node->vidfile) { |
if ($_POST['vidfile'] == $node->vidfile) { |
| 223 |
_video_image_thumbnail_debug(t('No new video to thumbnail')); |
_video_image_thumbnail_debug(t('No new video to thumbnail')); |
| 224 |
return NULL; |
//return NULL; |
| 225 |
} |
} |
| 226 |
if ($_POST['tempimage']['fids']['_original']) { |
if ($_POST['tempimage']['fids']['_original']) { |
| 227 |
_video_image_thumbnail_debug(t('Video already thumbnailed')); |
_video_image_thumbnail_debug(t('Video already thumbnailed')); |
| 228 |
return NULL; |
//return NULL; |
| 229 |
} |
} |
| 230 |
$vidfile = $_POST['vidfile']; |
$vidfile = $_POST['vidfile']; |
| 231 |
} else { |
} |
| 232 |
|
else { |
| 233 |
$vidfile = $node->vidfile; |
$vidfile = $node->vidfile; |
| 234 |
} |
} |
| 235 |
|
|
| 236 |
//get the video id |
//get the video id |
| 237 |
$id = _video_youtube_get_id($vidfile); |
$id = _video_youtube_get_id($vidfile); |
| 238 |
// get thumbnail url |
// get thumbnail url |
| 239 |
$thumbnail_url = _video_apiclient_youtube_get_thumbnail_url($id); |
//$thumbnail_url = _video_apiclient_youtube_get_thumbnail_url($id); |
| 240 |
|
$thumbnail_url = 'http://img.youtube.com/vi/'.$id.'/2.jpg '; |
| 241 |
return _video_image_get_thumb_file_object($thumbnail_url, $id); |
$img = _video_image_get_thumb_file_object($thumbnail_url, $id); |
| 242 |
|
//return _video_image_get_thumb_file_object($thumbnail_url, $id); |
| 243 |
|
return $img; |
| 244 |
} |
} |
| 245 |
|
|
| 246 |
|
|