当前位置: 首页>>代码示例>>PHP>>正文


PHP kJobsManager::addConvertProfileJob方法代码示例

本文整理汇总了PHP中kJobsManager::addConvertProfileJob方法的典型用法代码示例。如果您正苦于以下问题:PHP kJobsManager::addConvertProfileJob方法的具体用法?PHP kJobsManager::addConvertProfileJob怎么用?PHP kJobsManager::addConvertProfileJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kJobsManager的用法示例。


在下文中一共展示了kJobsManager::addConvertProfileJob方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: objectAdded

 /**
  * @param BaseObject $object
  * @return bool true if should continue to the next consumer
  */
 public function objectAdded(BaseObject $object)
 {
     if ($object instanceof flavorAsset && $object->getIsOriginal()) {
         $entry = $object->getentry();
         if ($entry->getType() == entryType::DOCUMENT) {
             if ($entry->getConversionQuality() > 0) {
                 $syncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 $path = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                 kJobsManager::addConvertProfileJob(null, $entry, $object->getId(), $path);
             } else {
                 // only for documents entry, make the source ready since no conversion profile will be executed by default
                 $object->setFlavorParamsId(flavorParams::SOURCE_FLAVOR_ID);
                 $object->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_READY);
                 $object->save();
                 $entry->setStatusReady();
                 $entry->save();
             }
         }
     }
     return true;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:25,代码来源:DocumentCreatedHandler.php

示例2: convert

 /**
  * Convert entry
  * 
  * @param string $entryId Media entry id
  * @param int $conversionProfileId
  * @param KalturaConversionAttributeArray $dynamicConversionAttributes
  * @return bigint job id
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  * @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::FLAVOR_PARAMS_NOT_FOUND
  */
 protected function convert($entryId, $conversionProfileId = null, KalturaConversionAttributeArray $dynamicConversionAttributes = null)
 {
     $entry = entryPeer::retrieveByPK($entryId);
     if (!$entry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
     if (!$srcFlavorAsset) {
         throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
     }
     if (is_null($conversionProfileId) || $conversionProfileId <= 0) {
         $conversionProfile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
         if (!$conversionProfile) {
             throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
         }
         $conversionProfileId = $conversionProfile->getId();
     } else {
         //The search is with the entry's partnerId. so if conversion profile wasn't found it means that the
         //conversionId is not exist or the conversion profileId does'nt belong to this partner.
         $conversionProfile = conversionProfile2Peer::retrieveByPK($conversionProfileId);
         if (is_null($conversionProfile)) {
             throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
         }
     }
     $srcSyncKey = $srcFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     // if the file sync isn't local (wasn't synced yet) proxy request to other datacenter
     list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false);
     if (!$fileSync) {
         throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
     } else {
         if (!$local) {
             kFileUtils::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrl($fileSync));
         }
     }
     // even if it null
     $entry->setConversionQuality($conversionProfileId);
     $entry->save();
     if ($dynamicConversionAttributes) {
         $flavors = assetParamsPeer::retrieveByProfile($conversionProfileId);
         if (!count($flavors)) {
             throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_NOT_FOUND);
         }
         $srcFlavorParamsId = null;
         $flavorParams = $entry->getDynamicFlavorAttributes();
         foreach ($flavors as $flavor) {
             if ($flavor->hasTag(flavorParams::TAG_SOURCE)) {
                 $srcFlavorParamsId = $flavor->getId();
             }
             $flavorParams[$flavor->getId()] = $flavor;
         }
         $dynamicAttributes = array();
         foreach ($dynamicConversionAttributes as $dynamicConversionAttribute) {
             if (is_null($dynamicConversionAttribute->flavorParamsId)) {
                 $dynamicConversionAttribute->flavorParamsId = $srcFlavorParamsId;
             }
             if (is_null($dynamicConversionAttribute->flavorParamsId)) {
                 continue;
             }
             $dynamicAttributes[$dynamicConversionAttribute->flavorParamsId][trim($dynamicConversionAttribute->name)] = trim($dynamicConversionAttribute->value);
         }
         if (count($dynamicAttributes)) {
             $entry->setDynamicFlavorAttributes($dynamicAttributes);
             $entry->save();
         }
     }
     $srcFilePath = kFileSyncUtils::getLocalFilePathForKey($srcSyncKey);
     $job = kJobsManager::addConvertProfileJob(null, $entry, $srcFlavorAsset->getId(), $srcFilePath);
     if (!$job) {
         return null;
     }
     return $job->getId();
 }
开发者ID:DBezemer,项目名称:server,代码行数:83,代码来源:KalturaEntryService.php

示例3: addConvertProfileJobAction

 /**
  * batch addConvertProfileJobAction creates a new convert profile job
  * 
  * @action addConvertProfileJob
  * @param string $entryId the id of the entry to be reconverted  
  * @return KalturaBatchJobResponse 
  */
 function addConvertProfileJobAction($entryId)
 {
     $entry = entryPeer::retrieveByPK($entryId);
     if (!$entry) {
         throw new KalturaAPIException(APIErrors::INVALID_ENTRY_ID, 'entry', $entryId);
     }
     $flavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
     if (!$flavorAsset) {
         throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
     }
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     if (!kFileSyncUtils::file_exists($syncKey, true)) {
         throw new KalturaAPIException(APIErrors::NO_FILES_RECEIVED);
     }
     $inputFileSyncLocalPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     $wamsAssetId = kFileSyncUtils::getWamsAssetIdForKey($syncKey);
     $batchJob = kJobsManager::addConvertProfileJob(null, $entry, $flavorAsset->getId(), $inputFileSyncLocalPath, $wamsAssetId);
     return $this->getStatusAction($batchJob->getId(), KalturaBatchJobType::CONVERT_PROFILE);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:26,代码来源:JobsService.php

示例4: handlePostConvertFinished

 /**
  * @param BatchJob $dbBatchJob
  * @param kPostConvertJobData $data
  * @return BatchJob|BatchJob
  */
 public static function handlePostConvertFinished(BatchJob $dbBatchJob, kPostConvertJobData $data)
 {
     if ($dbBatchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED) {
         return $dbBatchJob;
     }
     if ($data->getCreateThumb()) {
         try {
             self::createThumbnail($dbBatchJob, $data);
         } catch (Exception $e) {
             KalturaLog::err($e->getMessage());
             // sometimes, because of disc IO load, it takes long time for the thumb to be moved.
             // in such cases, the entry thumb version may be increased by other process.
             // retry the job, it solves the issue.
             kJobsManager::retryJob($dbBatchJob->getId(), $dbBatchJob->getJobType(), true);
             $dbBatchJob->reload();
             return $dbBatchJob;
         }
     }
     $currentFlavorAsset = kBusinessPostConvertDL::handleFlavorReady($dbBatchJob, $data->getFlavorAssetId());
     if ($data->getPostConvertAssetType() == BatchJob::POSTCONVERT_ASSET_TYPE_SOURCE) {
         $convertProfileJob = $dbBatchJob->getRootJob();
         if ($convertProfileJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
             try {
                 $currFlavorAsset = assetPeer::retrieveById($data->getFlavorAssetId());
                 //In cases we are returning from intermediate flow need to check maybe if another round is needed
                 //This comes to support the creation of silent audio tracks on source assets such as .arf that require initial inter flow for the source and only than the addition
                 //of the silent audio track
                 if ($currFlavorAsset instanceof flavorAsset && $currFlavorAsset->getIsOriginal() && $currFlavorAsset->getInterFlowCount() != null) {
                     //check if the inter flow count is larger than 2.
                     //In this cases probably something went wrong so we will continue with the original flow and will not check if any additioanl inter flow nneds to be done.
                     if ($currentFlavorAsset && $currFlavorAsset->getInterFlowCount() < self::MAX_INTER_FLOW_ITERATIONS_ALLOWED_ON_SOURCE) {
                         $mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($currentFlavorAsset->getId());
                         kBusinessPreConvertDL::decideProfileConvert($dbBatchJob, $convertProfileJob, $mediaInfo->getId());
                     } else {
                         kBusinessPreConvertDL::continueProfileConvert($dbBatchJob);
                     }
                 } else {
                     kBusinessPreConvertDL::continueProfileConvert($dbBatchJob);
                 }
             } catch (Exception $e) {
                 KalturaLog::err($e->getMessage());
                 kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
                 return $dbBatchJob;
             }
         } elseif ($currentFlavorAsset) {
             KalturaLog::log("Root job [" . $convertProfileJob->getId() . "] is not profile conversion");
             $syncKey = $currentFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
             if (kFileSyncUtils::fileSync_exists($syncKey)) {
                 $path = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                 $entry = $dbBatchJob->getEntry();
                 if ($entry) {
                     kJobsManager::addConvertProfileJob(null, $entry, $currentFlavorAsset->getId(), $path);
                 }
             }
             $currentFlavorAsset = null;
         }
     }
     if ($currentFlavorAsset) {
         kBusinessPostConvertDL::handleConvertFinished($dbBatchJob, $currentFlavorAsset);
     }
     return $dbBatchJob;
 }
开发者ID:GElkayam,项目名称:server,代码行数:67,代码来源:kFlowHelper.php

示例5: objectAdded

 public function objectAdded(BaseObject $object, BatchJob $raisedJob = null)
 {
     $entry = $object->getentry();
     if ($object->getStatus() == asset::FLAVOR_ASSET_STATUS_QUEUED || $object->getStatus() == asset::FLAVOR_ASSET_STATUS_IMPORTING) {
         if (!$object instanceof flavorAsset) {
             $object->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
             $object->save();
         } elseif ($object->getIsOriginal()) {
             if ($entry->getType() == entryType::MEDIA_CLIP) {
                 $syncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 if (kFileSyncUtils::fileSync_exists($syncKey)) {
                     // Get the asset fileSync.
                     // For URL typed sync - assume remote and use the relative file path.
                     // For the other types - use the ordinary kFileSyncUtils::getLocalFilePathForKey.
                     $fsArr = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
                     $fs = $fsArr[0];
                     if ($fs->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
                         $path = $fs->getFilePath();
                     } else {
                         $path = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                     }
                     kJobsManager::addConvertProfileJob($raisedJob, $entry, $object->getId(), $path);
                 }
             }
         } else {
             $object->setStatus(asset::FLAVOR_ASSET_STATUS_VALIDATING);
             $object->save();
         }
     }
     if ($object->getStatus() == asset::FLAVOR_ASSET_STATUS_READY && $object instanceof thumbAsset) {
         if ($object->getFlavorParamsId()) {
             kFlowHelper::generateThumbnailsFromFlavor($object->getEntryId(), $raisedJob, $object->getFlavorParamsId());
         } else {
             if ($object->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
                 kBusinessConvertDL::setAsDefaultThumbAsset($object);
             }
         }
         return true;
     }
     if ($object->getIsOriginal() && $entry->getStatus() == entryStatus::NO_CONTENT) {
         $entry->setStatus(entryStatus::PENDING);
         $entry->save();
     }
     return true;
 }
开发者ID:DBezemer,项目名称:server,代码行数:45,代码来源:kFlowManager.php

示例6: objectAdded

 /**
  * @param BaseObject $object
  * @return bool true if should continue to the next consumer
  */
 public function objectAdded(BaseObject $object)
 {
     if ($object instanceof flavorAsset && $object->getIsOriginal()) {
         $entry = $object->getentry();
         if ($entry->getType() == entryType::MEDIA_CLIP) {
             $syncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
             $path = kFileSyncUtils::getLocalFilePathForKey($syncKey);
             kJobsManager::addConvertProfileJob(null, $entry, $object->getId(), $path);
         }
     }
     return true;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:16,代码来源:kFlowManager.php

示例7: handlePostConvertFinished

 /**
  * @param BatchJob $dbBatchJob
  * @param kPostConvertJobData $data
  * @param BatchJob $twinJob
  * @return BatchJob|BatchJob
  */
 public static function handlePostConvertFinished(BatchJob $dbBatchJob, kPostConvertJobData $data, BatchJob $twinJob = null)
 {
     if ($dbBatchJob->getAbort()) {
         return $dbBatchJob;
     }
     if ($data->getCreateThumb()) {
         try {
             self::createThumbnail($dbBatchJob, $data);
         } catch (Exception $e) {
             KalturaLog::err($e->getMessage());
             // sometimes, because of disc IO load, it takes long time for the thumb to be moved.
             // in such cases, the entry thumb version may be increased by other process.
             // retry the job, it solves the issue.
             kJobsManager::retryJob($dbBatchJob->getId(), $dbBatchJob->getJobType(), true);
             $dbBatchJob->reload();
             return $dbBatchJob;
         }
     }
     $currentFlavorAsset = kBusinessPostConvertDL::handleFlavorReady($dbBatchJob, $data->getFlavorAssetId());
     if ($data->getPostConvertAssetType() == BatchJob::POSTCONVERT_ASSET_TYPE_SOURCE) {
         $convertProfileJob = $dbBatchJob->getRootJob();
         if ($convertProfileJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
             try {
                 kBusinessPreConvertDL::continueProfileConvert($dbBatchJob);
             } catch (Exception $e) {
                 KalturaLog::err($e->getMessage());
                 kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
                 return $dbBatchJob;
             }
         } elseif ($currentFlavorAsset) {
             KalturaLog::log("Root job [" . $convertProfileJob->getId() . "] is not profile conversion");
             $syncKey = $currentFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
             if (kFileSyncUtils::fileSync_exists($syncKey)) {
                 KalturaLog::debug("Start conversion");
                 $path = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                 $wamsAssetId = kFileSyncUtils::getWamsAssetIdForKey($syncKey);
                 kJobsManager::addConvertProfileJob(null, $dbBatchJob->getEntry(), $currentFlavorAsset->getId(), $path, $wamsAssetId);
             } else {
                 KalturaLog::debug("File sync not created yet");
             }
             $currentFlavorAsset = null;
         }
     }
     if ($currentFlavorAsset) {
         kBusinessPostConvertDL::handleConvertFinished($dbBatchJob, $currentFlavorAsset);
     }
     return $dbBatchJob;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:54,代码来源:kFlowHelper.php


注:本文中的kJobsManager::addConvertProfileJob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。