當前位置: 首頁>>代碼示例>>PHP>>正文


PHP kFileSyncUtils::addFromWAMS方法代碼示例

本文整理匯總了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());
//.........這裏部分代碼省略.........
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:101,代碼來源:kFlowHelper.php


注:本文中的kFileSyncUtils::addFromWAMS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。