private static function getNextConversionEngine(flavorParamsOutput $flavor, BatchJob $parentJob = null, $lastEngineType, kConvertJobData &$convertData) { KalturaLog::log("Conversion engines string: '" . $flavor->getConversionEngines() . "'"); $currentConversionEngine = null; // TODO remove after all old version flavors migrated // parse supported engine types $conversionEngines = array(); if (!$flavor->getEngineVersion()) { $conversionEngines = explode(',', $flavor->getConversionEngines()); KalturaLog::log(count($conversionEngines) . " conversion engines found for the flavor"); $currentConversionEngine = reset($conversionEngines); // gets the first engine type } // remove until here if (is_null($lastEngineType)) { KalturaLog::log("Last Engine Type is null, engine version [" . $flavor->getEngineVersion() . "]"); if ($flavor->getEngineVersion()) { $operatorSet = new kOperatorSets(); $operatorSet->setSerialized($flavor->getOperators()); $nextOperator = $operatorSet->getOperator(); if (!$nextOperator) { KalturaLog::err("First operator is invalid"); return null; } KalturaLog::log("Set first operator in first set"); $currentConversionEngine = $nextOperator->id; } } else { if ($parentJob && $flavor->getEngineVersion() && ($parentJob->getJobType() == BatchJobType::CONVERT || $parentJob->getJobType() == BatchJobType::POSTCONVERT)) { // using next oprator KalturaLog::log("Adding next conversion operator"); $parentData = $parentJob->getData(); if (!$parentData || !$parentData instanceof kConvartableJobData) { KalturaLog::err("Parent job data is invalid"); return null; } $operatorSet = new kOperatorSets(); $operatorSet->setSerialized($flavor->getOperators()); $nextOperatorSet = $parentData->getCurrentOperationSet(); $nextOperatorIndex = $parentData->getCurrentOperationIndex() + 1; $nextOperator = $operatorSet->getOperator($nextOperatorSet, $nextOperatorIndex); if (!$nextOperator) { KalturaLog::err("Next operator is invalid"); return null; } KalturaLog::log("Moving to next operator [{$nextOperatorIndex}] in set [{$nextOperatorSet}]"); $convertData->setCurrentOperationSet($nextOperatorSet); $convertData->setCurrentOperationIndex($nextOperatorIndex); $currentConversionEngine = $nextOperator->id; } else { // TODO remove after all old version flavors migrated KalturaLog::log("Last used conversion engine is [{$lastEngineType}]"); // searching for $lastEngineType in the list while ($lastEngineType != $currentConversionEngine && next($conversionEngines)) { $currentConversionEngine = current($conversionEngines); } // takes the next engine $currentConversionEngine = next($conversionEngines); if (!$currentConversionEngine) { KalturaLog::err("There is no other conversion engine to use"); return null; } } } KalturaLog::log("Using conversion engine [{$currentConversionEngine}]"); self::contributeToConvertJobData($currentConversionEngine, $convertData); $dbCurrentConversionEngine = kPluginableEnumsManager::apiToCore('conversionEngineType', $currentConversionEngine); return $dbCurrentConversionEngine; }
private static function getSourceFlavorAssets(flavorAsset $flavorAsset, flavorParamsOutput $flavor) { $srcFlavorParamsIds = explode(',', trim($flavor->getSourceAssetParamsIds())); $c = new Criteria(); $c->add(assetPeer::ENTRY_ID, $flavorAsset->getEntryId()); $c->add(assetPeer::STATUS, array(flavorAsset::ASSET_STATUS_READY, flavorAsset::ASSET_STATUS_NOT_APPLICABLE, flavorAsset::ASSET_STATUS_EXPORTING), Criteria::IN); $c->add(assetPeer::FLAVOR_PARAMS_ID, $srcFlavorParamsIds, Criteria::IN); $readyAndNonApplicableAssetsCount = assetPeer::doCount($c); KalturaLog::info('Verify source flavors are ready: number of ready and NA assets [' . $readyAndNonApplicableAssetsCount . '], number of source params ids [' . count($srcFlavorParamsIds) . ']'); if ($readyAndNonApplicableAssetsCount < count($srcFlavorParamsIds)) { KalturaLog::info('Not all source flavors are ready, changing status to WAIT_FOR_CONVERT'); $flavorAsset->setStatus(flavorAsset::ASSET_STATUS_WAIT_FOR_CONVERT); $flavorAsset->setDescription("Source flavor assets are not ready"); $flavorAsset->save(); return false; } $srcFlavors = assetPeer::retrieveLocalReadyByEntryIdAndFlavorParams($flavorAsset->getEntryId(), $srcFlavorParamsIds); if (!count($srcFlavors)) { //assuming all source flavors are Not Applicable KalturaLog::log("Flavor [" . $flavorAsset->getFlavorParamsId() . "] is set to N/A since all it's sources are N/A"); $flavorAsset->setStatus(flavorAsset::ASSET_STATUS_NOT_APPLICABLE); $flavorAsset->save(); return false; } return $srcFlavors; }
private static function isSourceFlavor(flavorParamsOutput $a, flavorParamsOutput $b) { $aSources = explode(',', $a->getSourceAssetParamsIds()); $bSources = explode(',', $b->getSourceAssetParamsIds()); if (in_array($a->getFlavorParamsId(), $bSources)) { KalturaLog::info('Flavor ' . $a->getId() . ' is source of flavor ' . $b->getId()); return -1; } if (in_array($b->getFlavorParamsId(), $aSources)) { KalturaLog::info('Flavor ' . $b->getId() . ' is source of flavor ' . $a->getId()); return 1; } return 0; }
/** * Applies default values to this object. * This method should be called from the object's constructor (or * equivalent initialization method). * @see __construct() */ public function applyDefaultValues() { parent::applyDefaultValues(); $this->type = WidevinePlugin::getAssetTypeCoreValue(WidevineAssetType::WIDEVINE_FLAVOR); }
/** * compareFlavorsByHeight compares to flavorParamsOutput objects by height * * @param flavorParamsOutput $a * @param flavorParamsOutput $b */ public static function compareFlavorsByHeight(flavorParamsOutput $a, flavorParamsOutput $b) { if ($a->getHeight() > $b->getHeight()) { return 1; } return -1; }
public static function doCopy(flavorParams $flavorParams, flavorParamsOutput $flavorParamsOutput) { $flavorParamsOutput->setFlavorParamsId($flavorParams->getId()); $flavorParamsOutput->setFlavorParamsVersion($flavorParams->getVersion()); $flavorParamsOutput->setName($flavorParams->getName()); $flavorParamsOutput->setTags($flavorParams->getTags()); $flavorParamsOutput->setDescription($flavorParams->getDescription()); $flavorParamsOutput->setReadyBehavior($flavorParams->getReadyBehavior()); $flavorParamsOutput->setIsDefault($flavorParams->getIsDefault()); $flavorParamsOutput->setFormat($flavorParams->getFormat()); $flavorParamsOutput->setVideoCodec($flavorParams->getVideoCodec()); $flavorParamsOutput->setVideoBitrate($flavorParams->getVideoBitrate()); $flavorParamsOutput->setAudioCodec($flavorParams->getAudioCodec()); $flavorParamsOutput->setAudioBitrate($flavorParams->getAudioBitrate()); $flavorParamsOutput->setAudioChannels($flavorParams->getAudioChannels()); $flavorParamsOutput->setAudioSampleRate($flavorParams->getAudioSampleRate()); $flavorParamsOutput->setAudioResolution($flavorParams->getAudioResolution()); $flavorParamsOutput->setWidth($flavorParams->getWidth()); $flavorParamsOutput->setHeight($flavorParams->getHeight()); $flavorParamsOutput->setFrameRate($flavorParams->getFrameRate()); $flavorParamsOutput->setGopSize($flavorParams->getGopSize()); $flavorParamsOutput->setTwoPass($flavorParams->getTwoPass()); $flavorParamsOutput->setConversionEngines($flavorParams->getConversionEngines()); $flavorParamsOutput->setConversionEnginesExtraParams($flavorParams->getConversionEnginesExtraParams()); $flavorParamsOutput->setCustomData($flavorParams->getCustomData()); $flavorParamsOutput->save(); return $flavorParamsOutput; }
/** * @return boolean */ public function setPoly2Bitmap($poly2Bitmap) { parent::putInCustomData('poly2Bitmap', $poly2Bitmap); }
public function getDepth() { return parent::getFromCustomData(ImageFlavorParams::CUSTOM_DATA_FIELD_DEPTH); }
/** * @return bool */ public function getReadonly() { return parent::getFromCustomData(PdfFlavorParams::CUSTOM_DATA_FIELD_READONLY, null, false); }
private static function handleOperatorsProcessingFinished(flavorAsset $flavorAsset, flavorParamsOutput $flavorParamsOutput, entry $entry, BatchJob $dbBatchJob, kConvertJobData $data, $rootBatchJob = null) { $offset = $entry->getThumbOffset(); // entry getThumbOffset now takes the partner DefThumbOffset into consideration $createThumb = $entry->getCreateThumb(); $extractMedia = true; if ($entry->getType() != entryType::MEDIA_CLIP) { // e.g. document $extractMedia = false; } if (!kFileSyncUtils::fileSync_exists($flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET))) { $extractMedia = false; $createThumb = false; } $rootBatchJob = $dbBatchJob->getRootJob(); if ($extractMedia && $rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::CONVERT_PROFILE) { $rootBatchJobData = $rootBatchJob->getData(); if ($rootBatchJobData instanceof kConvertProfileJobData) { $extractMedia = $rootBatchJobData->getExtractMedia(); } } // For apple http flavors do not attempt to get thumbs and media info, // It is up to the operator to provide that kind of data, rather than hardcoded check // To-fix if ($flavorParamsOutput->getFormat() == assetParams::CONTAINER_FORMAT_APPLEHTTP) { $createThumb = false; $extractMedia = false; } if ($flavorParamsOutput->getFormat() == assetParams::CONTAINER_FORMAT_WIDEVINE) { $createThumb = false; } if ($createThumb && in_array($flavorParamsOutput->getVideoCodec(), self::$thumbUnSupportVideoCodecs)) { $createThumb = false; } if ($createThumb || $extractMedia) { $postConvertAssetType = BatchJob::POSTCONVERT_ASSET_TYPE_FLAVOR; if ($flavorAsset->getIsOriginal()) { $postConvertAssetType = BatchJob::POSTCONVERT_ASSET_TYPE_SOURCE; } kJobsManager::addPostConvertJob($dbBatchJob, $postConvertAssetType, $data->getDestFileSyncLocalPath(), $data->getFlavorAssetId(), $flavorParamsOutput->getId(), $createThumb, $offset); } else { $flavorAsset = kBusinessPostConvertDL::handleFlavorReady($dbBatchJob, $data->getFlavorAssetId()); if ($flavorAsset) { if ($flavorAsset->hasTag(flavorParams::TAG_SOURCE)) { kBusinessPreConvertDL::continueProfileConvert($dbBatchJob); } if ($flavorAsset->getType() == assetType::FLAVOR) { $flavorAsset->setBitrate($flavorParamsOutput->getVideoBitrate() + $flavorParamsOutput->getAudioBitrate()); $flavorAsset->setWidth($flavorParamsOutput->getWidth()); $flavorAsset->setHeight($flavorParamsOutput->getHeight()); $flavorAsset->setFrameRate($flavorParamsOutput->getFrameRate()); $flavorAsset->setIsOriginal(0); $flavorAsset->save(); } kBusinessPostConvertDL::handleConvertFinished($dbBatchJob, $flavorAsset); } } }
/** * addFlavorConvertJob adds a single flavor conversion * * @param FileSyncKey $srcSyncKey * @param flavorParamsOutput $flavor * @param int $flavorAssetId * @param int $mediaInfoId * @param BatchJob $parentJob * @param int $lastEngineType * @param BatchJob $dbConvertFlavorJob * @return BatchJob */ public static function addFlavorConvertJob(FileSyncKey $srcSyncKey, flavorParamsOutput $flavor, $flavorAssetId, $mediaInfoId = null, BatchJob $parentJob = null, $lastEngineType = null, BatchJob $dbConvertFlavorJob = null) { $localPath = null; $remoteUrl = null; $flavorAsset = assetPeer::retrieveById($flavorAssetId); if (!$flavorAsset) { KalturaLog::err("No flavor asset found for id [{$flavorAssetId}]"); return null; } if ($flavor->getSourceRemoteStorageProfileId() == StorageProfile::STORAGE_KALTURA_DC) { list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false); $partner = PartnerPeer::retrieveByPK($flavorAsset->getPartnerId()); if (!$fileSync) { kBatchManager::updateEntry($flavorAsset->getEntryId(), entryStatus::ERROR_CONVERTING); $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR); $flavorAsset->setDescription("Source file sync not found: {$srcSyncKey}"); $flavorAsset->save(); KalturaLog::err("Source file sync not found: {$srcSyncKey}"); return null; } if (!$local) { if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL && $partner && $partner->getImportRemoteSourceForConvert()) { KalturaLog::debug("Creates import job for remote file sync"); $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT); $flavorAsset->setDescription("Source file sync is importing: {$srcSyncKey}"); $flavorAsset->save(); $originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($flavorAsset->getEntryId()); $url = $fileSync->getExternalUrl($flavorAsset->getEntryId()); return kJobsManager::addImportJob($parentJob, $flavorAsset->getEntryId(), $partner->getId(), $url, $originalFlavorAsset, null, null, true); } throw new kCoreException("Source file not found for flavor conversion [{$flavorAssetId}]", kCoreException::SOURCE_FILE_NOT_FOUND); } if ($fileSync->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_URL) { $localPath = $fileSync->getFullPath(); } $remoteUrl = $fileSync->getExternalUrl($flavorAsset->getEntryId()); } else { $fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($srcSyncKey, $flavor->getSourceRemoteStorageProfileId()); if (!$fileSync) { kBatchManager::updateEntry($flavorAsset->getEntryId(), entryStatus::ERROR_CONVERTING); $description = "Remote source file sync not found {$srcSyncKey}, storage profile id [" . $flavor->getSourceRemoteStorageProfileId() . "]"; KalturaLog::err($description); $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR); $flavorAsset->setDescription($description); $flavorAsset->save(); return null; } $localPath = $fileSync->getFilePath(); $remoteUrl = $fileSync->getExternalUrl($flavorAsset->getEntryId()); } $wamsAssetId = $fileSync->getWamsAssetId(); // creates convert data $convertData = new kConvertJobData(); $convertData->setSrcFileSyncLocalPath($localPath); $convertData->setSrcFileSyncRemoteUrl($remoteUrl); $convertData->setMediaInfoId($mediaInfoId); $convertData->setFlavorParamsOutputId($flavor->getId()); $convertData->setFlavorAssetId($flavorAssetId); $convertData->setSrcFileSyncWamsAssetId($wamsAssetId); KalturaLog::log("Conversion engines string: '" . $flavor->getConversionEngines() . "'"); $currentConversionEngine = null; // TODO remove after all old version flavors migrated // parse supported engine types $conversionEngines = array(); if (!$flavor->getEngineVersion()) { $conversionEngines = explode(',', $flavor->getConversionEngines()); KalturaLog::log(count($conversionEngines) . " conversion engines found for the flavor"); $currentConversionEngine = reset($conversionEngines); // gets the first engine type } // remove until here if (is_null($lastEngineType)) { KalturaLog::log("Last Engine Type is null, engine version [" . $flavor->getEngineVersion() . "]"); if ($flavor->getEngineVersion()) { $operatorSet = new kOperatorSets(); $operatorSet->setSerialized($flavor->getOperators()); $nextOperator = $operatorSet->getOperator(); if (!$nextOperator) { KalturaLog::err("First operator is invalid"); return null; } KalturaLog::log("Set first operator in first set"); $currentConversionEngine = $nextOperator->id; } } else { if ($parentJob && $flavor->getEngineVersion() && ($parentJob->getJobType() == BatchJobType::CONVERT || $parentJob->getJobType() == BatchJobType::POSTCONVERT)) { // using next oprator KalturaLog::log("Adding next conversion operator"); $parentData = $parentJob->getData(); if (!$parentData || !$parentData instanceof kConvartableJobData) { KalturaLog::err("Parent job data is invalid"); return null; } $operatorSet = new kOperatorSets(); $operatorSet->setSerialized($flavor->getOperators()); $nextOperatorSet = $parentData->getCurrentOperationSet(); $nextOperatorIndex = $parentData->getCurrentOperationIndex() + 1; $nextOperator = $operatorSet->getOperator($nextOperatorSet, $nextOperatorIndex); if (!$nextOperator) { KalturaLog::err("Next operator is invalid"); return null; } KalturaLog::log("Moving to next operator [{$nextOperatorIndex}] in set [{$nextOperatorSet}]"); $convertData->setCurrentOperationSet($nextOperatorSet); $convertData->setCurrentOperationIndex($nextOperatorIndex); $currentConversionEngine = $nextOperator->id; } else { // TODO remove after all old version flavors migrated KalturaLog::log("Last used conversion engine is [{$lastEngineType}]"); // searching for $lastEngineType in the list while ($lastEngineType != $currentConversionEngine && next($conversionEngines)) { $currentConversionEngine = current($conversionEngines); } // takes the next engine $currentConversionEngine = next($conversionEngines); if (!$currentConversionEngine) { KalturaLog::err("There is no other conversion engine to use"); return null; } } } if (!is_null($fileSync->getWamsAssetId())) { $currentConversionEngine = conversionEngineType::WAMS; } KalturaLog::log("Using conversion engine [{$currentConversionEngine}]"); // creats a child convert job if (is_null($dbConvertFlavorJob)) { if ($parentJob) { $dbConvertFlavorJob = $parentJob->createChild(); KalturaLog::log("Created from parent convert job with entry id [" . $dbConvertFlavorJob->getEntryId() . "]"); } else { $dbConvertFlavorJob = new BatchJob(); $dbConvertFlavorJob->setEntryId($flavor->getEntryId()); $dbConvertFlavorJob->setPartnerId($flavor->getPartnerId()); $dbConvertFlavorJob->save(); KalturaLog::log("Created from flavor convert job with entry id [" . $dbConvertFlavorJob->getEntryId() . "]"); } } if (!is_null($fileSync->getWamsAssetId())) { $srcFileSize = kWAMS::getInstance($flavor->getPartnerId())->getFileSizeForAssetId($fileSync->getWamsAssetId()); } else { $srcFileSize = kFile::fileSize($convertData->getSrcFileSyncLocalPath()); } $dbConvertFlavorJob->setFileSize($srcFileSize); // TODO remove after all old version flavors migrated if (in_array(conversionEngineType::ENCODING_COM, $conversionEngines)) { $dbConvertFlavorJob->setOnStressDivertTo(conversionEngineType::ENCODING_COM); } // remove until here /* // Remarked by Dor until Tantan's return. // Code is supposed to get a configuration file from the engine and attach it to the batch job. // Was added for document conversion and is not used for now because of a bug of PDFCreator. KalturaLog::log("Calling CDLProceessFlavor with flavor params output[" . $flavor->getId() . "]"); $config = KDLWrap::CDLProceessFlavor($flavor); if($config) { $syncKey = $dbConvertFlavorJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_CONFIG); kFileSyncUtils::file_put_contents($syncKey, $config); $fileSync = kFileSyncUtils::getLocalFileSyncForKey($syncKey); $remoteUrl = $fileSync->getExternalUrl($flavor->getEntryId()); $localPath = kFileSyncUtils::getLocalFilePathForKey($syncKey); $convertData->setConfigLocalPath($localPath); $convertData->setConfigRemoteUrl($remoteUrl); } */ $dbCurrentConversionEngine = kPluginableEnumsManager::apiToCore('conversionEngineType', $currentConversionEngine); return kJobsManager::addJob($dbConvertFlavorJob, $convertData, BatchJobType::CONVERT, $dbCurrentConversionEngine); }
/** * @return boolean */ public function getFlatten() { return parent::getFromCustomData('flatten'); }
/** * addFlavorConvertJob adds a single flavor conversion * * @param FileSyncKey $srcSyncKey * @param flavorParamsOutput $flavor * @param int $flavorAssetId * @param int $mediaInfoId * @param BatchJob $parentJob * @param int $lastEngineType * @param BatchJob $dbConvertFlavorJob * @return BatchJob */ public static function addFlavorConvertJob(FileSyncKey $srcSyncKey, flavorParamsOutput $flavor, $flavorAssetId, $mediaInfoId = null, BatchJob $parentJob = null, $lastEngineType = null, BatchJob $dbConvertFlavorJob = null) { list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false); $localPath = null; $remoteUrl = null; if ($fileSync) { if ($fileSync->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_URL) { $localPath = $fileSync->getFullPath(); } $remoteUrl = $fileSync->getExternalUrl(); } // creates convert data $convertData = new kConvertJobData(); $convertData->setSrcFileSyncLocalPath($localPath); $convertData->setSrcFileSyncRemoteUrl($remoteUrl); $convertData->setMediaInfoId($mediaInfoId); $convertData->setFlavorParamsOutputId($flavor->getId()); $convertData->setFlavorAssetId($flavorAssetId); KalturaLog::log("Conversion engines string: '" . $flavor->getConversionEngines() . "'"); $currentConversionEngine = null; // TODO remove after all old version flavors migrated // parse supported engine types $conversionEngines = array(); if (!$flavor->getEngineVersion()) { $conversionEngines = explode(',', $flavor->getConversionEngines()); KalturaLog::log(count($conversionEngines) . " conversion engines found for the flavor"); $currentConversionEngine = reset($conversionEngines); // gets the first engine type } // remove until here if (is_null($lastEngineType)) { KalturaLog::log("Last Engine Type is null, engine version [" . $flavor->getEngineVersion() . "]"); if ($flavor->getEngineVersion()) { $operatorSet = new kOperatorSets(); $operatorSet->setSerialized($flavor->getOperators()); $nextOperator = $operatorSet->getOperator(); if (!$nextOperator) { KalturaLog::log("First operator is invalid"); return null; } KalturaLog::log("Set first operator in first set"); $currentConversionEngine = $nextOperator->id; } } else { if ($parentJob && $flavor->getEngineVersion() && ($parentJob->getJobType() == BatchJobType::CONVERT || $parentJob->getJobType() == BatchJobType::POSTCONVERT)) { // using next oprator KalturaLog::log("Adding next conversion operator"); $parentData = $parentJob->getData(); if (!$parentData || !$parentData instanceof kConvartableJobData) { KalturaLog::log("Parent job data is invalid"); return null; } $operatorSet = new kOperatorSets(); $operatorSet->setSerialized($flavor->getOperators()); $nextOperatorSet = $parentData->getCurrentOperationSet(); $nextOperatorIndex = $parentData->getCurrentOperationIndex() + 1; $nextOperator = $operatorSet->getOperator($nextOperatorSet, $nextOperatorIndex); if (!$nextOperator) { KalturaLog::log("Next operator is invalid"); return null; } KalturaLog::log("Moving to next operator [{$nextOperatorIndex}] in set [{$nextOperatorSet}]"); $convertData->setCurrentOperationSet($nextOperatorSet); $convertData->setCurrentOperationIndex($nextOperatorIndex); $currentConversionEngine = $nextOperator->id; } else { // TODO remove after all old version flavors migrated KalturaLog::log("Last used conversion engine is [{$lastEngineType}]"); // searching for $lastEngineType in the list while ($lastEngineType != $currentConversionEngine && next($conversionEngines)) { $currentConversionEngine = current($conversionEngines); } // takes the next engine $currentConversionEngine = next($conversionEngines); if (!$currentConversionEngine) { KalturaLog::log("There is no other conversion engine to use"); return null; } } } KalturaLog::log("Using conversion engine [{$currentConversionEngine}]"); // creats a child convert job if (is_null($dbConvertFlavorJob)) { if ($parentJob) { $dbConvertFlavorJob = $parentJob->createChild(); KalturaLog::log("Created from parent convert job with entry id [" . $dbConvertFlavorJob->getEntryId() . "]"); } else { $dbConvertFlavorJob = new BatchJob(); $dbConvertFlavorJob->setEntryId($flavor->getEntryId()); $dbConvertFlavorJob->setPartnerId($flavor->getPartnerId()); $dbConvertFlavorJob->save(); KalturaLog::log("Created from flavor convert job with entry id [" . $dbConvertFlavorJob->getEntryId() . "]"); } } $dbConvertFlavorJob->setFileSize(filesize($convertData->getSrcFileSyncLocalPath())); // TODO remove after all old version flavors migrated if (in_array(conversionEngineType::ENCODING_COM, $conversionEngines)) { $dbConvertFlavorJob->setOnStressDivertTo(conversionEngineType::ENCODING_COM); } // remove until here /* // Remarked by Dor until Tantan's return. // Code is supposed to get a configuration file from the engine and attach it to the batch job. // Was added for document conversion and is not used for now because of a bug of PDFCreator. KalturaLog::log("Calling CDLProceessFlavor with flavor params output[" . $flavor->getId() . "]"); $config = KDLWrap::CDLProceessFlavor($flavor); if($config) { $syncKey = $dbConvertFlavorJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_CONFIG); kFileSyncUtils::file_put_contents($syncKey, $config); $fileSync = kFileSyncUtils::getLocalFileSyncForKey($syncKey); $remoteUrl = $fileSync->getExternalUrl(); $localPath = kFileSyncUtils::getLocalFilePathForKey($syncKey); $convertData->setConfigLocalPath($localPath); $convertData->setConfigRemoteUrl($remoteUrl); } */ $dbCurrentConversionEngine = kPluginableEnumsManager::apiToCore('conversionEngineType', $currentConversionEngine); return kJobsManager::addJob($dbConvertFlavorJob, $convertData, BatchJobType::CONVERT, $dbCurrentConversionEngine); }