Beispiel #1
0
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 private function send_to_bc($file)
 {
     $bc = BCAPI::instance();
     try {
         $bc_id = $bc->bc->createMedia("video", $file, array("name" => $this->request->data['MediaFile']['name'], "H264NoProcessing" => TRUE));
     } catch (BCMAPIException $e) {
         die(print_r($e));
     }
     return $bc_id;
 }
Beispiel #3
0
 public function brightcove_file_migration()
 {
     set_time_limit(0);
     $conds = array("MediaFile.media_type" => "bcove", "MediaFile.file_video_still" => NULL);
     //get 100 brightcove posts that do not have any file_video_still populated
     $files = $this->MediaFile->find("all", array("conditions" => $conds, "limit" => 500, "contain" => array()));
     $cwd = getcwd();
     chdir("/home/sites/berrics/img.theberrics.com/public_html/video/stills");
     //brightcove API
     App::import("Vendor", "BCAPI", array("file" => "bc_api.php"));
     $bc = BCAPI::instance()->bc;
     foreach ($files as $file) {
         $m = $file['MediaFile'];
         if ($m['brightcove_id'] > 0) {
             $bc_info = $bc->find("videobyid", array("video_id" => $m['brightcove_id']));
             $image = $bc_info->videoStillURL;
             //save the image
             //	die("wget $image -O ".$m['id'].".jpg");
             exec("wget {$image} -O " . $m['id'] . ".jpg");
             ImgServer::instance()->upload_video_still($m['id'] . ".jpg", "/home/sites/berrics/img.theberrics.com/public_html/video/stills/" . $m['id'] . ".jpg");
             //save the info
             $this->MediaFile->create();
             $this->MediaFile->id = $m['id'];
             $this->MediaFile->save(array("file_video_still" => $m['id'] . ".jpg", "brightcove_url" => $bc_info->FLVURL));
             $this->out("Saved: " . $m['id']);
         }
     }
 }
 public function bc()
 {
     $this->loadModel("MediaFile");
     $bc = BCAPI::instance();
     //upload a video
     $file = "/tmp/chaz.mp4";
     try {
         $res = $bc->bc->createMedia("video", $file, array("name" => "Testing", "H264NoProcessing" => TRUE), array("H264NoProcessing" => TRUE, "preserve_source_rendition" => TRUE));
     } catch (BCMAPIException $e) {
         pr($e);
     }
     $this->MediaFile->create();
     $this->MediaFile->save(array("name" => "Testing 2", "brightcove_id" => $res, "media_type" => "bcove"));
     pr($res);
 }
 private function _import_video_screens()
 {
     $this->loadModel("MediaFile");
     $files = $this->MediaFile->find("all", array("contain" => array(), "conditions" => array("MediaFile.media_type" => "bcove", "MediaFile.file_video_still" => NULL), "limit" => 5));
     //lets save some thumbs
     $bc = BCAPI::instance()->bc;
     $cwd = getcwd();
     chdir("/home/sites/berrics/img.theberrics.com/public_html/video/stills/");
     //mkdir("testing");
     //die();
     //die(getcwd());
     foreach ($files as $file) {
         $bc_file = $bc->find("videobyid", array("video_id" => $file['MediaFile']['brightcove_id']));
         die(pr($bc_file));
         $tmp = array();
         exec("wget -O " . $file['MediaFile']['id'] . ".jpg " . $bc_file->videoStillURL, $tmp);
         //update the media file with the file_video_still
         pr($tmp);
         $this->MediaFile->create();
         $this->MediaFile->id = $file['MediaFile']['id'];
         $this->MediaFile->save(array("file_video_still" => $file['MediaFile']['id'] . ".jpg"));
     }
     chdir($cwd);
     //die(pr($files));
 }