本文整理汇总了PHP中assetParamsPeer::retrieveBySystemName方法的典型用法代码示例。如果您正苦于以下问题:PHP assetParamsPeer::retrieveBySystemName方法的具体用法?PHP assetParamsPeer::retrieveBySystemName怎么用?PHP assetParamsPeer::retrieveBySystemName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetParamsPeer
的用法示例。
在下文中一共展示了assetParamsPeer::retrieveBySystemName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decideSourceFlavorConvert
private static function decideSourceFlavorConvert($entryId, assetParams $sourceFlavor = null, flavorAsset $originalFlavorAsset, $conversionProfileId, $flavors, mediaInfo $mediaInfo = null, BatchJob $parentJob, BatchJob $convertProfileJob)
{
if ($sourceFlavor && ($sourceFlavor->getOperators() || $sourceFlavor->getConversionEngines()) && $originalFlavorAsset->getInterFlowCount() == null) {
KalturaLog::log("Source flavor asset requires conversion");
self::adjustAssetParams($entryId, array($sourceFlavor));
$srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$errDescription = null;
$sourceFlavorOutput = self::validateFlavorAndMediaInfo($sourceFlavor, $mediaInfo, $errDescription);
if (!$sourceFlavorOutput) {
if (!$errDescription) {
$errDescription = "Failed to create flavor params output from source flavor";
}
$originalFlavorAsset->setDescription($originalFlavorAsset->getDescription() . "\n{$errDescription}");
$originalFlavorAsset->setStatus(flavorAsset::ASSET_STATUS_ERROR);
$originalFlavorAsset->save();
kBatchManager::updateEntry($entryId, entryStatus::ERROR_CONVERTING);
kJobsManager::updateBatchJob($convertProfileJob, BatchJob::BATCHJOB_STATUS_FAILED);
return false;
}
} elseif ($mediaInfo) {
/*
* Check whether there is a need for an intermediate source pre-processing
*/
$sourceFlavorOutput = KDLWrap::GenerateIntermediateSource($mediaInfo, $flavors);
if (!$sourceFlavorOutput) {
return true;
}
$srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$errDescription = null;
/*
* Save the original source asset in another asset, in order
* to prevent its liquidated by the inter-source asset.
* But, do it only if the conversion profile contains source flavor
*/
if ($sourceFlavor) {
$sourceAsset = assetPeer::retrieveById($mediaInfo->getFlavorAssetId());
$copyFlavorParams = assetParamsPeer::retrieveBySystemName(self::SAVE_ORIGINAL_SOURCE_FLAVOR_PARAM_SYS_NAME);
if (!$copyFlavorParams) {
throw new APIException(APIErrors::OBJECT_NOT_FOUND);
}
$asset = $sourceAsset->copy();
$asset->setFlavorParamsId($copyFlavorParams->getId());
$asset->setFromAssetParams($copyFlavorParams);
$asset->setStatus(flavorAsset::ASSET_STATUS_READY);
$asset->setIsOriginal(0);
$asset->setTags($copyFlavorParams->getTags());
$asset->incrementVersion();
$asset->save();
kFileSyncUtils::createSyncFileLinkForKey($asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET), $sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
$origFileSync = kFileSyncUtils::getLocalFileSyncForKey($sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
$asset->setSize(intval($origFileSync->getFileSize() / 1000));
$asset->save();
}
}
/*
* '_passthrough' controls whether the source is to be 'passthrough' although there
* is a source flavor that contains transcoder settings.
* Looks for a '_passthrough' flag on the source's flavor params output.
*/
if (!$sourceFlavorOutput || $sourceFlavorOutput->_passthrough == true) {
return true;
}
// save flavor params
$sourceFlavorOutput->setPartnerId($sourceFlavorOutput->getPartnerId());
$sourceFlavorOutput->setEntryId($entryId);
$sourceFlavorOutput->setFlavorAssetId($originalFlavorAsset->getId());
$sourceFlavorOutput->setFlavorAssetVersion($originalFlavorAsset->getVersion());
$sourceFlavorOutput->save();
if ($errDescription) {
$originalFlavorAsset->setDescription($originalFlavorAsset->getDescription() . "\n{$errDescription}");
}
$errDescription = kBusinessConvertDL::parseFlavorDescription($sourceFlavorOutput);
if ($errDescription) {
$originalFlavorAsset->setDescription($originalFlavorAsset->getDescription() . "\n{$errDescription}");
}
// decided by the business logic layer
if ($sourceFlavorOutput->_create_anyway) {
KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] selected to be created anyway");
} else {
if (!$sourceFlavorOutput->IsValid()) {
KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] is invalid");
$originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
$originalFlavorAsset->save();
$errDescription = "Source flavor could not be converted";
self::setError($errDescription, $convertProfileJob, BatchJobType::CONVERT_PROFILE, $convertProfileJob->getEntryId());
return false;
}
if ($sourceFlavorOutput->_force) {
KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] is forced");
} elseif ($sourceFlavorOutput->_isNonComply) {
KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] is none-comply");
} else {
KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] is valid");
}
}
$originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_CONVERTING);
if (isset($sourceFlavor)) {
$originalFlavorAsset->addTags($sourceFlavor->getTagsArray());
$originalFlavorAsset->setFileExt($sourceFlavorOutput->getFileExt());
$originalFlavorAsset->save();
//.........这里部分代码省略.........
示例2: saveOriginalSource
private static function saveOriginalSource($mediaInfo)
{
$sourceAsset = assetPeer::retrieveById($mediaInfo->getFlavorAssetId());
$copyFlavorParams = assetParamsPeer::retrieveBySystemName(self::SAVE_ORIGINAL_SOURCE_FLAVOR_PARAM_SYS_NAME);
if (!$copyFlavorParams) {
throw new APIException(APIErrors::OBJECT_NOT_FOUND);
}
$asset = $sourceAsset->copy();
$asset->setFlavorParamsId($copyFlavorParams->getId());
$asset->setFromAssetParams($copyFlavorParams);
$asset->setStatus(flavorAsset::ASSET_STATUS_READY);
$asset->setIsOriginal(0);
$asset->setTags($copyFlavorParams->getTags());
$asset->incrementVersion();
$asset->save();
kFileSyncUtils::createSyncFileLinkForKey($asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET), $sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
$origFileSync = kFileSyncUtils::getLocalFileSyncForKey($sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
$asset->setSize(intval($origFileSync->getFileSize() / 1000));
$asset->save();
}