当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Gdata_YouTube_VideoEntry::setVideoDescription方法代码示例

本文整理汇总了PHP中Zend_Gdata_YouTube_VideoEntry::setVideoDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube_VideoEntry::setVideoDescription方法的具体用法?PHP Zend_Gdata_YouTube_VideoEntry::setVideoDescription怎么用?PHP Zend_Gdata_YouTube_VideoEntry::setVideoDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Gdata_YouTube_VideoEntry的用法示例。


在下文中一共展示了Zend_Gdata_YouTube_VideoEntry::setVideoDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     $published = new Zend_Gdata_App_Extension_Published("2011-10-21 12:00:00");
     $updated = new Zend_Gdata_App_Extension_Updated("2011-10-21 12:20:00");
     $id = new Zend_Gdata_App_Extension_Id("Az2cv12");
     $rating = new Zend_Gdata_Extension_Rating(4, 1, 5, 200, 4);
     $duration = new Zend_Gdata_YouTube_Extension_Duration(80);
     $player = new Zend_Gdata_Media_Extension_MediaPlayer();
     $player->setUrl("coucou");
     $stat = new Zend_Gdata_YouTube_Extension_Statistics();
     $stat->setViewCount("5");
     $thumb = new Zend_Gdata_Media_Extension_MediaThumbnail('une url', '120', '90');
     $media = new Zend_Gdata_YouTube_Extension_MediaGroup();
     $media->setPlayer([$player]);
     $media->setDuration($duration);
     $media->setVideoId($id);
     $media->setThumbnail([$thumb]);
     $entry = new Zend_Gdata_YouTube_VideoEntry();
     $entry->setMajorProtocolVersion(2);
     $entry->setMediaGroup($media);
     $entry->setStatistics($stat);
     $entry->setRating($rating);
     $entry->setVideoCategory("category");
     $entry->setVideoDescription("one description");
     $entry->setVideoPrivate();
     $entry->setVideoTags(['tags']);
     $entry->setVideoTitle("hellow");
     $entry->setUpdated($updated);
     $entry->setPublished($published);
     $this->object = new Bridge_Api_Youtube_Element($entry, 'video');
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:32,代码来源:ElementTest.php

示例2: browserBasedUpload

 function browserBasedUpload($username, $password, $source, $title, $des = '', $cate = 'Entertainment')
 {
     // Note that this example creates an unversioned service object.
     // You do not need to specify a version number to upload content
     // since the upload behavior is the same for all API versions.
     $httpClient = $this->clientLogin($username, $password, $source);
     $yt = new Zend_Gdata_YouTube($httpClient);
     // create a new VideoEntry object
     $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
     $myVideoEntry->setVideoTitle($title);
     $myVideoEntry->setVideoDescription($des);
     // The category must be a valid YouTube category!
     $myVideoEntry->setVideoCategory($cate);
     // Set keywords. Please note that this must be a comma-separated string
     // and that individual keywords cannot contain whitespace
     $myVideoEntry->SetVideoTags('cars, funny');
     $tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
     try {
         $tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
         return $tokenArray;
     } catch (Zend_Gdata_App_HttpException $httpException) {
         echo $httpException->getRawResponseBody();
     } catch (Zend_Gdata_App_Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:hoanglannet,项目名称:copar,代码行数:26,代码来源:zendyoutube.php

示例3: upload

 public static function upload($asset)
 {
     try {
         $credentials = Asset_Video_Youtube::getYoutubeCredentials();
         if (!$credentials) {
             return;
         }
         $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username = $credentials["username"], $password = $credentials["password"], $service = 'youtube', $client = Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient"), $source = 'Pimcore', $loginToken = null, $loginCaptcha = null, 'https://www.google.com/youtube/accounts/ClientLogin');
         $httpClient->setConfig(array("timeout" => 3600));
         $apikey = $credentials["apiKey"];
         $httpClient->setHeaders('X-GData-Key', "key={$apikey}");
         $yt = new Zend_Gdata_YouTube($httpClient);
         $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
         $filesource = $yt->newMediaFileSource($asset->getFileSystemPath());
         $filesource->setContentType($asset->getMimetype());
         $filesource->setSlug($asset->getFilename());
         $myVideoEntry->setMediaSource($filesource);
         $myVideoEntry->setVideoTitle($asset->getFullPath());
         $myVideoEntry->setVideoDescription($asset->getFullPath());
         $myVideoEntry->setVideoCategory('Comedy');
         // Set keywords, note that this must be a comma separated string
         // and that each keyword cannot contain whitespace
         $myVideoEntry->SetVideoTags('---, ---');
         // Optionally set some developer tags
         $myVideoEntry->setVideoDeveloperTags(array('mydevelopertag', 'anotherdevelopertag'));
         // Upload URI for the currently authenticated user
         $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/users/default/uploads';
         try {
             $newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
             $asset->setCustomSetting("youtube", array("id" => strval($newEntry->getVideoId())));
             $asset->save();
             return true;
         } catch (Exception $e) {
             $asset->setCustomSetting("youtube", array("failed" => true));
             $asset->save();
         }
     } catch (Exception $e) {
         Logger::error($e);
     }
     return false;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:41,代码来源:Youtube.php

示例4: doYoutubeUpload

 public function doYoutubeUpload($options = array('title' => '', 'titleAlias' => '', 'introText' => '', 'source' => '', 'tags' => '', 'description' => ''))
 {
     $this->fileVideoName = $this->upload->getUploadName();
     $title = $options['title'];
     $titleAlias = $options['titleAlias'];
     $introText = $options['introText'];
     $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
     $fileName = $this->fileVideoName;
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
     $httpclient = Zend_Gdata_ClientLogin::getHttpClient($this->username, $this->password, $service = 'youtube', $client = null, $source = $options['source'], $loginToken = null, $loginCaptcha = null, $this->authenticationURL);
     Zend_Loader::loadClass('Zend_Gdata_YouTube');
     $yt = new Zend_Gdata_YouTube($httpclient, $options['name'], $options['name'], $this->developerKey);
     $videoEntry = new Zend_Gdata_YouTube_VideoEntry();
     $filesource = $yt->newMediaFileSource($fileName);
     $filesource->setContentType('video/' . $this->upload->fileExt);
     $filesource->setSlug($fileName);
     $videoEntry->setMediaSource($filesource);
     $videoEntry->setVideoTitle($title);
     $videoEntry->setVideoDescription($options['description']);
     $videoEntry->setVideoCategory($options['category']);
     $videoEntry->SetVideoTags($options['tags']);
     try {
         $videoEntry = $yt->insertEntry($videoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
         $state = $videoEntry->getVideoState();
         if ($state) {
             $youtubeId = $videoEntry->getVideoId();
             $this->videoId = $youtubeId;
             $this->videoUrl = "http://youtu.be/{$youtubeId}";
             $this->thumbSrc = "http://img.youtube.com/vi/{$youtubeId}/default.jpg";
             $this->duration = $this->length = 0;
             $this->parseAdditionalMetadata();
         } else {
             throw new Exception("Not able to retrieve the video status information yet. " . "Please try again later.\n");
         }
     } catch (Zend_Gdata_App_HttpException $httpException) {
         throw new Exception($httpException->getRawResponseBody());
     } catch (Zend_Gdata_App_Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:holdensmagicalunicorn,项目名称:copperFramework,代码行数:40,代码来源:copperYoutubeUpload.php

示例5: izap_video_get_page_content_youtube_upload

/**
 * Get page components to upload youtube video.
 * 
 * @param string  $page
 * @param integer $guid
 * @param string  $revision
 * 
 * @return array  array of content for YouTube video uploading
 * 
 * @version 5.0
 */
function izap_video_get_page_content_youtube_upload($page, $guid = 0, $revision = NULL)
{
    $return = array('filter' => '');
    $form_vars = array();
    $params = array();
    $video = IzapGYoutube::getAuthSubHttpClient(get_input('token', false));
    //get youtube api authorization via users application access.
    //	if (get_input('token')) {
    $video = IzapGYoutube::getAuthSubHttpClient(get_input('token', false));
    if ($video instanceof IzapGYoutube) {
        $yt = $video->YoutubeObject();
        $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
        $myVideoEntry->setVideoTitle($_SESSION['youtube_attributes']['title']);
        $description = strip_tags($_SESSION['youtube_attributes']['description']);
        $myVideoEntry->setVideoDescription($description);
        // Note that category must be a valid YouTube category
        $myVideoEntry->setVideoCategory($_SESSION['youtube_attributes']['youtube_cats']);
        $myVideoEntry->SetVideoTags($_SESSION['youtube_attributes']['tags']);
        $tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
        try {
            $tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
        } catch (Exception $e) {
            if (preg_match("/<code>([a-z_]+)<\\/code>/", $e->getMessage(), $matches)) {
                register_error('YouTube Error: ' . $matches[1]);
            } else {
                register_error('YouTube Error: ' . $e->getMessage());
            }
            forward(izap_set_href(array('context' => GLOBAL_IZAP_VIDEOS_PAGEHANDLER, 'action' => 'add', 'page_owner' => elgg_get_logged_in_user_guid(), 'vars' => array('tab' => 'youtube'))));
        }
        $params['token'] = $tokenArray['token'];
        $params['action'] = $tokenArray['url'] . '?nexturl=' . elgg_get_site_url() . GLOBAL_IZAP_VIDEOS_PAGEHANDLER . '/next&scope=https://gdata.youtube.com&session=1&secure=0';
        elgg_push_breadcrumb(elgg_echo('upload'));
        $form_vars = array('enctype' => 'multipart/form-data', 'name' => 'video_upload', 'action' => $params['action'], 'id' => 'izap-video-form');
        $title = elgg_echo('Upload video with title: "' . $_SESSION['youtube_attributes']['title'] . '"');
        $content = elgg_view_form('izap-videos/youtube_upload', $form_vars, $params);
        $return['title'] = $title;
        $return['content'] = $content;
        return $return;
    } else {
        register_error('You must have to grant access for youtube upload');
        forward();
    }
}
开发者ID:justangel,项目名称:izap-videos,代码行数:54,代码来源:izap-videos.php

示例6: youtube_api_upload_video

 /**
  * youtube_api_upload_video
  * 
  * Uploads a video attachment to YouTube via API. Harnesses Zend YouTube api class
  * 
  * @param	Array		$attachment_data - Video file upload data
  * @access 	private
  * @author	Ben Moody
  */
 private function youtube_api_upload_video($attachment_data)
 {
     //Init vars
     $file_type = NULL;
     $path_info = NULL;
     $myVideoEntry = NULL;
     $uploadUrl = NULL;
     $filesource = NULL;
     $newEntry = NULL;
     $output = NULL;
     //Cache plugin options
     $plugin_options = get_option(PRSOGFORMSADVUPLOADER__OPTIONS_NAME);
     //Check for required data
     if (isset($attachment_data['file_path'], $attachment_data['mime_type'], $attachment_data['title'], $attachment_data['description'])) {
         // upload URI for the currently authenticated user
         $uploadUrl = $this->youtube_uploads_url;
         // create a new VideoEntry object
         $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
         //Get file path
         $file_path = $attachment_data['file_path'];
         //Get file type
         $file_type = $attachment_data['mime_type'];
         //Get file slug - filename plus ext
         $path_info = pathinfo($file_path);
         // create a new Zend_Gdata_App_MediaFileSource object
         $filesource = $this->data['YouTubeClass']->newMediaFileSource($file_path);
         $filesource->setContentType($file_type);
         // set slug header
         $filesource->setSlug($path_info['basename']);
         // add the filesource to the video entry
         $myVideoEntry->setMediaSource($filesource);
         $myVideoEntry->setVideoTitle($attachment_data['title']);
         $myVideoEntry->setVideoDescription($attachment_data['description']);
         // The category must be a valid YouTube category!
         $myVideoEntry->setVideoCategory('Autos');
         //Set video upload as private
         if ($plugin_options['video_is_private']) {
             $myVideoEntry->setVideoPrivate();
         }
         // try to upload the video, catching a Zend_Gdata_App_HttpException,
         // if available, or just a regular Zend_Gdata_App_Exception otherwise
         try {
             $output = $this->data['YouTubeClass']->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
         } catch (Zend_Gdata_App_HttpException $httpException) {
             $output = $httpException->getRawResponseBody();
             $this->plugin_error_log($output);
         } catch (Zend_Gdata_App_Exception $e) {
             $output = $e->getMessage();
             $this->plugin_error_log($output);
         }
     }
     return $output;
 }
开发者ID:QuackenbushDev,项目名称:prso-gravity-forms-adv-uploader,代码行数:62,代码来源:inc_youtube_api.php

示例7: fetch_youtube_uploadform

 public function fetch_youtube_uploadform($yt, $videotitle, $videodescription)
 {
     global $CFG, $USER;
     // create a new VideoEntry object
     $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
     $myVideoEntry->setVideoTitle($videotitle);
     $myVideoEntry->setVideoDescription($videodescription);
     // The category must be a valid YouTube category!
     $myVideoEntry->setVideoCategory('Education');
     //This sets videos private, but then can't view if not logged in as the account owner
     //$myVideoEntry->setVideoPrivate();
     //So instead we set them to unlisted(but its more complex)
     $unlisted = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
     $unlisted->setExtensionAttributes(array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'list'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied')));
     $myVideoEntry->setExtensionElements(array($unlisted));
     // Set keywords. This must be a comma-separated string
     // Individual keywords cannot contain whitespace
     // We are not doing this, but it would be possible
     //$myVideoEntry->SetVideoTags('cars, funny');
     //data is all set, so we get our upload token from google
     $tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
     $tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
     $tokenValue = $tokenArray['token'];
     $postUrl = $tokenArray['url'];
     //Set the URL YouTube should redirect user to after upload
     //that will be the same iframe
     $nextUrl = $CFG->httpswwwroot . '/mod/assign/submission/youtube/uploader.php';
     // Now that we have the token, we build the form
     $form = '<form action="' . $postUrl . '?nexturl=' . $nextUrl . '" method="post" enctype="multipart/form-data">' . '<input name="file" type="file"/>' . '<input name="token" type="hidden" value="' . $tokenValue . '"/>' . '<input value="Upload Video File" type="submit" onclick="document.getElementById(\'id_uploadanim\').style.display=\'block\';" />' . '</form>';
     // We tag on a hidden uploading icon. YouTube gives us no progress events, sigh.
     // So its the best we can do to show an animated gif.
     // But if it fails, user will wait forever.
     $form .= '<img id="id_uploadanim" style="display: none;margin-left: auto;margin-right: auto;" src="' . $CFG->httpswwwroot . '/mod/assign/submission/youtube/pix/uploading.gif"/>';
     return $form;
 }
开发者ID:upegh,项目名称:youtube,代码行数:35,代码来源:locallib.php

示例8: uploadVideo

 public function uploadVideo($fileDisk, $fileUrl, $props, $private = false)
 {
     //		foreach ($props as $key => $val)
     //		{
     //			error_log($key . " is " . $val);
     //		}
     // create a new VideoEntry object
     $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
     // create a new Zend_Gdata_App_MediaFileSource object
     $filesource = $this->yt->newMediaFileSource($fileDisk);
     $filesource->setContentType('video/quicktime');
     //	print_r($filesource);
     // set slug header
     $filesource->setSlug($fileUrl);
     // add the filesource to the video entry
     $myVideoEntry->setMediaSource($filesource);
     $myVideoEntry->setVideoTitle($props['title']);
     $myVideoEntry->setVideoDescription($props['description']);
     // The category must be a valid YouTube category!
     $myVideoEntry->setVideoCategory($props['category']);
     // Set keywords. Please note that this must be a comma-separated string
     // and that individual keywords cannot contain whitespace
     $myVideoEntry->setVideoTags($props['keywords']);
     if ($private) {
         $myVideoEntry->setVideoPrivate();
     } else {
         $myVideoEntry->setVideoPublic();
     }
     $access = array();
     $access[] = new Zend_Gdata_YouTube_Extension_Access('comment', $props['comment']);
     $access[] = new Zend_Gdata_YouTube_Extension_Access('rate', $props['rate']);
     $access[] = new Zend_Gdata_YouTube_Extension_Access('commentVote', $props['commentVote']);
     $access[] = new Zend_Gdata_YouTube_Extension_Access('videoRespond', $props['videoRespond']);
     $access[] = new Zend_Gdata_YouTube_Extension_Access('embed', $props['embed']);
     $myVideoEntry->setAccess($access);
     // set some developer tags -- this is optional
     // (see Searching by Developer Tags for more details)
     //		$myVideoEntry->setVideoDeveloperTags(array('mydevtag', 'anotherdevtag'));
     // set the video's location -- this is also optional
     //	$yt->registerPackage('Zend_Gdata_Geo');
     //	$yt->registerPackage('Zend_Gdata_Geo_Extension');
     //	$where = $yt->newGeoRssWhere();
     //	$position = $yt->newGmlPos('37.0 -122.0');
     //	$where->point = $yt->newGmlPoint($position);
     //	$myVideoEntry->setWhere($where);
     // upload URI for the currently authenticated user
     $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
     // try to upload the video, catching a Zend_Gdata_App_HttpException,
     // if available, or just a regular Zend_Gdata_App_Exception otherwise
     /*		try 
     		{   */
     $newEntry = $this->yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
     $newEntry->setMajorProtocolVersion(2);
     //if(isset($props['playlists']))
     //$this->handlePlaylists($newEntry, explode(',', $props['playlists']));
     return $newEntry->getVideoId();
     /*		}
     		catch (Zend_Gdata_App_HttpException $httpException) 
     		{   
     	//		print_r($httpException);
     			echo $httpException->getRawResponseBody(); 
     			return null;
     		} 
     		catch (Zend_Gdata_App_Exception $e) 
     		{     
     	//		print_r($e);
     			echo $e->getMessage(); 
     			return null;
     		}*/
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:70,代码来源:YoutubeApiImpl.php

示例9: upload

 /**
  *
  * @param  record_adapter $record
  * @param  array          $options
  * @return string         The new distant Id
  */
 public function upload(record_adapter $record, array $options = [])
 {
     switch ($record->get_type()) {
         case 'video':
             $video_entry = new Zend_Gdata_YouTube_VideoEntry();
             $filesource = new Zend_Gdata_App_MediaFileSource($record->get_hd_file()->getRealPath());
             $filesource->setContentType($record->get_hd_file()->get_mime());
             $filesource->setSlug($record->get_title());
             $video_entry->setMediaSource($filesource);
             $video_entry->setVideoTitle($options['title']);
             $video_entry->setVideoDescription($options['description']);
             $video_entry->setVideoCategory($options['category']);
             $video_entry->SetVideoTags(explode(' ', $options['tags']));
             $video_entry->setVideoDeveloperTags(['phraseanet']);
             if ($options['privacy'] == "public") {
                 $video_entry->setVideoPublic();
             } else {
                 $video_entry->setVideoPrivate();
             }
             $app_entry = $this->_api->insertEntry($video_entry, self::UPLOAD_URL, 'Zend_Gdata_YouTube_VideoEntry');
             /*
              * set major protocole version to 2 otherwise you get exception when calling getVideoId
              * but setting setMajorProtocolVersion to 2 at the new entry introduce a new bug with getVideoState
              * @see http://groups.google.com/group/youtube-api-gdata/browse_thread/thread/7d86cac0d3f90e3f/d9291d7314f99be7?pli=1
              */
             $app_entry->setMajorProtocolVersion(2);
             return $app_entry->getVideoId();
             break;
         default:
             throw new Bridge_Exception_InvalidRecordType('Unknown format');
             break;
     }
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:39,代码来源:Youtube.php

示例10: glob

$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$dirs_ary = glob('*', GLOB_ONLYDIR);
foreach ($dirs_ary as $dir) {
    $filestring = file_get_contents($dir . '/lecture_settings.html');
    $dom = new DOMDocument();
    @$dom->loadHTML($filestring);
    $vidName = $dom->getElementById("source_video")->getAttribute('value');
    $lectureTitle = $dom->getElementById("title")->getAttribute('value');
    if ($lectureTitle == "CKY Example (21:52)" || $lectureTitle == "CKY Parsing (23:25)" || $lectureTitle == "Charniak's Model (18:23)" || $lectureTitle == "Discriminative Model Features") {
        echo $lectureTitle . ": " . $vidName . "\n";
        $filesource = $yt->newMediaFileSource('../source_videos/' . $vidName);
        $filesource->setContentType('video/mp4');
        $filesource->setSlug($vidName);
        $myVideoEntry->setMediaSource($filesource);
        $myVideoEntry->setVideoTitle($lectureTitle);
        $myVideoEntry->setVideoDescription($lectureTitle);
        // Note that category must be a valid YouTube category !
        $myVideoEntry->setVideoCategory('Education');
        // Set keywords, note that this must be a comma separated string
        // and that each keyword cannot contain whitespace
        $myVideoEntry->SetVideoTags('natural language processing');
        $myVideoEntry->SetVideoDeveloperTags(array('NLPClass', substr($lectureTitle, 0, 16)));
        //Turn off ratings, comments, videoResponses and make video unlisted
        $listElement = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
        $listElement->extensionAttributes = array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'list'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied'));
        $commentElement = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
        $commentElement->extensionAttributes = array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'comment'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied'));
        $videoRespondElement = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
        $videoRespondElement->extensionAttributes = array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'videoRespond'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied'));
        $rateElement = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
        $rateElement->extensionAttributes = array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'rate'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied'));
开发者ID:pushpen,项目名称:class2go,代码行数:31,代码来源:upload_videos.php

示例11: initiateReplication

 /**
  *
  * @param string $ps_filepath
  * @param array $pa_data
  * @param array $pa_options
  * @return string Unique request token. The token can be used on subsequent calls to fetch information about the replication request
  */
 public function initiateReplication($ps_filepath, $pa_data, $pa_options = null)
 {
     if (!($o_client = $this->getClient($pa_options))) {
         throw new Exception(_t('Could not connect to YouTube'));
     }
     $va_path_info = pathinfo($ps_filepath);
     $o_video_entry = new Zend_Gdata_YouTube_VideoEntry();
     $o_filesource = $o_client->newMediaFileSource($ps_filepath);
     $ID3 = new getID3();
     $ID3->option_max_2gb_check = false;
     $va_info = $ID3->analyze($ps_filepath);
     $o_filesource->setContentType($va_info['mime_type']);
     $o_filesource->setSlug($va_path_info['filename'] . '.' . $va_path_info['extension']);
     $o_video_entry->setMediaSource($o_filesource);
     $o_video_entry->setVideoTitle(isset($pa_data['title']) ? $pa_data['title'] : $va_path_info['filename']);
     $o_video_entry->setVideoDescription($pa_data['description'] ? $pa_data['description'] : '');
     // Note that category must be a valid YouTube category!
     $o_video_entry->setVideoCategory($pa_data['category'] ? $pa_data['category'] : 'Movies');
     // Set keywords, note that this must be a comma separated string
     // and that each keyword cannot contain whitespace
     $o_video_entry->SetVideoTags(is_array($pa_data['tags']) ? join(",", $pa_data['tags']) : '');
     if (isset($pa_options['private']) && $pa_options['private']) {
         $o_video_entry->setVideoPrivate();
     }
     // This may throw an exception
     $o_new_entry = $o_client->insertEntry($o_video_entry, WLPlugMediaReplicationYouTube::$s_upload_url, 'Zend_Gdata_YouTube_VideoEntry');
     $this->opa_request_list[$o_new_entry->getVideoID()] = array('entry' => $o_video_entry, 'errors' => array());
     return $this->info['NAME'] . "://" . $o_new_entry->getVideoID();
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:36,代码来源:YouTube.php

示例12: upload

 public function upload()
 {
     if (isset($this->httpClient)) {
         $response = "No Response From Server";
         $this->yt = new Zend_Gdata_YouTube($this->httpClient, $this->applicationId, $this->clientId, $this->developerKey);
         $this->yt->setMajorProtocolVersion(2);
         // create a new VideoEntry object
         $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
         // create a new Zend_Gdata_App_MediaFileSource object
         //$filesource = $this->yt->newMediaFileSource ( $this->video->path );
         $filesource = new Zend_Gdata_App_MediaFileSource($this->video->path);
         //echo ("Media Source Path " . $this->video->path . "<br>\n");
         $filesource->setContentType('video/mpeg');
         // set slug header
         $filesource->setSlug($this->video->slug);
         // add the filesource to the video entry
         $myVideoEntry->setMediaSource($filesource);
         //echo ("Media Source Set<br>\n");
         $myVideoEntry->setVideoTitle($this->getWebTitle());
         //echo ("Video Title Set<br>\n");
         $myVideoEntry->setVideoDescription($this->getWebDescription());
         //echo ("Description Set<br>\n");
         //TODO: Figure out how to set video response access as allowed
         // The category must be a valid YouTube category!
         $relevantVideosFeed = $this->getRelevantVideos($this->getWebTitle());
         $category = "Entertainment";
         if (isset($relevantVideosFeed)) {
             $categoryMap = $this->getRelevantYoutubeCategories($relevantVideosFeed);
             if (count($categoryMap) > 0) {
                 $category = $this->getRelevantCategoryFromCategoryMap($categoryMap);
             }
         }
         // Check to see if category is deprecated then use Category Chooser to find best category
         if (!$this->isValidCategory($category)) {
             //echo ("$category Is not valid. Looking for another valid category");
             $categorizer = new Categorizer($this->video->pid);
             $categorizer->chooseCategory($this->getPossibleCategories());
             $category = $categorizer->getPossCategoryName();
         }
         //echo ("Choosen Category: $category<br>");
         $myVideoEntry->setVideoCategory($category);
         //echo ("Category Set<br>\n");
         // Set keywords. Please note that this must be a comma-separated string
         // and that individual keywords cannot contain whitespace
         //$keywords = $this->getWebKeywords ();
         //echo ("Web Keywords: $keywords<br>\n");
         $keywords = $this->getYoutubeModifiedKeywords();
         //echo ( "Mod Keywords: $keywords<br>\n" );
         if (strlen($keywords) > 0) {
             $myVideoEntry->SetVideoTags($keywords);
         }
         //echo ("Tags Set<br>\n");
         // upload URI for the currently authenticated user
         $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
         // try to upload the video, catching a Zend_Gdata_App_HttpException,
         // if available, or just a regular Zend_Gdata_App_Exception otherwise
         try {
             //echo ("Inserting Video Entry<br>\n");
             $newEntry = $this->yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
             $response = $this->getVideoState($newEntry);
             $this->uploadLocation = $newEntry->getVideoWatchPageUrl();
         } catch (Exception $except) {
             //echo ("Exception Thrown<br>\n");
             $response = $except->getMessage();
         }
     } else {
         $response = "No Http Client to upload video for user: " . $this->userName . "| Youtube HttpClient Response: " . $this->httpException;
         //echo ($response . "<br>");
     }
     return $response;
 }
开发者ID:laiello,项目名称:we-promote-this,代码行数:71,代码来源:YoutubeUploader.php

示例13: uploadAction

		function uploadAction()
		{
			//echo $this->user.' - '.$this->pass.' - '.$this->gallery;
			$this->view->headTitle('UNC - Admin website');
			$this->view->headLink()->appendStylesheet($this->view->baseUrl().'/application/templates/admin/css/layout.css');
			$this->view->headScript()->appendFile($this->view->baseUrl().'/application/templates/admin/js/jquery-1.7.2.min.js','text/javascript');
			$this->view->headScript()->appendFile($this->view->baseUrl().'/application/templates/admin/js/hideshow.js','text/javascript');

			$form = $this->setForm();
			$this->view->form = $form;
			
			if($this->_request->isPost())
			{	
				if($form->isValid($_POST))
				{
					$title =  $this->_request->getPost('title');
					$description = $this->_request->getPost('description');
					//echo $title.$description;die();
					if ($_FILES["file"]["name"]!='')
					{
						$dir = dirname($_FILES["file"]["tmp_name"]);
						$destination = $dir . DIRECTORY_SEPARATOR . $_FILES["file"]["name"];
						rename($_FILES["file"]["tmp_name"], $destination);
						
						$httpClient = $this->_httpClient();
									   
						Zend_Loader::loadClass('Zend_Gdata_YouTube');
					 	$yt = new Zend_Gdata_YouTube($httpClient, 'NIW-App-1.0', '661085061264.apps.googleusercontent.com', 'AI39si4UPUxw1FE5hqSi0Z-B-5z3PIVovbBWKmqiMI3cXJ7lhvjJcABV-eqimb2EeSiuedWK8N9OGOdB1namX1CqqYki8jEfSQ');
						$yt->setMajorProtocolVersion(2);
						$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
						
						$filesource = $yt->newMediaFileSource($destination);
					    $filesource->setContentType('video/quicktime');
					    $filesource->setSlug($destination);
						
						$myVideoEntry->setMediaSource($filesource);
						$myVideoEntry->setVideoTitle($title);
						$myVideoEntry->setVideoDescription($description);
						
						$myVideoEntry->setVideoCategory('Autos');
						$myVideoEntry->SetVideoTags('cars, funny');
						$myVideoEntry->setVideoDeveloperTags(array('mydevtag', 'anotherdevtag'));
						
						// set the video's location -- this is also optional
						$yt->registerPackage('Zend_Gdata_Geo');
						$yt->registerPackage('Zend_Gdata_Geo_Extension');
						$where = $yt->newGeoRssWhere();
						$position = $yt->newGmlPos('37.0 -122.0');
						$where->point = $yt->newGmlPoint($position);
						$myVideoEntry->setWhere($where);
						
						$uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
						try {
						  	$newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
						} catch (Zend_Gdata_App_HttpException $httpException) {
						  echo $httpException->getRawResponseBody();
						} catch (Zend_Gdata_App_Exception $e) {
						    echo $e->getMessage();
						}
						
						if(file_exists($destination))
							unlink($destination);
						
						echo '<script type="text/javascript">
							alert("Video đang được upload trên YOUTUBE !");
						</script>';
						$this->_redirect($this->view->baseUrl().'/../admin/uploadvideo');
						
						//
					}
					else echo '<script type="text/javascript">alert("Vui lòng chọn file !");</script>';
				}
				
			//}
			$this->view->title = 'Tải lên video';
			}
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:77,代码来源:UploadvideoController.php

示例14: basename

 if (count($errors) == 0) {
     /* Might want to check the move code, this could cause colisions */
     $target_path = '/tmp/';
     $target_path = $target_path . basename($_FILES['video_file']['name']);
     if (!move_uploaded_file($_FILES['video_file']['tmp_name'], $target_path)) {
         array_push($errors, 'Error uploading file!');
     }
 }
 if (count($errors) == 0) {
     $videoEntry = new Zend_Gdata_YouTube_VideoEntry();
     $fs = $yt->newMediaFileSource($target_path);
     $fs->setContentType($_FILES['video_file']['type']);
     $fs->setSlug($_FILES['video_file']['name']);
     $videoEntry->setMediaSource($fs);
     $videoEntry->setVideoTitle($vtitle);
     $videoEntry->setVideoDescription($description);
     $videoEntry->setVideoCategory('Education');
     $videoEntry->setVideoTags('isense');
     $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
     $newEntry = null;
     try {
         $newEntry = $yt->insertEntry($videoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
     } catch (Zend_Gdata_App_HttpException $httpException) {
         array_push($errors, $httpException->getRawResponseBody());
     } catch (Zend_Gdata_App_Exception $e) {
         array_push($errors, $e->getMessage());
     }
     if (count($errors) == 0) {
         $done = true;
         $videoId = $newEntry->getVideoId();
         $url = 'http://www.youtube.com/watch?v=' . $videoId;
开发者ID:nickavv,项目名称:iSENSE,代码行数:31,代码来源:upload-videos.php

示例15: videoboard_cron

function videoboard_cron()
{
    global $DB, $CFG;
    if ($data = $DB->get_record_sql("SELECT * FROM {videoboard_process} WHERE `status`='open' LIMIT 1")) {
        $CFG->videoboard_convert = 0;
        if (in_array($data->type, json_decode(VIDEOBOARD_VIDEOTYPES))) {
            $CFG->videoboard_convert = $CFG->videoboard_video_convert;
        } else {
            if (in_array($data->type, json_decode(VIDEOBOARD_AUDIOTYPES))) {
                $CFG->videoboard_convert = $CFG->videoboard_audio_convert;
            }
        }
        //Check converting method local or mserver
        if ($CFG->videoboard_convert == 1) {
            if (strstr($CFG->videoboard_convert_url, "ffmpeg")) {
                $CFG->videoboard_convert = 2;
            }
        }
        //local
        if ($CFG->videoboard_convert == 1) {
            $from = videoboard_getfileid($data->itemid);
            $add = new stdClass();
            $add->id = $data->id;
            $add->status = 'send';
            $DB->update_record("videoboard_process", $add);
            $ch = curl_init();
            if (in_array($data->type, json_decode(VIDEOBOARD_AUDIOTYPES))) {
                $datasend = array('name' => $data->name, 'mconverter_wav' => '@' . $from->fullpatch);
            }
            if (in_array($data->type, json_decode(VIDEOBOARD_VIDEOTYPES))) {
                $datasend = array('name' => $data->name, 'mconverter_m4a' => '@' . $from->fullpatch);
            }
            curl_setopt($ch, CURLOPT_URL, $CFG->videoboard_convert_url . '/send.php');
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $datasend);
            curl_exec($ch);
        } else {
            if ($CFG->videoboard_convert == 3) {
                $from = videoboard_getfileid($data->itemid);
                $add = new stdClass();
                $add->id = $data->id;
                $add->status = 'send';
                $DB->update_record("videoboard_process", $add);
                if (in_array($data->type, json_decode(VIDEOBOARD_VIDEOTYPES))) {
                    if ($item = $DB->get_record("videoboard_files", array("itemoldid" => $data->itemid))) {
                        $table = 'videoboard_files';
                    } else {
                        if ($item = $DB->get_record("videoboard_comments", array("itemoldid" => $data->itemid))) {
                            $table = 'videoboard_comments';
                        }
                    }
                    @set_include_path($CFG->dirroot . '/mod/videoboard/library');
                    require_once "Zend/Gdata/ClientLogin.php";
                    require_once "Zend/Gdata/HttpClient.php";
                    require_once "Zend/Gdata/YouTube.php";
                    require_once "Zend/Gdata/App/HttpException.php";
                    require_once 'Zend/Uri/Http.php';
                    $authenticationURL = 'https://www.google.com/youtube/accounts/ClientLogin';
                    $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username = $CFG->videoboard_youtube_email, $password = $CFG->videoboard_youtube_password, $service = 'youtube', $client = null, $source = 'VideoBoard', $loginToken = null, $loginCaptcha = null, $authenticationURL);
                    $yt = new Zend_Gdata_YouTube($httpClient, 'VideoBoard', NULL, $CFG->videoboard_youtube_apikey);
                    $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
                    /// unlisted upload
                    $accessControlElement = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
                    $accessControlElement->extensionAttributes = array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'list'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied'));
                    $myVideoEntry->extensionElements = array($accessControlElement);
                    $filesource = $yt->newMediaFileSource($from->fullpatch);
                    $filesource->setContentType($data->type);
                    $filesource->setSlug('slug');
                    $myVideoEntry->setMediaSource($filesource);
                    $myVideoEntry->setVideoTitle($from->author);
                    $myVideoEntry->setVideoDescription($from->author);
                    $myVideoEntry->setVideoCategory('Education');
                    $myVideoEntry->SetVideoTags('videoboard');
                    //$myVideoEntry->setVideoDeveloperTags(array($item->id));
                    //$yt->registerPackage('Zend_Gdata_Geo');
                    //$yt->registerPackage('Zend_Gdata_Geo_Extension');
                    //$where = $yt->newGeoRssWhere();
                    //$position = $yt->newGmlPos('37.0 -122.0');
                    //$where->point = $yt->newGmlPoint($position);
                    //$myVideoEntry->setWhere($where);
                    $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
                    try {
                        $newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
                    } catch (Zend_Gdata_App_HttpException $httpException) {
                        echo $httpException->getRawResponseBody();
                        $DB->delete_records('videoboard_process', array('id' => $data->id));
                    } catch (Zend_Gdata_App_Exception $e) {
                        echo $e->getMessage();
                        $DB->delete_records('videoboard_process', array('id' => $data->id));
                    }
                    $itemidyoutube = $newEntry->getVideoId();
                    if (!empty($itemidyoutube)) {
                        $DB->set_field($table, "itemyoutube", $itemidyoutube, array("id" => $item->id));
                    }
                    $DB->delete_records('videoboard_process', array('id' => $data->id));
                } else {
                    $DB->delete_records('videoboard_process', array('id' => $data->id));
                }
            } else {
                if ($CFG->videoboard_convert == 2) {
//.........这里部分代码省略.........
开发者ID:e-rasvet,项目名称:videoboard,代码行数:101,代码来源:lib.php


注:本文中的Zend_Gdata_YouTube_VideoEntry::setVideoDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。