'metacafe',
'name' => t('MetaCafe'),
'url' => EMVIDEO_METACAFE_MAIN_URL,
'settings_description' => t('These settings specifically affect videos displayed from MetaCafe.', array('@provider' => EMVIDEO_METACAFE_MAIN_URL)),
'supported_features' => $features,
);
}
function emvideo_metacafe_settings() {
$form = array();
return $form;
}
/**
* we're going to handle our own matches, unless someone can come up with a regex that will match this better
*/
function emvideo_metacafe_extract($embed) {
// http://www.metacafe.com/watch/479957/gorilla_prank/
if ($embed && preg_match('@metacafe\.com/watch/(.[^/]*)/(.[^/]*)/@i', $embed, $matches)) {
return $matches[1] .'/'. $matches[2];
}
else if ($embed && preg_match('@metacafe\.com/watch/(.[^/]*)/(.*)@i', $embed, $matches)) {
return $matches[1] .'/'. $matches[2];
}
//
Gorilla Prank - Celebrity bloopers here
else if ($embed && preg_match('@metacafe\.com/fplayer/(.[^/]*)/(.[^\.]*)\.@i', $embed, $matches)) {
return $matches[1] .'/'. $matches[2];
}
return FALSE;
}
/**
* hook emvideo_PROVIDER_embedded_link($video_code)
* returns a link to view the video at the provider's site.
* @param $video_code
* The string containing the video to watch.
* @return
* A string containing the URL to view the video at the original provider's site.
*/
function emvideo_metacafe_embedded_link($video_code) {
return 'http://www.metacafe.com/watch/'. $video_code .'/';
}
function theme_emvideo_metacafe_flash($embed, $width, $height, $autoplay) {
$output = '';
if ($embed) {
$autoplay = $autoplay ? '?playerVars=autoPlay=yes' : '';
$output .= '';
}
return $output;
}
function emvideo_metacafe_thumbnail($field, $item, $formatter, $node, $width, $height) {
// http://www.metacafe.com/thumb/[VIDEOID].jpg
$values = explode('/', $item['value'], 2);
return 'http://www.metacafe.com/thumb/'. $values[0] .'.jpg';
}
function emvideo_metacafe_video($embed, $width, $height, $field, $item, $node, $autoplay) {
$output = theme('emvideo_metacafe_flash', $embed, $width, $height, $autoplay);
return $output;
}
function emvideo_metacafe_preview($embed, $width, $height, $field, $item, $node, $autoplay) {
$output = theme('emvideo_metacafe_flash', $embed, $width, $height, $autoplay);
return $output;
}
/**
* Implementation of hook_emfield_subtheme.
*/
function emvideo_metacafe_emfield_subtheme() {
return array(
'emvideo_metacafe_flash' => array(
'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
'file' => 'providers/metacafe.inc'
)
);
}