本文整理汇总了PHP中kFileSyncUtils::addFromWAMS方法的典型用法代码示例。如果您正苦于以下问题:PHP kFileSyncUtils::addFromWAMS方法的具体用法?PHP kFileSyncUtils::addFromWAMS怎么用?PHP kFileSyncUtils::addFromWAMS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFileSyncUtils
的用法示例。
在下文中一共展示了kFileSyncUtils::addFromWAMS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleConvertFinished
/**
* @param BatchJob $dbBatchJob
* @param kConvertJobData $data
* @param BatchJob $twinJob
* @return BatchJob
*/
public static function handleConvertFinished(BatchJob $dbBatchJob, kConvertJobData $data, BatchJob $twinJob = null)
{
KalturaLog::debug("Convert finished with destination file: " . $data->getDestFileSyncLocalPath());
if ($dbBatchJob->getAbort()) {
kWAMS::getInstance($dbBatchJob->getPartnerId())->deleteAssetById($data->getDestFileSyncWamsAssetId());
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());
}
$flavorAsset->incrementVersion();
$flavorAsset->save();
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$flavorParamsOutput = $data->getFlavorParamsOutput();
$storageProfileId = $flavorParamsOutput->getSourceRemoteStorageProfileId();
if ($storageProfileId == StorageProfile::STORAGE_KALTURA_DC) {
$destFileSyncWamsAssetId = $data->getDestFileSyncWamsAssetId();
if (!empty($destFileSyncWamsAssetId)) {
kFileSyncUtils::addFromWAMS($destFileSyncWamsAssetId, $syncKey);
} else {
kFileSyncUtils::moveFromFile($data->getDestFileSyncLocalPath(), $syncKey);
}
} elseif ($flavorParamsOutput->getRemoteStorageProfileIds()) {
$remoteStorageProfileIds = explode(',', $flavorParamsOutput->getRemoteStorageProfileIds());
foreach ($remoteStorageProfileIds as $remoteStorageProfileId) {
$storageProfile = StorageProfilePeer::retrieveByPK($remoteStorageProfileId);
kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $data->getDestFileSyncLocalPath(), $storageProfile);
}
}
// 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);
}
}
if ($storageProfileId == StorageProfile::STORAGE_KALTURA_DC) {
$data->setDestFileSyncLocalPath(kFileSyncUtils::getLocalFilePathForKey($syncKey));
KalturaLog::debug("Convert archived file to: " . $data->getDestFileSyncLocalPath());
// save the data changes to the db
$dbBatchJob->setData($data);
$dbBatchJob->save();
}
$entry = $dbBatchJob->getEntry();
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $dbBatchJob, $dbBatchJob->getEntryId());
}
$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;
}
$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 ($createThumb && in_array($flavorParamsOutput->getVideoCodec(), self::$thumbUnSupportVideoCodecs)) {
$createThumb = false;
}
$operatorSet = new kOperatorSets();
$operatorSet->setSerialized(stripslashes($flavorParamsOutput->getOperators()));
// KalturaLog::debug("Operators: ".$flavorParamsOutput->getOperators()
// ."\ngetCurrentOperationSet:".$data->getCurrentOperationSet()
// ."\ngetCurrentOperationIndex:".$data->getCurrentOperationIndex());
// KalturaLog::debug("Operators set: " . print_r($operatorSet, true));
$nextOperator = $operatorSet->getOperator($data->getCurrentOperationSet(), $data->getCurrentOperationIndex() + 1);
$nextJob = null;
if ($nextOperator) {
// KalturaLog::debug("Found next operator");
$nextJob = kJobsManager::addFlavorConvertJob($syncKey, $flavorParamsOutput, $data->getFlavorAssetId(), $data->getMediaInfoId(), $dbBatchJob, $dbBatchJob->getJobSubType());
//.........这里部分代码省略.........