public static function addFlavorParamsOutputForSourceAssets(kConvertJobData $jobData) { $assetsData = array(); foreach ($jobData->getSrcFileSyncs() as $srcFileSyncDesc) { /** @var $srcFileSyncDesc kSourceFileSyncDescriptor */ $assetId = $srcFileSyncDesc->getAssetId(); $flavorAsset = assetPeer::retrieveById($assetId); $assetsData['asset_' . $assetId . '_bitrate'] = $flavorAsset->getBitrate(); } $pluginData = $jobData->getPluginData(); if (!$pluginData) { $pluginData = array(); } $jobData->setPluginData(array_merge($pluginData, $assetsData)); return $jobData; }
/** * @param BatchJob $dbBatchJob * @param kConvertJobData $data * @param BatchJob $twinJob * @return BatchJob */ public static function handleConvertFailed(BatchJob $dbBatchJob, kConvertJobData $data, BatchJob $twinJob = null) { KalturaLog::debug("Convert failed with destination file: " . $data->getDestFileSyncLocalPath()); if ($dbBatchJob->getAbort()) { return $dbBatchJob; } // verifies that flavor asset created if (!$data->getFlavorAssetId()) { throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $data->getFlavorAssetId()); } $flavorAsset = flavorAssetPeer::retrieveById($data->getFlavorAssetId()); // verifies that flavor asset exists if (!$flavorAsset) { throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $data->getFlavorAssetId()); } $flavorAsset->incrementVersion(); $flavorAsset->save(); $fallbackCreated = kBusinessPostConvertDL::handleConvertFailed($dbBatchJob, $dbBatchJob->getJobSubType(), $data->getFlavorAssetId(), $data->getFlavorParamsOutputId(), $data->getMediaInfoId()); if (!$fallbackCreated) { $rootBatchJob = $dbBatchJob->getRootJob(); if ($rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::BULKDOWNLOAD) { $entryId = $dbBatchJob->getEntryId(); $flavorParamsId = $data->getFlavorParamsOutputId(); $flavorParamsOutput = flavorParamsOutputPeer::retrieveByPK($flavorParamsId); $fileFormat = $flavorParamsOutput->getFileExt(); $entry = $dbBatchJob->getEntry(); $notificationData = array("puserId" => $entry->getPuserId(), "entryId" => $entry->getId(), "entryIntId" => $entry->getIntId(), "entryVersion" => $entry->getVersion(), "fileFormat" => $flavorAsset->getFileExt(), "conversionQuality" => $entry->getConversionQuality()); $extraData = array("data" => json_encode($notificationData), "partner_id" => $entry->getPartnerId(), "puser_id" => $entry->getPuserId(), "entry_id" => $entry->getId(), "entry_int_id" => $entry->getIntId(), "entry_version" => $entry->getVersion(), "conversion_quality" => $entry->getConversionQuality(), "status" => $entry->getStatus(), "abort" => $dbBatchJob->getAbort(), "progress" => $dbBatchJob->getProgress(), "message" => $dbBatchJob->getMessage(), "description" => $dbBatchJob->getDescription(), "updates_count" => $dbBatchJob->getUpdatesCount(), "job_type" => BatchJobType::DOWNLOAD, "conversion_error" => "Error while converting [{$entryId}] [{$fileFormat}]", "status" => BatchJob::BATCHJOB_STATUS_FAILED, "progress" => 0, "debug" => __LINE__); myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_BATCH_JOB_FAILED, $dbBatchJob, $dbBatchJob->getPartnerId(), null, null, $extraData, $entryId); } } return $dbBatchJob; }
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; }
/** * @param BatchJob $dbBatchJob * @param kConvertJobData $data * @return BatchJob */ public static function handleConvertFailed(BatchJob $dbBatchJob, kConvertJobData $data) { if ($dbBatchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED) { return $dbBatchJob; } // verifies that flavor asset created if (!$data->getFlavorAssetId()) { throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $data->getFlavorAssetId()); } $flavorAsset = assetPeer::retrieveById($data->getFlavorAssetId()); // verifies that flavor asset exists if (!$flavorAsset) { throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $data->getFlavorAssetId()); } if (!is_null($data->getEngineMessage())) { $flavorAsset->setDescription($flavorAsset->getDescription() . "\n" . $data->getEngineMessage()); $flavorAsset->save(); } // creats the file sync if (file_exists($data->getLogFileSyncLocalPath())) { $logSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG); try { kFileSyncUtils::moveFromFile($data->getLogFileSyncLocalPath(), $logSyncKey); } catch (Exception $e) { $err = 'Saving conversion log: ' . $e->getMessage(); KalturaLog::err($err); $desc = $dbBatchJob->getDescription() . "\n" . $err; $dbBatchJob->getDescription($desc); } } // $flavorAsset->incrementVersion(); // $flavorAsset->save(); $fallbackCreated = kBusinessPostConvertDL::handleConvertFailed($dbBatchJob, $dbBatchJob->getJobSubType(), $data->getFlavorAssetId(), $data->getFlavorParamsOutputId(), $data->getMediaInfoId()); if (!$fallbackCreated) { $rootBatchJob = $dbBatchJob->getRootJob(); if ($rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::BULKDOWNLOAD) { $entryId = $dbBatchJob->getEntryId(); $flavorParamsId = $data->getFlavorParamsOutputId(); $flavorParamsOutput = assetParamsOutputPeer::retrieveByPK($flavorParamsId); $fileFormat = $flavorParamsOutput->getFileExt(); $entry = $dbBatchJob->getEntry(); if (!$entry) { return $dbBatchJob; } $notificationData = array("puserId" => $entry->getPuserId(), "entryId" => $entry->getId(), "entryIntId" => $entry->getIntId(), "entryVersion" => $entry->getVersion(), "fileFormat" => $flavorAsset->getFileExt(), "conversionQuality" => $entry->getConversionQuality()); $extraData = array("data" => json_encode($notificationData), "partner_id" => $entry->getPartnerId(), "puser_id" => $entry->getPuserId(), "entry_id" => $entry->getId(), "entry_int_id" => $entry->getIntId(), "entry_version" => $entry->getVersion(), "conversion_quality" => $entry->getConversionQuality(), "status" => $entry->getStatus(), "abort" => $dbBatchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED, "message" => $dbBatchJob->getMessage(), "description" => $dbBatchJob->getDescription(), "job_type" => BatchJobType::DOWNLOAD, "conversion_error" => "Error while converting [{$entryId}] [{$fileFormat}]", "status" => BatchJob::BATCHJOB_STATUS_FAILED, "progress" => 0, "debug" => __LINE__); myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_BATCH_JOB_FAILED, $dbBatchJob, $dbBatchJob->getPartnerId(), null, null, $extraData, $entryId); } } return $dbBatchJob; }
/** * 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); }
/** * 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); }
public static function addIsmManifestsToSrcFileSyncDesc(kConvertJobData $jobData) { $additionalFileSyncs = array(); foreach ($jobData->getSrcFileSyncs() as $srcFileSyncDesc) { $ismDescriptor = self::getFileSyncDescriptor($srcFileSyncDesc, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM); $ismcDescriptor = self::getFileSyncDescriptor($srcFileSyncDesc, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISMC); if ($ismDescriptor && $ismcDescriptor) { $additionalFileSyncs[] = $ismDescriptor; $additionalFileSyncs[] = $ismcDescriptor; } } $jobData->setSrcFileSyncs(array_merge($jobData->getSrcFileSyncs(), $additionalFileSyncs)); return $jobData; }