コード例 #1
0
ファイル: VideoTask.php プロジェクト: josephbergdoll/berrics
 public function youtube_upload($VideoTask)
 {
     //mark the task as working
     $this->create();
     $this->id = $VideoTask['VideoTask']['id'];
     $this->save(array("task_status" => "working"));
     //import and create objects
     $Dailyop = ClassRegistry::init("Dailyop");
     App::import("Vendor", "YoutubeApi", array("file" => "YoutubeApi.php"));
     $yt = new YoutubeApi();
     $post = $Dailyop->returnPost(array("Dailyop.id" => $VideoTask['VideoTask']['foreign_key']), 1, 1);
     //let's get the video that needs to be uploaded
     // it will be the first mediaFile object marked as a bcove media type
     $videoFile = Set::extract("/DailyopMediaItem/MediaFile[media_type=bcove]", $post);
     if ($videoFile[0]['MediaFile']['id']) {
         $videoFile = $videoFile[0];
     }
     $yt->uploadVideo($post, $videoFile);
     //mark the task as not working
     $this->create();
     $this->id = $VideoTask['VideoTask']['id'];
     $this->save(array("task_status" => "completed"));
 }
コード例 #2
0
 public function yt_upload()
 {
     App::import("Vendor", "YoutubeApi", array("file" => "YoutubeApi.php"));
     $yt = new YoutubeApi();
     $yt->uploadVideo();
 }