View source
<?php
define('EMVIDEO_MYSPACE_MAIN_URL', 'http://vids.myspace.com/');
define('EMVIDEO_MYSPACE_API_URL', 'http://developer.myspace.com/community/');
define('EMVIDEO_MYSPACE_DATA_VERSION', 1);
function emvideo_myspace_info() {
$features = array(
array(
t('Autoplay'),
t('No'),
'',
),
array(
t('RSS Attachment'),
t('No'),
'',
),
array(
t('Thumbnails'),
t('Yes'),
'',
),
array(
t('Duration'),
t('Yes'),
'',
),
);
return array(
'provider' => 'myspace',
'name' => t('MySpace'),
'url' => EMVIDEO_MYSPACE_MAIN_URL,
'settings_description' => t('These settings specifically affect videos displayed from <a href="@provider" target="_blank">MySpace</a>.', array(
'@provider' => EMVIDEO_MYSPACE_MAIN_URL,
)),
'supported_features' => $features,
);
}
function emvideo_myspace_settings() {
$form = array();
return $form;
}
function emvideo_myspace_data_version() {
return EMVIDEO_MYSPACE_DATA_VERSION;
}
function emvideo_myspace_data($field, $item) {
$data = array();
$data = emfield_request_xml('Myspace', 'http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=' . $item['value'], array(), TRUE, FALSE, $item['value']);
$data['emvideo_data_version'] = $data['emvideo_myspace_version'] = EMVIDEO_MYSPACE_DATA_VERSION;
$data['emvideo_myspace_thumbnail'] = $data['ITEM']['MEDIA:THUMBNAIL'][1]['URL'];
return $data;
}
function emvideo_myspace_extract($url) {
return array(
'@src="myspace\\.com/index.cfm\\?fuseaction=vids\\.individual&videoid=([^&"]+)@i',
'@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',
'@myspacetv\\.com/index\\.cfm\\?fuseaction=vids\\.individual&videoid=([^&"]+)@i',
);
}
function emvideo_myspace_embedded_link($video_code) {
return 'http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=' . $video_code;
}
function emvideo_myspace_duration($item) {
if (!isset($item['data']['emvideo_myspace_version'])) {
$item['data'] = emvideo_myspace_data(NULL, $item);
}
return isset($item['data']['ITEM']['MEDIA:CONTENT'][1]['DURATION']) ? $item['data']['ITEM']['MEDIA:CONTENT'][1]['DURATION'] : 0;
}
function theme_emvideo_myspace_flash($embed, $width, $height) {
static $count = 0;
if ($embed) {
$embed = check_plain($embed);
$width = (int) $width;
$height = (int) $height;
$output .= '<object height="' . $height . 'px" width="' . $width . 'px" >
<param name="allowFullScreen" value="true"/>
<param name="wmode" value="transparent"/>
<param name="movie" value="http://mediaservices.myspace.com/services/media/embed.aspx/m=' . $embed . ',t=1,mt=video" />
<embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m=' . $embed . ',t=1,mt=video" width="' . $width . '" height="' . $height . '" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"></embed></object>';
}
$count++;
return $output;
}
function emvideo_myspace_thumbnail($field, $item, $formatter, $node, $width, $height) {
return $item['data']['emvideo_myspace_thumbnail'];
}
function emvideo_myspace_video($embed, $width, $height, $field, $item, $node) {
$output = theme('emvideo_myspace_flash', $embed, $width, $height);
return $output;
}
function emvideo_myspace_preview($embed, $width, $height, $field, $item, $node) {
$output = theme('emvideo_myspace_flash', $embed, $width, $height);
return $output;
}
function emvideo_myspace_emfield_subtheme() {
return array(
'emvideo_myspace_flash' => array(
'arguments' => array(
'embed' => NULL,
'width' => NULL,
'height' => NULL,
'autoplay' => NULL,
),
'file' => 'providers/myspace.inc',
),
);
}
function emvideo_myspace_content_generate() {
return array(
'http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=62472581&searchid=ea1f646c-39df-4963-b93d-f916b019f1a1',
'http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=62472739&searchid=ea1f646c-39df-4963-b93d-f916b019f1a1',
'http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=62473325&searchid=ea1f646c-39df-4963-b93d-f916b019f1a1',
);
}