コード例 #1
0
 public function toObject($dbData = null, $props_to_skip = array())
 {
     if (is_null($dbData)) {
         $dbData = new kBulkUploadXmlJobData();
     }
     return parent::toObject($dbData);
 }
コード例 #2
0
 public function toObject($dbData = null, $props_to_skip = array())
 {
     if (is_null($dbData)) {
         $dbData = new kBulkUploadFilterJobData();
     }
     switch (get_class($this->templateObject)) {
         case 'KalturaCategoryEntry':
             $dbData->setTemplateObject(new categoryEntry());
             $this->templateObject->toObject($dbData->getTemplateObject());
             break;
         default:
             break;
     }
     return parent::toObject($dbData);
 }
コード例 #3
0
 /**
  * Add new bulk upload batch job
  * Conversion profile id can be specified in the API or in the CSV file, the one in the CSV file will be stronger.
  * If no conversion profile was specified, partner's default will be used
  * 
  * @action add
  * @param int $conversionProfileId Convertion profile id to use for converting the current bulk (-1 to use partner's default)
  * @param file $csvFileData CSV File
  * @return KalturaBulkUpload
  */
 function addAction($conversionProfileId, $csvFileData)
 {
     // first we copy the file to "content/batchfiles/[partner_id]/"
     $origFilename = $csvFileData["name"];
     $fileInfo = pathinfo($origFilename);
     $extension = strtolower($fileInfo["extension"]);
     if ($extension != "csv") {
         throw new KalturaAPIException(KalturaErrors::INVALID_FILE_EXTENSION);
     }
     $job = new BatchJob();
     $job->setPartnerId($this->getPartnerId());
     $job->save();
     $syncKey = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADCSV);
     //		kFileSyncUtils::file_put_contents($syncKey, file_get_contents($csvFileData["tmp_name"]));
     try {
         kFileSyncUtils::moveFromFile($csvFileData["tmp_name"], $syncKey, true);
     } catch (Exception $e) {
         throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_CREATE_CSV_FILE_SYNC_ERROR);
     }
     $csvPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     $data = new KalturaBulkUploadJobData();
     $data->csvFilePath = $csvPath;
     $data->userId = $this->getKuser()->getPuserId();
     $data->uploadedBy = $this->getKuser()->getScreenName();
     if ($conversionProfileId === -1) {
         $conversionProfileId = $this->getPartner()->getDefaultConversionProfileId();
     }
     $kmcVersion = $this->getPartner()->getKmcVersion();
     $check = null;
     if ($kmcVersion < 2) {
         $check = ConversionProfilePeer::retrieveByPK($conversionProfileId);
     } else {
         $check = conversionProfile2Peer::retrieveByPK($conversionProfileId);
     }
     if (!$check) {
         throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
     }
     $data->conversionProfileId = $conversionProfileId;
     $dbJob = kJobsManager::addJob($job, $data->toObject(), KalturaBatchJobType::BULKUPLOAD);
     $bulkUpload = new KalturaBulkUpload();
     $bulkUpload->fromObject($dbJob);
     return $bulkUpload;
 }