本文整理汇总了PHP中Zend_Gdata_YouTube::newGeoRssWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube::newGeoRssWhere方法的具体用法?PHP Zend_Gdata_YouTube::newGeoRssWhere怎么用?PHP Zend_Gdata_YouTube::newGeoRssWhere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_YouTube
的用法示例。
在下文中一共展示了Zend_Gdata_YouTube::newGeoRssWhere方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: youtubeUpload
/**
* Uploads video to youtube
*/
function youtubeUpload($username, $password, $devkey, $filename, $filetype, $movie_title, $movie_desc, $keywords, $category_name, $coords = '')
{
require_once 'Zend/Loader.php';
// the Zend dir must be in your include_path
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$yt = new Zend_Gdata_YouTube();
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$authenticationURL = 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service = 'youtube', $client = null, $source = 'core_dev', $loginToken = null, $loginCaptcha = null, $authenticationURL);
$httpClient->setHeaders('X-GData-Key', "key={$devkey}");
$yt = new Zend_Gdata_YouTube($httpClient);
// create a new Zend_Gdata_YouTube_VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
// create a new Zend_Gdata_App_MediaFileSource object
$filesource = $yt->newMediaFileSource($filename);
$filesource->setContentType($filetype);
// set slug header
$filesource->setSlug($filename);
//FIXME: vafan är en slug header???
// add the filesource to the video entry
$myVideoEntry->setMediaSource($filesource);
// create a new Zend_Gdata_YouTube_Extension_MediaGroup object
$mediaGroup = $yt->newMediaGroup();
$mediaGroup->title = $yt->newMediaTitle()->setText($movie_title);
$mediaGroup->description = $yt->newMediaDescription()->setText($movie_desc);
// the category must be a valid YouTube category
// optionally set some developer tags (see Searching by Developer Tags for more details)
$mediaGroup->category = array($yt->newMediaCategory()->setText($category_name)->setScheme('http://gdata.youtube.com/schemas/2007/categories.cat'));
// set keywords, please note that they cannot contain white-space
$mediaGroup->keywords = $yt->newMediaKeywords()->setText($keywords);
$myVideoEntry->mediaGroup = $mediaGroup;
if ($coords) {
// set video location
$yt->registerPackage('Zend_Gdata_Geo');
$yt->registerPackage('Zend_Gdata_Geo_Extension');
$where = $yt->newGeoRssWhere();
$position = $yt->newGmlPos($coords);
$where->point = $yt->newGmlPoint($position);
$myVideoEntry->setWhere($where);
}
// upload URL 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');
} catch (Zend_Gdata_App_Exception $e) {
echo $e->getMessage() . "\n";
}
}
示例2: catch
function for_youtube($file_convert_for_youtube, $id_row)
{
$db = Zend_Db_Table::getDefaultAdapter();
$films_info = $db->fetchRow("SELECT f.id, f.name, m.id as menu_activ, f.for_youtube, f.text, f.year\n\t\t\t, ( SELECT GROUP_CONCAT( s.name ORDER BY fj.id SEPARATOR ', ') FROM film_janr fj join spravochnik s on s.id = fj.id_janr WHERE fj.films_id = f.id) as janr\n\t\t\t\t\t\tFROM menu m\n\t\t\t\t\t\tjoin films f on f.page_id = m.id\n\t\t\t\t\t\tWHERE m.type = 'films' and f.id = " . $id_row);
$films_info['translit_url'] = $this->translitUrlName($films_info['name']);
if ($films_info['for_youtube'] == 1) {
$authenticationURL = 'https://www.google.com/accounts/ClientLogin';
try {
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($username = 'treetv9@gmail.com', $password = 'asd123321', $service = 'youtube', $client = null, $source = 'MySource', $loginToken = null, $loginCaptcha = null, $authenticationURL);
} catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "\n";
echo 'Token ID: ' . $cre->getCaptchaToken() . "\n";
} catch (Zend_Gdata_App_AuthException $ae) {
echo 'Problem authenticating: ' . $ae->exception() . "\n";
}
$applicationId = "causal-rite-634";
$clientId = "748030821368-ddkt4brpcq7623jii6l2bhc6ujfi08e9.apps.googleusercontent.com";
//"11588627092-akui7d8un28eerombrt8784j4fpn1p12.apps.googleusercontent.com";
$developerKey = "AI39si7LpRb8zR-_eP9tR-TPRAuBTBdM1gBHFssCCnc1sGCyJozLbYYPmlHW7lBSYxBYC4VKYmOp1mXMKQveeyXgOjsLNF0oQA";
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = $yt->newMediaFileSource($file_convert_for_youtube);
$filesource->setContentType('video/quicktime');
$filesource->setSlug($file_convert_for_youtube);
$myVideoEntry->setMediaSource($filesource);
///названиефильма/ - Русский трейлер /год
$name_trayler = $films_info['name'] . ' - Русский трейлер ' . $films_info['year'];
if (mb_strlen($name_trayler) >= 60) {
$temp_name_trayler = mb_substr($name_trayler, 0, 60, 'utf-8');
$name_trayler = mb_substr($temp_name_trayler, 0, mb_strrpos($temp_name_trayler, ' '), 'utf-8');
}
$myVideoEntry->setVideoTitle($name_trayler);
$myVideoEntry->setVideoDescription('Смотреть онлайн или скачать полную версию: http://tree.tv/film/' . $id_row . '-' . $films_info['translit_url'] . '
' . $films_info['text']);
// Note that category must be a valid YouTube category !
$myVideoEntry->setVideoCategory('Film');
// Set keywords, note that this must be a comma separated string
// and that each keyword cannot contain whitespace
$myVideoEntry->SetVideoTags('русский трейлер, смотреть, русский, онлайн, ' . date("Y") . ', фильм, кино, бесплатно, трейлер, trailer, тизер,' . $films_info['janr']);
//('cars, funny');
// Optionally set some developer tags
$myVideoEntry->setVideoDeveloperTags(array('mydevelopertag', 'anotherdevelopertag'));
// Optionally set the video's location
$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/users/default/uploads';
// Try to upload the video, catching a Zend_Gdata_App_HttpException
// if availableor just a regular Zend_Gdata_App_Exception
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();
}
$db->query("update films SET for_youtube = '0' \n\t\t\t\t\t\t\tWHERE id = " . $id_row);
}
}
示例3: uploadOnYT
public function uploadOnYT()
{
$httpClient = $this->authYT($username, $password);
$yt = new Zend_Gdata_YouTube($httpClient);
// create a new Zend_Gdata_YouTube_VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
// create a new Zend_Gdata_App_MediaFileSource object
$filesource = $yt->newMediaFileSource('mytestmovie.mov');
$filesource->setContentType('video/quicktime');
// set slug header
$filesource->setSlug('mytestmovie.mov');
// add the filesource to the video entry
$myVideoEntry->setMediaSource($filesource);
// create a new Zend_Gdata_YouTube_MediaGroup object
$mediaGroup = $yt->newMediaGroup();
$mediaGroup->title = $yt->newMediaTitle()->setText('My Test Movie');
$mediaGroup->description = $yt->newMediaDescription()->setText('My description');
// the category must be a valid YouTube category
// optionally set some developer tags (see Searching by Developer Tags for more details)
$mediaGroup->category = array($yt->newMediaCategory()->setText('Autos')->setScheme('http://gdata.youtube.com/schemas/2007/categories.cat'), $yt->newMediaCategory()->setText('mydevelopertag')->setScheme('http://gdata.youtube.com/schemas/2007/developertags.cat'), $yt->newMediaCategory()->setText('anotherdevelopertag')->setScheme('http://gdata.youtube.com/schemas/2007/developertags.cat'));
// set keywords
$mediaGroup->keywords = $service->newMediaKeywords()->setText('cars, funny');
$myVideoEntry->mediaGroup = $mediaGroup;
// set video location
$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);
$entry->setWhere($where);
// upload URL 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');
} catch (Zend_Gdata_App_Exception $e) {
echo $e->getMessage();
}
}
示例4: 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';
}
}