Emfield and tudou

由 jredding@drupal.org 于 周三, 2008-03-05 02:29 提交。

昨天在Boston DrupalCon, 我门有一个参加叫Drupal在中国。John Zhu, Robert Scales 和我。 我们说的时候Aaron winborn 做了一个extension里面emfield module. 现在emfield module 可以用"土豆(tudou.com)". 看看那个短片有Aaron winborn.
对不起我有老外话。 ;)
http://www.youtube.com/v/VvMJCYGZJV0

Yesterday in DrupalCon Boston John Zhu, Robert Scale and I had a session entitled "Drupal in China". While we were speaking Aaron winborn, creator of the emfield module added in support for tudou.com. Now you can put tudou video into Drupal even easier!
http://www.youtube.com/v/VvMJCYGZJV0

很好的视频模块,我

很好的视频模块,我一直在使用,也扩展了国内的几大视频网站。评论上传不了附件,inc文件就直接帖到后面了,估计需要的也不多,就不另外开帖了。
包括土豆、优酷、ku6、56。
其中土豆网可以直接输入视频所在网址、土豆提供的嵌入代码。比如,下面这些代码都可以解析到同一个视频:
http://www.tudou.com/programs/view/PTmspp5AsH8/
http://www.tudou.com/v/PTmspp5AsH8
http://www.tudou.com/v/PTmspp5AsH8

<?php
<object width="400" height="300"><param name="movie" value="http://www.tudou.com/v/PTmspp5AsH8"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="http://www.tudou.com/v/PTmspp5AsH8" type="application/x-shockwave-flash" width="400" height="300" allowFullScreen="true" wmode="transparent" allowScriptAccess="always"></embed></object>
?>

优酷直接提供了以flash的链接。优酷和56直接输入嵌入代码就可以了
看看演示

<?php
// $Id: tudou.inc,v 1.3 2007/09/06 22:18:25 aaron Exp $

define('VIDEO_CCK_tudou_MAIN_URL', 'http://www.tudou.com');

function
video_cck_tudou_info() {
 
$name = t('土豆(tudou)');
 
$features = array(
    array(
t('Autoplay'), t('no'), ''),
    array(
t('RSS Attachment'), t('No'), ''),
    array(
t('Thumbnails'), t('No'), ''),
  );
  return array(
   
'provider' => 'tudou',
   
'name' => $name,
   
'url' => VIDEO_CCK_tudou_MAIN_URL,
   
'settings_description' => t('These settings specifically affect videos displayed from !provider.', array('!provider' => l($name, VIDEO_CCK_tudou_MAIN_URL, array('target' => '_blank')))),
   
'supported_features' => $features,
  );
}

function
video_cck_tudou_settings() {
 
$form = array();
  return
$form;
}

function
video_cck_tudou_extract($embed) {
  return array(
   
'@tudou\.com/v/([^"\&]+)@i',
   
'@tudou\.com/programs/view/([^"\&]+)/@i',
  );
}

function
video_cck_tudou_video_link($video_code) {
  return
'http://www.tudou.com/programs/view/' . $video_code;
}

function
theme_video_cck_tudou_flash($embed, $width, $height) {
  if (
$embed) {
   
$related = variable_get('video_cck_tudou_show_related_videos', 0);
   
$output .= "<object width=\"400\" height=\"300\"><param name=\"movie\" value=\"http://www.tudou.com/v/$embed\"><param name=\"allowScriptAccess\" value=\"always\"><param name=\"wmode\" value=\"transparent\"><embed src=\"http://www.tudou.com/v/$embed\" type=\"application/x-shockwave-flash\" width=\"400\" height=\"300\" allowFullScreen=\"true\" wmode=\"transparent\" allowScriptAccess=\"always\"></object>";
  }
  return
$output;
}

function
video_cck_tudou_thumbnail($field, $item, $formatter, $node, $width, $height) {
  return
'';
}

function
video_cck_tudou_video($embed, $width, $height, $field, $item) {
 
$output = theme('video_cck_tudou_flash', $embed, $width, $height);
  return
$output;
}

function
video_cck_tudou_preview($embed, $width, $height, $field, $item) {
 
$output = theme('video_cck_tudou_flash', $embed, $width, $height);
  return
$output;
}
?>

<?php
// $Id: 56.inc,v 1.3 2007/09/06 22:18:25 aaron Exp $

define('VIDEO_CCK_56_MAIN_URL', 'http://img.56.com/');

function
video_cck_56_info() {
 
$name = t('我乐(56.com)');
 
$features = array(
    array(
t('Autoplay'), t('no'), ''),
    array(
t('RSS Attachment'), t('No'), ''),
    array(
t('Thumbnails'), t('No'), ''),
  );
  return array(
   
'provider' => '56',
   
'name' => $name,
   
'url' => VIDEO_CCK_56_MAIN_URL,
   
'settings_description' => t('These settings specifically affect videos displayed from !provider.', array('!provider' => l($name, VIDEO_CCK_56_MAIN_URL, array('target' => '_blank')))),
   
'supported_features' => $features,
  );
}

function
video_cck_56_settings() {
 
$form = array();
  return
$form;
}

function
video_cck_56_extract($embed) {
  return array(
   
'@56\.com/([^"\&]+)/([^"\&]+)/([^"\&]+)/([^"\&]+)/([^"\&]+)/([^"\&]+)/([^"\&]+)/([^"\&]+)_/([^"\&]+).swf@i',
  );
}

function
theme_video_cck_56_flash($embed) {
  if (
$embed) {
   
$output .= "<object width=\"450\" height=\"390\"><param name=\"wmode\" value=\"transparent\" /><param name=\"movie\" value=\"http://www.56.com/$embed.swf\"><embed src=\"http://www.56.com/$embed.swf\"  type=\"application/x-shockwave-flash\" width=\"450\" height=\"390\"></object>";
  }
  return
$output;
}

function
video_cck_56_thumbnail($field, $item, $formatter, $node, $width, $height) {
  return
'';
}

function
video_cck_56_video($embed, $width, $height, $field, $item) {
 
$output = theme('video_cck_56_flash', $embed, $width, $height);
  return
$output;
}

function
video_cck_56_preview($embed, $width, $height, $field, $item) {
 
$output = theme('video_cck_56_flash', $embed, $width, $height);
  return
$output;
}
?>

<?php
// $Id: ku6.inc,v 1.3 2007/09/06 22:18:25 aaron Exp $

define('VIDEO_CCK_ku6_MAIN_URL', 'http://img.ku6.com/');

function
video_cck_ku6_info() {
 
$name = t('酷6(ku6)');
 
$features = array(
    array(
t('Autoplay'), t('no'), ''),
    array(
t('RSS Attachment'), t('No'), ''),
    array(
t('Thumbnails'), t('No'), ''),
  );
  return array(
   
'provider' => 'ku6',
   
'name' => $name,
   
'url' => VIDEO_CCK_ku6_MAIN_URL,
   
'settings_description' => t('These settings specifically affect videos displayed from !provider.', array('!provider' => l($name, VIDEO_CCK_ku6_MAIN_URL, array('target' => '_blank')))),
   
'supported_features' => $features,
  );
}

function
video_cck_ku6_settings() {
 
$form = array();
  return
$form;
}

function
video_cck_ku6_extract($embed) {
  return array(
   
'@http://img\.ku6\.com/common/V2.0.1.swf\?vid=([^"\&]+)@i',
  );
}

function
video_cck_ku6_video_link($video_code) {
  return
'http://img.ku6.com/common/V2.0.1.swf?vid=' . $video_code;
}

function
theme_video_cck_ku6_flash($embed) {
  if (
$embed) {
   
$output .= "<embed src=\"http://img.ku6.com/common/V2.0.1.swf?vid=$embed\" quality=\"high\" width=\"460\" height=\"390\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\"></embed>";
  }
  return
$output;
}

function
video_cck_ku6_thumbnail($field, $item, $formatter, $node, $width, $height) {
  return
'';
}

function
video_cck_ku6_video($embed, $width, $height, $field, $item) {
 
$output = theme('video_cck_ku6_flash', $embed, $width, $height);
  return
$output;
}

function
video_cck_ku6_preview($embed, $width, $height, $field, $item) {
 
$output = theme('video_cck_ku6_flash', $embed, $width, $height);
  return
$output;
}
?>

<?php
// $Id: youku.inc,v 1.3 2007/09/06 22:18:25 aaron Exp $

define('VIDEO_CCK_youku_MAIN_URL', 'http://v.youku.com');

function
video_cck_youku_info() {
 
$name = t('优酷(youku)');
 
$features = array(
    array(
t('Autoplay'), t('no'), ''),
    array(
t('RSS Attachment'), t('No'), ''),
    array(
t('Thumbnails'), t('No'), ''),
  );
  return array(
   
'provider' => 'youku',
   
'name' => $name,
   
'url' => VIDEO_CCK_youku_MAIN_URL,
   
'settings_description' => t('These settings specifically affect videos displayed from !provider.', array('!provider' => l($name, VIDEO_CCK_youku_MAIN_URL, array('target' => '_blank')))),
   
'supported_features' => $features,
  );
}

function
video_cck_youku_settings() {
 
$form = array();
  return
$form;
}

function
video_cck_youku_extract($embed) {
  return array(
   
'@http://player\.youku\.com/player.php/sid/([^"\&]+)==/v.swf@i',
  );
}

function
video_cck_youku_video_link($video_code) {
  return
'http://player.youku.com/player.php/sid/' . $video_code;
}

function
theme_video_cck_youku_flash($embed, $width, $height) {
  if (
$embed) {
   
$output .= "<embed src=\"http://player.youku.com/player.php/sid/$embed==/v.swf\" quality=\"high\" width=\"450\" height=\"372\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\"></embed>";
  }
  return
$output;
}

function
video_cck_youku_thumbnail($field, $item, $formatter, $node, $width, $height) {
  return
'';
}

function
video_cck_youku_video($embed, $width, $height, $field, $item) {
 
$output = theme('video_cck_youku_flash', $embed, $width, $height);
  return
$output;
}

function
video_cck_youku_preview($embed, $width, $height, $field, $item) {
 
$output = theme('video_cck_youku_flash', $embed, $width, $height);
  return
$output;
}
?>

太好了

太好了, 可以做一个patch吗?
你应该做一个patch然后给他们在
http://drupal.org/project/issues/emfield
然后每人可以用你的工作。

Awesome, Can you create a patch?
You should create a patch and then post it on
http://drupal.org/project/issues/emfield
this way it'll be available for everyone.

敬礼!

后来east你的这个贡献有传播到drupal.org更广的 project 社区么?

你的工作很棒啊!我看到你的注释写得都非常清楚!

+1

+1