'myspace',
'name' => $name,
'url' => VIDEO_CCK_MYSPACE_MAIN_URL,
'settings_description' => t('These settings specifically affect videos displayed from !provider.', array('!provider' => l($name, VIDEO_CCK_MYSPACE_MAIN_URL, array('target' => '_blank')))),
'supported_features' => $features,
);
}
function video_cck_myspace_settings() {
$form = array();
return $form;
}
function video_cck_myspace_request($code, $cacheable = TRUE) {
$args = array();
return module_invoke('emfield', 'request_xml', 'myspace', "http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=$code", $args, $cacheable);
}
/**
* this scrapes the thumbnail from the video page and caches it
*/
function _video_cck_myspace_scrape_thumbnail($video, $cached = true) {
if (!$cached || !$cache = cache_get('myspace:thumbnail:'. $video, 'cache')) {
$vidid = substr($video, 0, 10);
if ($str = file_get_contents("http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=$vidid")) {
// grab videos channel-id first
$channel_id = preg_replace('/.*tvchanid=([0-9]+);.*/si', '\1', $str);
if (is_numeric($channel_id)) {
// now from channel-page grab videos thumbnail
$str2 = file_get_contents("http://vids.myspace.com/index.cfm?fuseaction=vids.viewVideos&channelid=$channel_id");
if ($str2) {
$picturelink = preg_replace('@.*href="[^"]+'. $vidid .'"[^>]+>]+src="([^"]+)".*@si', '\1', $str2);
if ($picturelink) {
$thumbnail = $picturelink;
cache_set('myspace:thumbnail:'. $video, 'cache', $thumbnail, time() + 3600);
}
}
}
}
}
else {
$thumbnail = $cache->data;
}
return $thumbnail;
}
function video_cck_myspace_extract($embed) {
// What's That Floating In The Water Part 1
Add to My Profile | More Videos
return array(
'@src="myspace\.com/index.cfm\?fuseaction=vids\.individual&videoid=([^&"]+)@i',
'@myspace\.com/index\.cfm\?fuseaction=vids\.individual&videoid=([^&"]+)@i',
'@src="myspacetv\.com/index.cfm\?fuseaction=vids\.individual&videoid=([^&"]+)"@i',
'@myspacetv\.com/index\.cfm\?fuseaction=vids\.individual&videoid=([^&"]+)@i',
);
}
function video_cck_myspace_video_link($video_code) {
return 'http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid='. $video_code;
}
function theme_video_cck_myspace_flash($embed, $width, $height) {
static $count = 0;
if ($embed) {
$embed = check_plain($embed);
$width = (integer) $width;
$height = (integer) $height;
$output .= '';
}
$count++;
return $output;
}
function video_cck_myspace_thumbnail($field, $item, $formatter, $node, $width, $height) {
return _video_cck_myspace_scrape_thumbnail($item['value']);
}
function video_cck_myspace_video($embed, $width, $height, $field, $item) {
$output = theme('video_cck_myspace_flash', $embed, $width, $height);
return $output;
}
function video_cck_myspace_preview($embed, $width, $height, $field, $item) {
$output = theme('video_cck_myspace_flash', $embed, $width, $height);
return $output;
}