/** * Function constructs a core object of type kBulkUploadJobData * @param int $conversionProfileId * @param string $filePath * @param string $userId * @param int $bulkUploadType * @param string $uploadedBy * @param string $fileName * @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND */ protected function constructJobData($filePath, $fileName, Partner $partner, $puserId, $uploadedBy, $conversionProfileId = null, $coreBulkUploadType = null) { $data = KalturaPluginManager::loadObject('kBulkUploadJobData', $coreBulkUploadType); if (is_null($data)) { throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $coreBulkUploadType); } $data->setFilePath($filePath); $data->setUserId($puserId); $data->setUploadedBy($uploadedBy); $data->setFileName($fileName); if (!$conversionProfileId) { $conversionProfileId = $partner->getDefaultConversionProfileId(); } $kmcVersion = $partner->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); } $objectData = new kBulkUploadEntryData(); $objectData->setConversionProfileId($conversionProfileId); $data->setObjectData($objectData); return $data; }
public static function retrieveByPartnerIdAndSystemName($partnerId, $systemName, $type) { $c = new Criteria(); $c->addAnd(conversionProfile2Peer::PARTNER_ID, $partnerId); $c->addAnd(conversionProfile2Peer::SYSTEM_NAME, $systemName); $c->addAnd(conversionProfile2Peer::STATUS, ConversionProfileStatus::ENABLED); $c->addAnd(conversionProfile2Peer::TYPE, $type); return conversionProfile2Peer::doSelectOne($c); }
/** * * @param int $objectType * @param string $objectId * @return ISyncableFile */ public static function retrieveObject($objectType, $objectId) { $object = null; switch ($objectType) { case FileSyncObjectType::ENTRY: entryPeer::setUseCriteriaFilter(false); $object = entryPeer::retrieveByPK($objectId); entryPeer::setUseCriteriaFilter(true); break; case FileSyncObjectType::UICONF: uiConfPeer::setUseCriteriaFilter(false); $object = uiConfPeer::retrieveByPK($objectId); uiConfPeer::setUseCriteriaFilter(true); break; case FileSyncObjectType::BATCHJOB: BatchJobPeer::setUseCriteriaFilter(false); $object = BatchJobPeer::retrieveByPK($objectId); BatchJobPeer::setUseCriteriaFilter(true); break; case FileSyncObjectType::FLAVOR_ASSET: assetPeer::setUseCriteriaFilter(false); $object = assetPeer::retrieveById($objectId); assetPeer::setUseCriteriaFilter(true); break; case FileSyncObjectType::SYNDICATION_FEED: syndicationFeedPeer::setUseCriteriaFilter(false); $object = syndicationFeedPeer::retrieveByPK($objectId); syndicationFeedPeer::setUseCriteriaFilter(true); break; case FileSyncObjectType::CONVERSION_PROFILE: conversionProfile2Peer::setUseCriteriaFilter(false); $object = conversionProfile2Peer::retrieveByPK($objectId); conversionProfile2Peer::setUseCriteriaFilter(true); break; case FileSyncObjectType::FILE_ASSET: conversionProfile2Peer::setUseCriteriaFilter(false); $object = FileAssetPeer::retrieveByPK($objectId); conversionProfile2Peer::setUseCriteriaFilter(true); break; } if ($object == null) { $object = KalturaPluginManager::loadObject('ISyncableFile', $objectType, array('objectId' => $objectId)); } if ($object == null) { $error = __METHOD__ . " Cannot find object type [" . $objectType . "] with object_id [" . $objectId . "]"; KalturaLog::err($error); throw new kFileSyncException($error); } return $object; }
public function toObject($object_to_fill = null, $props_to_skip = array()) { if (!$object_to_fill) { $object_to_fill = new assetParamsConversionProfileFilter(); } $conversionProfileCriteria = new Criteria(); if ($this->conversionProfileIdEqual) { $conversionProfileCriteria->add(conversionProfile2Peer::ID, $this->conversionProfileIdEqual); } if ($this->conversionProfileIdIn) { $conversionProfileCriteria->add(conversionProfile2Peer::ID, explode(',', $this->conversionProfileIdIn), Criteria::IN); } if ($this->conversionProfileIdFilter) { $conversionProfileIdFilter = new conversionProfile2Filter(); $this->conversionProfileIdFilter->toObject($conversionProfileIdFilter); $conversionProfileIdFilter->attachToCriteria($conversionProfileCriteria); } $this->conversionProfileIdEqual = null; $this->conversionProfileIdFilter = null; $conversionProfileIdIn = conversionProfile2Peer::getIds($conversionProfileCriteria); if (count($conversionProfileIdIn)) { $this->conversionProfileIdIn = implode(',', $conversionProfileIdIn); } else { $this->conversionProfileIdIn = -1; } // none existing conversion profile $assetParamsCriteria = new Criteria(); if ($this->assetParamsIdEqual) { $assetParamsCriteria->add(assetParamsPeer::ID, $this->assetParamsIdEqual); } if ($this->assetParamsIdIn) { $assetParamsCriteria->add(assetParamsPeer::ID, explode(',', $this->assetParamsIdIn), Criteria::IN); } if ($this->assetParamsIdFilter) { $assetParamsIdFilter = new assetParamsFilter(); $this->assetParamsIdFilter->toObject($assetParamsIdFilter); $assetParamsIdFilter->attachToCriteria($assetParamsCriteria); } $this->assetParamsIdEqual = null; $this->assetParamsIdFilter = null; $assetParamsIdIn = assetParamsPeer::getIds($assetParamsCriteria); if (count($assetParamsIdIn)) { $this->assetParamsIdIn = implode(',', $assetParamsIdIn); } else { $this->assetParamsIdIn = -1; } // none existing flavor return parent::toObject($object_to_fill, $props_to_skip); }
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null) { $conversionProfile2Filter = $this->toObject(); $c = new Criteria(); $conversionProfile2Filter->attachToCriteria($c); $totalCount = conversionProfile2Peer::doCount($c); $pager->attachToCriteria($c); $dbList = conversionProfile2Peer::doSelect($c); $list = KalturaConversionProfileArray::fromDbArray($dbList, $responseProfile); $list->loadFlavorParamsIds(); $response = new KalturaConversionProfileListResponse(); $response->objects = $list; $response->totalCount = $totalCount; return $response; }
/** * Update asset parmas of conversion profile by ID * * @action update * @param int $conversionProfileId * @param int $assetParamsId * @param KalturaConversionProfileAssetParams $conversionProfileAssetParams * @return KalturaConversionProfileAssetParams */ public function updateAction($conversionProfileId, $assetParamsId, KalturaConversionProfileAssetParams $conversionProfileAssetParams) { $conversionProfile = conversionProfile2Peer::retrieveByPK($conversionProfileId); if (!$conversionProfile) { throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId); } $flavorParamsConversionProfile = flavorParamsConversionProfilePeer::retrieveByFlavorParamsAndConversionProfile($assetParamsId, $conversionProfileId); if (!$flavorParamsConversionProfile) { throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ASSET_PARAMS_NOT_FOUND, $conversionProfileId, $assetParamsId); } $conversionProfileAssetParams->toUpdatableObject($flavorParamsConversionProfile); $flavorParamsConversionProfile->save(); $conversionProfileAssetParams->fromObject($flavorParamsConversionProfile, $this->getResponseProfile()); return $conversionProfileAssetParams; }
/** * 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; }
/** * Function adds bulk upload job to the queue * @param Partner $partner * @param kBulkUploadJobData $jobData * @param string $bulkUploadType * @throws APIException * @return BatchJob */ public static function addBulkUploadJob(Partner $partner, kBulkUploadJobData $jobData, $bulkUploadType = null, $objectId = null, $objectType = null) { KalturaLog::debug("adding BulkUpload job"); $job = new BatchJob(); $job->setPartnerId($partner->getId()); $job->setJobType(BatchJobType::BULKUPLOAD); $job->setJobSubType($bulkUploadType); if (!is_null($objectId) && !is_null($objectType)) { $job->setObjectId($objectId); $job->setObjectType($objectType); } if (is_null($jobData)) { throw new APIException(APIErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $bulkUploadType); } $job->setStatus(BatchJob::BATCHJOB_STATUS_DONT_PROCESS); $job = kJobsManager::addJob($job, $jobData, BatchJobType::BULKUPLOAD, $bulkUploadType); if (!is_null($jobData->getFilePath())) { $syncKey = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOAD); // kFileSyncUtils::file_put_contents($syncKey, file_get_contents($csvFileData["tmp_name"])); try { kFileSyncUtils::moveFromFile($jobData->getFilePath(), $syncKey, true); } catch (Exception $e) { KalturaLog::err($e); throw new APIException(APIErrors::BULK_UPLOAD_CREATE_CSV_FILE_SYNC_ERROR); } $filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey); $jobData->setFilePath($filePath); } if (!$jobData->getBulkUploadObjectType()) { $jobData->setBulkUploadObjectType(BulkUploadObjectType::ENTRY); } if ($jobData->getBulkUploadObjectType() == BulkUploadObjectType::ENTRY && !$jobData->getObjectData()->getConversionProfileId()) { $jobData->setConversionProfileId($partner->getDefaultConversionProfileId()); $kmcVersion = $partner->getKmcVersion(); $check = null; if ($kmcVersion < 2) { $check = ConversionProfilePeer::retrieveByPK($jobData->getConversionProfileId()); } else { $check = conversionProfile2Peer::retrieveByPK($jobData->getConversionProfileId()); } if (!$check) { throw new APIException(APIErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $jobData->getConversionProfileId()); } } $job->setData($jobData); return kJobsManager::updateBatchJob($job, BatchJob::BATCHJOB_STATUS_PENDING); }
<?php if ($argc < 3) { echo "Required parameter [conversionProfileId] missing. Required form php addRequiredCopyPermissionConversionProfile.php <conversionProfileId> <comma-separated permissions>"; die; } require_once __DIR__ . '/../bootstrap.php'; $conversionProfileId = $argv[1]; $conversionProfile = conversionProfile2Peer::retrieveByPK($conversionProfileId); $partner = PartnerPeer::retrieveByPK($conversionProfile->getPartnerId()); if ($partner->getPartnerGroupType() != PartnerGroupType::TEMPLATE) { die("Conversion profile with id [{$conversionProfileId}] does not belong to a template partner. Aborting."); } $conversionProfile->setRequiredCopyTemplatePermissions(explode(',', $argv[2])); $conversionProfile->save();
/** * List Conversion Profiles by filter with paging support * * @action list * @param KalturaConversionProfileFilter $filter * @param KalturaFilterPager $pager * @return KalturaConversionProfileListResponse */ public function listAction(KalturaConversionProfileFilter $filter = null, KalturaFilterPager $pager = null) { if (!$filter) { $filter = new KalturaConversionProfileFilter(); } if (!$pager) { $pager = new KalturaFilterPager(); } $conversionProfile2Filter = new conversionProfile2Filter(); $filter->toObject($conversionProfile2Filter); $c = new Criteria(); $conversionProfile2Filter->attachToCriteria($c); $totalCount = conversionProfile2Peer::doCount($c); $pager->attachToCriteria($c); $dbList = conversionProfile2Peer::doSelect($c); $list = KalturaConversionProfileArray::fromDbArray($dbList); $list->loadFlavorParamsIds(); $response = new KalturaConversionProfileListResponse(); $response->objects = $list; $response->totalCount = $totalCount; return $response; }
public static function copyConversionProfiles(Partner $fromPartner, Partner $toPartner) { $copiedList = array(); KalturaLog::log("Copying conversion profiles from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "]"); $c = new Criteria(); $c->add(conversionProfile2Peer::PARTNER_ID, $fromPartner->getId()); $conversionProfiles = conversionProfile2Peer::doSelect($c); foreach ($conversionProfiles as $conversionProfile) { $newConversionProfile = $conversionProfile->copy(); $newConversionProfile->setPartnerId($toPartner->getId()); $newConversionProfile->save(); KalturaLog::log("Copied [" . $conversionProfile->getId() . "], new id is [" . $newConversionProfile->getId() . "]"); $copiedList[$conversionProfile->getId()] = $newConversionProfile->getId(); $c = new Criteria(); $c->add(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $conversionProfile->getId()); $fpcpList = flavorParamsConversionProfilePeer::doSelect($c); foreach ($fpcpList as $fpcp) { $flavorParamsId = $fpcp->getFlavorParamsId(); $flavorParams = assetParamsPeer::retrieveByPK($flavorParamsId); if ($flavorParams && $flavorParams->getPartnerId() === 0) { $newFpcp = $fpcp->copy(); $newFpcp->setConversionProfileId($newConversionProfile->getId()); $newFpcp->save(); } } } $toPartner->save(); // make sure conversion profile is set on the new partner in case it was missed/skiped in the conversionProfile2::copy method if (!$toPartner->getDefaultConversionProfileId()) { $fromPartnerDefaultProfile = $fromPartner->getDefaultConversionProfileId(); if ($fromPartnerDefaultProfile && key_exists($fromPartnerDefaultProfile, $copiedList)) { $toPartner->setDefaultConversionProfileId($copiedList[$fromPartnerDefaultProfile]); $toPartner->save(); } } }
/** * Update an existing KalturaDropFolder object * * @action update * @param int $dropFolderId * @param KalturaDropFolder $dropFolder * @return KalturaDropFolder * * @throws KalturaErrors::INVALID_OBJECT_ID * @throws KalturaErrors::INGESTION_PROFILE_ID_NOT_FOUND * @throws KalturaErrors::DATA_CENTER_ID_NOT_FOUND */ public function updateAction($dropFolderId, KalturaDropFolder $dropFolder) { $dbDropFolder = DropFolderPeer::retrieveByPK($dropFolderId); if (!$dbDropFolder) { throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $dropFolderId); } $dropFolder->validatePropertyMinValue('fileSizeCheckInterval', 0, true); $dropFolder->validatePropertyMinValue('autoFileDeleteDays', 0, true); if (!is_null($dropFolder->path) && $dropFolder->path != $dbDropFolder->getPath() && $dropFolder->type == KalturaDropFolderType::LOCAL) { $existingDropFolder = DropFolderPeer::retrieveByPathDefaultFilter($dropFolder->path); if ($existingDropFolder) { throw new KalturaAPIException(KalturaDropFolderErrors::DROP_FOLDER_ALREADY_EXISTS, $dropFolder->path); } } if (!is_null($dropFolder->dc)) { if (!kDataCenterMgr::dcExists($dropFolder->dc)) { throw new KalturaAPIException(KalturaErrors::DATA_CENTER_ID_NOT_FOUND, $dropFolder->dc); } } if (!is_null($dropFolder->conversionProfileId)) { $conversionProfileDb = conversionProfile2Peer::retrieveByPK($dropFolder->conversionProfileId); if (!$conversionProfileDb) { throw new KalturaAPIException(KalturaErrors::INGESTION_PROFILE_ID_NOT_FOUND, $dropFolder->conversionProfileId); } } $dbDropFolder = $dropFolder->toUpdatableObject($dbDropFolder); $dbDropFolder->save(); $dropFolder = KalturaDropFolder::getInstanceByType($dbDropFolder->getType()); $dropFolder->fromObject($dbDropFolder, $this->getResponseProfile()); return $dropFolder; }
protected function getOriginalOrTransformIfNeeded(DropFolder $folder, $xmlPath) { if (!file_exists($xmlPath) || !filesize($xmlPath)) { throw new Exception('Empty file supplied as input'); } if (!$folder->getConversionProfileId()) { KalturaLog::debug('No conversion profile found on drop folder [' . $folder->getId() . '] assuming no xsl transformation is needed'); return file_get_contents($xmlPath); } $conversionProfile = conversionProfile2Peer::retrieveByPK($folder->getConversionProfileId()); if (!$conversionProfile || strlen($conversionProfile->getXsl()) == 0) { KalturaLog::debug('No conversion profile found Or no xsl transform found'); return file_get_contents($xmlPath); } $originalXmlDoc = file_get_contents($xmlPath); $origianlXml = new KDOMDocument(); if (!$origianlXml->loadXML($originalXmlDoc)) { KalturaLog::debug('Could not load original xml'); $errorMessage = kXml::getLibXmlErrorDescription($originalXmlDoc); throw new Exception(DropFolderXmlBulkUploadPlugin::MALFORMED_XML_FILE_MESSAGE, DropFolderXmlBulkUploadPlugin::getErrorCodeCoreValue(DropFolderXmlBulkUploadErrorCode::MALFORMED_XML_FILE)); } libxml_clear_errors(); $proc = new XSLTProcessor(); $xsl = new KDOMDocument(); if (!$xsl->loadXML($conversionProfile->getXsl())) { KalturaLog::debug('Could not load xsl ' . $conversionProfile->getXsl()); $errorMessage = kXml::getLibXmlErrorDescription($conversionProfile->getXsl()); throw new Exception(DropFolderXmlBulkUploadPlugin::MALFORMED_XML_FILE_MESSAGE, DropFolderXmlBulkUploadPlugin::getErrorCodeCoreValue(DropFolderXmlBulkUploadErrorCode::MALFORMED_XML_FILE)); } $proc->importStyleSheet($xsl); libxml_clear_errors(); $transformedXml = $proc->transformToXML($origianlXml); if (!$transformedXml) { KalturaLog::debug('Could not transform xml ' . $conversionProfile->getXsl()); $errorMessage = kXml::getLibXmlErrorDescription($conversionProfile->getXsl()); throw new Exception(DropFolderXmlBulkUploadPlugin::MALFORMED_XML_FILE_MESSAGE, DropFolderXmlBulkUploadPlugin::getErrorCodeCoreValue(DropFolderXmlBulkUploadErrorCode::MALFORMED_XML_FILE)); } $xmlDoc = new KDOMDocument(); $res = $xmlDoc->loadXML($transformedXml); if (!$res) { throw new Exception(DropFolderXmlBulkUploadPlugin::MALFORMED_XML_FILE_MESSAGE, DropFolderXmlBulkUploadPlugin::getErrorCodeCoreValue(DropFolderXmlBulkUploadErrorCode::MALFORMED_XML_FILE)); } return $transformedXml; }
private function getConversionQuality($entry) { $conversionQuality = $entry->conversionQuality; if (parent::getConversionQualityFromRequest()) { $conversionQuality = parent::getConversionQualityFromRequest(); } if (is_null($conversionQuality)) { return null; } $conversionProfile2 = conversionProfile2Peer::retrieveByPK($conversionQuality); if (!$conversionProfile2) { KalturaLog::debug("Maybe old conversion profile"); $conversionProfile = ConversionProfilePeer::retrieveByPK($conversionQuality); if ($conversionProfile) { $conversionQuality = $conversionProfile->getConversionProfile2Id(); } } return $conversionQuality; }
/** * Convert entry * * @param string $entryId Media entry id * @param int $conversionProfileId * @param KalturaConversionAttributeArray $dynamicConversionAttributes * @return bigint job id * @throws KalturaErrors::ENTRY_ID_NOT_FOUND * @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND * @throws KalturaErrors::FLAVOR_PARAMS_NOT_FOUND */ protected function convert($entryId, $conversionProfileId = null, KalturaConversionAttributeArray $dynamicConversionAttributes = null) { $entry = entryPeer::retrieveByPK($entryId); if (!$entry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } $srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId); if (!$srcFlavorAsset) { throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING); } if (is_null($conversionProfileId) || $conversionProfileId <= 0) { $conversionProfile = myPartnerUtils::getConversionProfile2ForEntry($entryId); if (!$conversionProfile) { throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId); } $conversionProfileId = $conversionProfile->getId(); } else { //The search is with the entry's partnerId. so if conversion profile wasn't found it means that the //conversionId is not exist or the conversion profileId does'nt belong to this partner. $conversionProfile = conversionProfile2Peer::retrieveByPK($conversionProfileId); if (is_null($conversionProfile)) { throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId); } } $srcSyncKey = $srcFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); // if the file sync isn't local (wasn't synced yet) proxy request to other datacenter list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false); if (!$fileSync) { throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST); } else { if (!$local) { kFileUtils::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrl($fileSync)); } } // even if it null $entry->setConversionQuality($conversionProfileId); $entry->save(); if ($dynamicConversionAttributes) { $flavors = assetParamsPeer::retrieveByProfile($conversionProfileId); if (!count($flavors)) { throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_NOT_FOUND); } $srcFlavorParamsId = null; $flavorParams = $entry->getDynamicFlavorAttributes(); foreach ($flavors as $flavor) { if ($flavor->hasTag(flavorParams::TAG_SOURCE)) { $srcFlavorParamsId = $flavor->getId(); } $flavorParams[$flavor->getId()] = $flavor; } $dynamicAttributes = array(); foreach ($dynamicConversionAttributes as $dynamicConversionAttribute) { if (is_null($dynamicConversionAttribute->flavorParamsId)) { $dynamicConversionAttribute->flavorParamsId = $srcFlavorParamsId; } if (is_null($dynamicConversionAttribute->flavorParamsId)) { continue; } $dynamicAttributes[$dynamicConversionAttribute->flavorParamsId][trim($dynamicConversionAttribute->name)] = trim($dynamicConversionAttribute->value); } if (count($dynamicAttributes)) { $entry->setDynamicFlavorAttributes($dynamicAttributes); $entry->save(); } } $srcFilePath = kFileSyncUtils::getLocalFilePathForKey($srcSyncKey); $job = kJobsManager::addConvertProfileJob(null, $entry, $srcFlavorAsset->getId(), $srcFilePath); if (!$job) { return null; } return $job->getId(); }
public static function copyConversionProfiles(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false) { $copiedList = array(); KalturaLog::log("Copying conversion profiles from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "]"); $c = new Criteria(); $c->add(conversionProfile2Peer::PARTNER_ID, $fromPartner->getId()); $conversionProfiles = conversionProfile2Peer::doSelect($c); foreach ($conversionProfiles as $conversionProfile) { /* @var $conversionProfile conversionProfile2 */ if ($permissionRequiredOnly && !count($conversionProfile->getRequiredCopyTemplatePermissions())) { continue; } if (!self::isPartnerPermittedForCopy($toPartner, $conversionProfile->getRequiredCopyTemplatePermissions())) { continue; } $newConversionProfile = $conversionProfile->copy(); $newConversionProfile->setPartnerId($toPartner->getId()); try { $newConversionProfile->save(); } catch (Exception $e) { KalturaLog::info("Exception occured, conversion profile was not copied. Message: [" . $e->getMessage() . "]"); continue; } KalturaLog::log("Copied [" . $conversionProfile->getId() . "], new id is [" . $newConversionProfile->getId() . "]"); $copiedList[$conversionProfile->getId()] = $newConversionProfile->getId(); $c = new Criteria(); $c->add(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $conversionProfile->getId()); $fpcpList = flavorParamsConversionProfilePeer::doSelect($c); foreach ($fpcpList as $fpcp) { $flavorParamsId = $fpcp->getFlavorParamsId(); $flavorParams = assetParamsPeer::retrieveByPK($flavorParamsId); if ($flavorParams && $flavorParams->getPartnerId() === 0) { $newFpcp = $fpcp->copy(); $newFpcp->setConversionProfileId($newConversionProfile->getId()); $newFpcp->save(); } } } // make sure conversion profile is set on the new partner in case it was missed/skiped in the conversionProfile2::copy method if (!$toPartner->getDefaultConversionProfileId()) { $fromPartnerDefaultProfile = $fromPartner->getDefaultConversionProfileId(); if ($fromPartnerDefaultProfile && key_exists($fromPartnerDefaultProfile, $copiedList)) { $toPartner->setDefaultConversionProfileId($copiedList[$fromPartnerDefaultProfile]); } } if (!$toPartner->getDefaultLiveConversionProfileId()) { $fromPartnerDefaultLiveProfile = $fromPartner->getDefaultLiveConversionProfileId(); if ($fromPartnerDefaultLiveProfile && key_exists($fromPartnerDefaultLiveProfile, $copiedList)) { $toPartner->setDefaultLiveConversionProfileId($copiedList[$fromPartnerDefaultLiveProfile]); } } $toPartner->save(); }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(conversionProfile2Peer::DATABASE_NAME); $criteria->add(conversionProfile2Peer::ID, $pks, Criteria::IN); $objs = conversionProfile2Peer::doSelect($criteria, $con); } return $objs; }
public static function getIds(Criteria $criteria, $con = null) { $criteria->addSelectColumn(conversionProfile2Peer::ID); $stmt = conversionProfile2Peer::doSelectStmt($criteria, $con); return $stmt->fetchAll(PDO::FETCH_COLUMN); }
/** * Selects a collection of entry objects pre-filled with all related objects except accessControl. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of entry objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptaccessControl(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } entryPeer::addSelectColumns($criteria); $startcol2 = entryPeer::NUM_COLUMNS - entryPeer::NUM_LAZY_LOAD_COLUMNS; kshowPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + (kshowPeer::NUM_COLUMNS - kshowPeer::NUM_LAZY_LOAD_COLUMNS); kuserPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + (kuserPeer::NUM_COLUMNS - kuserPeer::NUM_LAZY_LOAD_COLUMNS); conversionProfile2Peer::addSelectColumns($criteria); $startcol5 = $startcol4 + (conversionProfile2Peer::NUM_COLUMNS - conversionProfile2Peer::NUM_LAZY_LOAD_COLUMNS); $criteria->addJoin(entryPeer::KSHOW_ID, kshowPeer::ID, $join_behavior); $criteria->addJoin(entryPeer::KUSER_ID, kuserPeer::ID, $join_behavior); $criteria->addJoin(entryPeer::CONVERSION_PROFILE_ID, conversionProfile2Peer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = entryPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = entryPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = entryPeer::getOMClass($row, 0); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); entryPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined kshow rows $key2 = kshowPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = kshowPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = kshowPeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); kshowPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (entry) to the collection in $obj2 (kshow) $obj2->addentry($obj1); } // if joined row is not null // Add objects for joined kuser rows $key3 = kuserPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = kuserPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = kuserPeer::getOMClass(false); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); kuserPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (entry) to the collection in $obj3 (kuser) $obj3->addentry($obj1); } // if joined row is not null // Add objects for joined conversionProfile2 rows $key4 = conversionProfile2Peer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = conversionProfile2Peer::getInstanceFromPool($key4); if (!$obj4) { $cls = conversionProfile2Peer::getOMClass(false); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); conversionProfile2Peer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (entry) to the collection in $obj4 (conversionProfile2) $obj4->addentry($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public function validateForInsert($propertiesToSkip = array()) { $this->validatePropertyMinLength("name", 1); $this->validateFlavorParamsIds(); $this->validateDefaultEntry(); if ($this->systemName) { $c = KalturaCriteria::create(conversionProfile2Peer::OM_CLASS); $c->add(conversionProfile2Peer::SYSTEM_NAME, $this->systemName); if (conversionProfile2Peer::doCount($c)) { throw new KalturaAPIException(KalturaErrors::SYSTEM_NAME_ALREADY_EXISTS, $this->systemName); } } return parent::validateForInsert($propertiesToSkip); }
/** * Will return for each OLD ConversionProfile a new one, IF NEEDED. * The old conversionProfile will hold a reference to the new one, so if already created a new one, it will be re-used. * All the necessary flavorParams will be added too to fit the old conversion params. * * @param ConversionProfile $conversion_profile * @return conversionProfile2 */ public static function createConversionProfile2FromConversionProfile(ConversionProfile $old_conversion_profile) { if (!$old_conversion_profile) { throw new Exception("Cannot create new conversionProfile2 for null"); } if ($old_conversion_profile->getConversionProfile2Id()) { $new_profile = conversionProfile2Peer::retrieveByPK($old_conversion_profile->getConversionProfile2Id()); if ($new_profile) { // found a valid new profile - return it return $new_profile; } } // whether there was no id or no profile - create on now and set it to be the conversionProfile2Id $new_profile = new conversionProfile2(); $new_profile->setPartnerId($old_conversion_profile->getPartnerId()); $new_name = $old_conversion_profile->getName(); $new_name = $new_name ? $new_name : "From [{$old_conversion_profile->getId()}]"; $new_profile->setName($new_name . " " . $old_conversion_profile->getProfileType()); if ($old_conversion_profile->getBypassFlv()) { $new_profile->setCreationMode(conversionProfile2::CONVERSION_PROFILE_2_CREATION_MODE_AUTOMATIC_BYPASS_FLV); $map = flavorParams::TAG_WEB . "," . flavorParams::TAG_MBR; } else { $new_profile->setCreationMode(conversionProfile2::CONVERSION_PROFILE_2_CREATION_MODE_AUTOMATIC); $map = flavorParams::TAG_WEB; } $new_profile->setInputTagsMap($map); // use the OLD code to simulate what was performed on the old_conversion_profile to retrieve the old_conversion_params list $conv_client = new kConversionClientBase("", "", "", ""); $old_conversion_command = $conv_client->createConversionCommandFromConverionProfile("src", "target", $old_conversion_profile); $description = ''; foreach ($old_conversion_command->conversion_params_list as $old_conversion_params) { // use the helper utility to fill the gaps $desc = ''; self::fixDimensionsByAspectRatio($old_conversion_params, $desc); $description .= $desc; } $new_profile->setDescription($description); $new_profile->save(); // at this point - the all $old_conversion_params are filled with the values used by the old conversion servers // transform from old to new ... // create the flavorParams and the flavorParamsConversionParams table foreach ($old_conversion_command->conversion_params_list as $old_conversion_params) { $new_flavor_params = new flavorParams(); // set all the properties for the new flavor_params $new_flavor_params->setPartnerId($old_conversion_profile->getPartnerId()); $new_flavor_params->setCreationMode(flavorParams::FLAVOR_PARAMS_CREATION_MODE_AUTOMATIC); $audio_bitrate = $old_conversion_params->audio_bitrate; if (!$audio_bitrate) { $audio_bitrate = 96; } // if empty - hard-code 96 $new_flavor_params->setAudioBitrate($audio_bitrate); // default $new_flavor_params->setAudioChannels(0); // default $new_flavor_params->setAudioResolution(0); $new_flavor_params->setAudioSampleRate(0); if ($old_conversion_profile->getCommercialTranscoder()) { // first comes ON2... $new_flavor_params->setConversionEngines(conversionEngineType::ON2 . "," . conversionEngineType::ENCODING_COM . "," . conversionEngineType::FFMPEG . "," . conversionEngineType::FFMPEG_AUX . "," . conversionEngineType::MENCODER); // $new_flavor_params->setConversionEnginesExtraParams($old_conversion_params->flix_params . "|" . $old_conversion_params->flix_params . "|" . $old_conversion_params->ffmpeg_params . "|" . $old_conversion_params->ffmpeg_params . "|" . $old_conversion_params->mencoder_params); } else { // first comes ffmpeg ... $new_flavor_params->setConversionEngines(conversionEngineType::FFMPEG . "," . conversionEngineType::FFMPEG_AUX . "," . conversionEngineType::MENCODER . "," . conversionEngineType::ON2 . "," . conversionEngineType::ENCODING_COM, ","); // $new_flavor_params->setConversionEnginesExtraParams($old_conversion_params->ffmpeg_params . "|" . $old_conversion_params->ffmpeg_params . "|" . $old_conversion_params->mencoder_params . "|" . $old_conversion_params->flix_params . "|" . $old_conversion_params->flix_params); } $target_format = "flv"; // this code will always be called for flv files // the format can be flv | mp4 | mov | avi | mp3 // IMPORTANT: // except for the FLV videos, none of the formats should be assumed WEB - they are not supposed to be played using our player at first stage. switch ($target_format) { case "mp3": $new_flavor_params->setFormat("flv"); $new_flavor_params->setAudioCodec(flavorParams::AUDIO_CODEC_MP3); // set default mp3 $new_flavor_params->setVideoCodec(flavorParams::VIDEO_CODEC_VP6); /* $new_flavor_params->setTags ( flavorParams::TAG_WEB ); */ break; case "mp4": $new_flavor_params->setFormat($target_format); $new_flavor_params->setAudioCodec(flavorParams::AUDIO_CODEC_AAC); $new_flavor_params->setVideoCodec(flavorParams::VIDEO_CODEC_H264); $new_flavor_params->setTags(',mp4_export'); break; case "mov": $new_flavor_params->setFormat($target_format); $new_flavor_params->setAudioCodec(flavorParams::AUDIO_CODEC_AAC); $new_flavor_params->setVideoCodec(flavorParams::VIDEO_CODEC_H264); $new_flavor_params->setTags('mov_export'); break; case "avi": $new_flavor_params->setFormat($target_format); $new_flavor_params->setAudioCodec(flavorParams::AUDIO_CODEC_MP3); $new_flavor_params->setVideoCodec(flavorParams::VIDEO_CODEC_H264); $new_flavor_params->setTags('avi_export'); break; case "flv": $new_flavor_params->setFormat($target_format); $new_flavor_params->setAudioCodec(flavorParams::AUDIO_CODEC_MP3); $new_flavor_params->setVideoCodec(flavorParams::VIDEO_CODEC_VP6); $new_flavor_params->setTags(flavorParams::TAG_WEB . "," . flavorParams::TAG_MBR); break; } $new_flavor_params->setName($new_name); $new_flavor_params->setFrameRate(0); // DONT set the framerate $old_conversion_params->framerate ); if ($old_conversion_params->gop_size == 5) { $new_flavor_params->setGopSize(5); $new_flavor_params->removeTag(flavorParams::TAG_MBR); $new_flavor_params->addTag(flavorParams::TAG_EDIT); } else { $new_flavor_params->setGopSize(0); // 0 will automatically allow default gopsize } $new_flavor_params->setWidth($old_conversion_params->width); $new_flavor_params->setHeight($old_conversion_params->height); $new_flavor_params->setVersion(1); $new_flavor_params->setReadyBehavior(flavorParamsConversionProfile::READY_BEHAVIOR_OPTIONAL); $new_flavor_params->setVideoBitrate($old_conversion_params->bitrate ? $old_conversion_params->bitrate : ""); // TODO - fill the rest ... $new_flavor_params->save(); // add to the 1-to-many table $flavor_params_conversion_profile = new flavorParamsConversionProfile(); $flavor_params_conversion_profile->setConversionProfileId($new_profile->getId()); $flavor_params_conversion_profile->setFlavorParamsId($new_flavor_params->getId()); $flavor_params_conversion_profile->setReadyBehavior($new_flavor_params->getReadyBehavior()); $flavor_params_conversion_profile->save(); } // always add to the *source* flavotParams to the 1-to-many table $flavor_params_conversion_profile = new flavorParamsConversionProfile(); $flavor_params_conversion_profile->setConversionProfileId($new_profile->getId()); $flavor_params_conversion_profile->setFlavorParamsId(flavorParams::SOURCE_FLAVOR_ID); $flavor_params_conversion_profile->save(); // point to the new profile and save the old one $old_conversion_profile->setConversionProfile2Id($new_profile->getId()); $old_conversion_profile->save(); return $new_profile; }
/** * Get the associated conversionProfile2 object * * @param PropelPDO Optional Connection object. * @return conversionProfile2 The associated conversionProfile2 object. * @throws PropelException */ public function getconversionProfile2(PropelPDO $con = null) { if ($this->aconversionProfile2 === null && $this->conversion_profile_id !== null) { $this->aconversionProfile2 = conversionProfile2Peer::retrieveByPk($this->conversion_profile_id); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aconversionProfile2->addentrys($this); */ } return $this->aconversionProfile2; }
public function getconversionProfile2(PropelPDO $con = null) { return conversionProfile2Peer::retrieveByPK($this->conversion_profile_id, $con); }
/** * Delete Conversion Profile by ID * * @action delete * @param int $id * * @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND * @throws KalturaErrors::CANNOT_DELETE_DEFAULT_CONVERSION_PROFILE */ public function deleteAction($id) { $conversionProfileDb = conversionProfile2Peer::retrieveByPK($id); if (!$conversionProfileDb) { throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $id); } if ($conversionProfileDb->getIsDefault() === true) { throw new KalturaAPIException(KalturaErrors::CANNOT_DELETE_DEFAULT_CONVERSION_PROFILE); } $this->deleteFlavorParamsRelation($conversionProfileDb); $conversionProfileDb->setDeletedAt(time()); $conversionProfileDb->save(); }
/** * Selects a collection of flavorParamsConversionProfile objects pre-filled with all related objects except assetParams. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of flavorParamsConversionProfile objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptassetParams(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } flavorParamsConversionProfilePeer::addSelectColumns($criteria); $startcol2 = flavorParamsConversionProfilePeer::NUM_COLUMNS - flavorParamsConversionProfilePeer::NUM_LAZY_LOAD_COLUMNS; conversionProfile2Peer::addSelectColumns($criteria); $startcol3 = $startcol2 + (conversionProfile2Peer::NUM_COLUMNS - conversionProfile2Peer::NUM_LAZY_LOAD_COLUMNS); $criteria->addJoin(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, conversionProfile2Peer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = flavorParamsConversionProfilePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = flavorParamsConversionProfilePeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = flavorParamsConversionProfilePeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); flavorParamsConversionProfilePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined conversionProfile2 rows $key2 = conversionProfile2Peer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = conversionProfile2Peer::getInstanceFromPool($key2); if (!$obj2) { $cls = conversionProfile2Peer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); conversionProfile2Peer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (flavorParamsConversionProfile) to the collection in $obj2 (conversionProfile2) $obj2->addflavorParamsConversionProfile($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public function validateConversionProfile(entry $sourceObject = null) { if (!is_null($this->conversionProfileId) && $this->conversionProfileId != conversionProfile2::CONVERSION_PROFILE_NONE) { $conversionProfile = conversionProfile2Peer::retrieveByPK($this->conversionProfileId); if (!$conversionProfile || $conversionProfile->getType() != ConversionProfileType::LIVE_STREAM) { throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $this->conversionProfileId); } } }
/** * Get Thumb Params by Conversion Profile ID * * @action getByConversionProfileId * @param int $conversionProfileId * @return KalturaThumbParamsArray */ public function getByConversionProfileIdAction($conversionProfileId) { $conversionProfileDb = conversionProfile2Peer::retrieveByPK($conversionProfileId); if (!$conversionProfileDb) { throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId); } $thumbParamsConversionProfilesDb = $conversionProfileDb->getthumbParamsConversionProfilesJointhumbParams(); $thumbParamsDb = array(); foreach ($thumbParamsConversionProfilesDb as $item) { $thumbParamsDb[] = $item->getThumbParams(); } $thumbParams = KalturaThumbParamsArray::fromDbArray($thumbParamsDb); return $thumbParams; }
public function getFieldNameFromPeer($field_name) { $res = conversionProfile2Peer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME); return $res; }
public function validateConversionProfile(entry $sourceObject = null) { if (is_null($this->conversionProfileId)) { return; } if ($sourceObject && $sourceObject->getStatus() != entryStatus::NO_CONTENT) { throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_ENTRY_STATUS, $this->getFormattedPropertyNameWithClassName('conversionProfileId'), $sourceObject->getStatus()); } if ($this->conversionProfileId != conversionProfile2::CONVERSION_PROFILE_NONE) { $conversionProfile = conversionProfile2Peer::retrieveByPK($this->conversionProfileId); if (!$conversionProfile || $conversionProfile->getType() != ConversionProfileType::MEDIA) { throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $this->conversionProfileId); } } }
<?php require_once __DIR__ . '/../bootstrap.php'; if ($argc == 3) { $flavor_param_id = $argv[1]; $conversion_profile_id = $argv[2]; } else { die('usage: php ' . $_SERVER['SCRIPT_NAME'] . " [flavor_param_id] [conversion profile id]" . PHP_EOL); } $conversion_flavor = flavorParamsConversionProfilePeer::retrieveByFlavorParamsAndConversionProfile($flavor_param_id, $conversion_profile_id); if (!$conversion_flavor) { die('no such flavor param id and conversion profile id.' . PHP_EOL); } $conversion = conversionProfile2Peer::retrieveByPK($conversion_profile_id); $input_tags_maps = $conversion->getInputTagsMap(); if (strpos($input_tags_maps, ",mbr") === false) { $input_tags_maps .= ",mbr"; $conversion->setInputTagsMap($input_tags_maps); $conversion->save(); } $conversion_flavor->setReadyBehavior(flavorParamsConversionProfile::READY_BEHAVIOR_OPTIONAL); $conversion_flavor->save(); echo "Done.";