本文整理汇总了PHP中kJobsManager::addConvertIsmCollectionJob方法的典型用法代码示例。如果您正苦于以下问题:PHP kJobsManager::addConvertIsmCollectionJob方法的具体用法?PHP kJobsManager::addConvertIsmCollectionJob怎么用?PHP kJobsManager::addConvertIsmCollectionJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kJobsManager
的用法示例。
在下文中一共展示了kJobsManager::addConvertIsmCollectionJob方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decideProfileFlavorsConvert
public static function decideProfileFlavorsConvert(BatchJob $parentJob, BatchJob $convertProfileJob, array $flavors, array $conversionProfileFlavorParams, mediaInfo $mediaInfo = null)
{
$entryId = $convertProfileJob->getEntryId();
$originalFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entryId);
if (is_null($originalFlavorAsset)) {
$errDescription = 'Original flavor asset not found';
KalturaLog::err($errDescription);
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription, BatchJobType::CONVERT_PROFILE);
kBatchManager::updateEntry($convertProfileJob, entryStatus::ERROR_CONVERTING);
return false;
}
$errDescription = null;
$finalFlavors = self::validateConversionProfile($convertProfileJob->getPartnerId(), $entryId, $mediaInfo, $flavors, $conversionProfileFlavorParams, $errDescription);
KalturaLog::log(count($finalFlavors) . " flavors returned from the decision layer");
if (is_null($finalFlavors)) {
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription);
KalturaLog::log("No flavors created");
throw new Exception($errDescription);
}
if (strlen($errDescription)) {
$err = $convertProfileJob->getDescription() . $errDescription;
$convertProfileJob->setDescription($err);
$convertProfileJob->save();
}
$srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$conversionsCreated = 0;
$entry = $convertProfileJob->getEntry();
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $convertProfileJob, $entryId);
}
$flavorsCollections = array();
// create a convert job per each flavor
foreach ($finalFlavors as $flavor) {
$flavorAsset = kBatchManager::createFlavorAsset($flavor, $entry->getPartnerId(), $entry->getId());
if (!$flavorAsset) {
KalturaLog::log("Flavor asset could not be created, flavor conversion won't be created");
continue;
}
$collectionTag = $flavor->getCollectionTag();
if ($collectionTag) {
$flavorsCollections[$collectionTag][] = $flavor;
continue;
}
KalturaLog::log("Adding flavor conversion with flavor params output id [" . $flavor->getId() . "] and flavor params asset id [" . $flavorAsset->getId() . "]");
$madiaInfoId = $mediaInfo ? $mediaInfo->getId() : null;
$createdJob = kJobsManager::addFlavorConvertJob($srcSyncKey, $flavor, $flavorAsset->getId(), $madiaInfoId, $parentJob);
if ($createdJob) {
$conversionsCreated++;
}
}
foreach ($flavorsCollections as $tag => $flavors) {
switch ($tag) {
case flavorParams::TAG_ISM:
$createdJob = kJobsManager::addConvertIsmCollectionJob($tag, $srcSyncKey, $entry, $parentJob, $flavors);
if ($createdJob) {
$conversionsCreated++;
}
break;
default:
KalturaLog::log("Error: Invalid collection tag [{$tag}]");
break;
}
}
if (!$conversionsCreated) {
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription);
KalturaLog::log("No flavors created: {$errDescription}");
return false;
}
return true;
}
示例2: decideCollectionConvert
private static function decideCollectionConvert($collectionTag, flavorAsset $originalFlavorAsset, entry $entry, BatchJob $parentJob = null, array $flavors)
{
//TODO: add support for source other than original
$srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
switch ($collectionTag) {
case flavorParams::TAG_ISM:
KalturaLog::log("Calling addConvertIsmCollectionJob with [" . count($flavors) . "] flavor params");
return kJobsManager::addConvertIsmCollectionJob($collectionTag, $srcSyncKey, $entry, $parentJob, $flavors, false);
default:
KalturaLog::log("Error: Invalid collection tag [{$collectionTag}]");
return null;
}
}