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


PHP entry::generateFileName方法代码示例

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


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

示例1: addConvertIsmCollectionJob

 /**
  * addConvertIsmCollectionJob creates a convert collection job 
  * 
  * @param string $tag 
  * @param FileSyncKey $srcSyncKey
  * @param entry $entry
  * @param BatchJob $parentJob
  * @param array<flavorParamsOutput> $flavorParamsOutputs
  * @return BatchJob
  */
 public static function addConvertIsmCollectionJob($tag, FileSyncKey $srcSyncKey, entry $entry, BatchJob $parentJob = null, array $flavorParamsOutputs, $sameRoot = null)
 {
     list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false);
     $srcFileSyncDescriptor = new kSourceFileSyncDescriptor();
     if ($fileSync) {
         if ($fileSync->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_URL) {
             $srcFileSyncDescriptor->setFileSyncLocalPath($fileSync->getFullPath());
         }
         $srcFileSyncDescriptor->setFileSyncRemoteUrl($fileSync->getExternalUrl($entry->getId()));
         $srcFileSyncDescriptor->setAssetId($fileSync->getObjectId());
         $srcFileSyncDescriptor->setFileSyncObjectSubType($srcSyncKey->getObjectSubType());
     }
     // increment entry version
     $ismVersion = $entry->incrementIsmVersion();
     $entry->save();
     $fileName = $entry->generateFileName(0, $ismVersion);
     // creates convert data
     $convertCollectionData = new kConvertCollectionJobData();
     $convertCollectionData->setSrcFileSyncs(array($srcFileSyncDescriptor));
     $convertCollectionData->setDestFileName($fileName);
     $clipOffset = null;
     $clipDuration = null;
     // look for clipping params
     foreach ($flavorParamsOutputs as $flavorParamsOutput) {
         $clipOffset = $flavorParamsOutput->getClipOffset();
         $clipDuration = $flavorParamsOutput->getClipDuration();
         if (isset($clipOffset) || isset($clipDuration)) {
             KalturaLog::log("Found clipping params: clipOffset({$clipOffset}),clipDuration({$clipDuration})");
             break;
         }
     }
     // check bitrates duplications & update clipping params
     foreach ($flavorParamsOutputs as $flavorParamsOutputIndex => $flavorParamsOutput) {
         // if one of clip params exsits - update the object and db
         if (isset($clipOffset)) {
             $flavorParamsOutputs[$flavorParamsOutputIndex]->setClipOffset($clipOffset);
         }
         if (isset($clipDuration)) {
             $flavorParamsOutputs[$flavorParamsOutputIndex]->setClipDuration($clipDuration);
         }
         if (isset($clipOffset) || isset($clipDuration)) {
             $flavorParamsOutputs[$flavorParamsOutputIndex]->save();
         }
     }
     /*
      * Put together all separted flavor XML's into a single Smooth Streaming preset file
      */
     KalturaLog::log("Calling CDLProceessFlavorsForCollection with [" . count($flavorParamsOutputs) . "] flavor params");
     $presetXml = KDLWrap::CDLProceessFlavorsForCollection($flavorParamsOutputs);
     $presetXml = str_replace(KDLCmdlinePlaceholders::OutFileName, $fileName, $presetXml);
     foreach ($flavorParamsOutputs as $flavorParamsOutput) {
         /*
          * Save in case that videoBitrate was changed by the FlavorsForCollection (see above)
          */
         $flavorParamsOutput->save();
         $convertCollectionFlavorData = new kConvertCollectionFlavorData();
         $convertCollectionFlavorData->setFlavorAssetId($flavorParamsOutput->getFlavorAssetId());
         $convertCollectionFlavorData->setFlavorParamsOutputId($flavorParamsOutput->getId());
         $convertCollectionFlavorData->setReadyBehavior($flavorParamsOutput->getReadyBehavior());
         $convertCollectionFlavorData->setVideoBitrate($flavorParamsOutput->getVideoBitrate());
         $convertCollectionFlavorData->setAudioBitrate($flavorParamsOutput->getAudioBitrate());
         $convertCollectionFlavorData->setAudioBitrate($flavorParamsOutput->getAudioBitrate());
         $convertCollectionData->addFlavor($convertCollectionFlavorData);
     }
     $currentConversionEngine = conversionEngineType::EXPRESSION_ENCODER3;
     KalturaLog::log("Using conversion engine [{$currentConversionEngine}]");
     if ($sameRoot == null) {
         // creats a child convert job
         if ($parentJob) {
             $dbConvertCollectionJob = $parentJob->createChild(BatchJobType::CONVERT_COLLECTION, $currentConversionEngine);
             KalturaLog::log("Created from parent convert job with entry id [" . $dbConvertCollectionJob->getEntryId() . "]");
         } else {
             $dbConvertCollectionJob = new BatchJob();
             $dbConvertCollectionJob->setEntryId($entry->getId());
             $dbConvertCollectionJob->setPartnerId($entry->getPartnerId());
             $dbConvertCollectionJob->setJobType(BatchJobType::CONVERT_COLLECTION);
             $dbConvertCollectionJob->setJobSubType($currentConversionEngine);
         }
     } else {
         $dbConvertCollectionJob = $parentJob->createChild(BatchJobType::CONVERT_COLLECTION, $currentConversionEngine, false);
     }
     $dbConvertCollectionJob->setObjectId($entry->getId());
     $dbConvertCollectionJob->setObjectType(BatchJobObjectType::ENTRY);
     $dbConvertCollectionJob->setStatus(BatchJob::BATCHJOB_STATUS_DONT_PROCESS);
     $dbConvertCollectionJob = kJobsManager::addJob($dbConvertCollectionJob, $convertCollectionData, BatchJobType::CONVERT_COLLECTION, $currentConversionEngine);
     $syncKey = $dbConvertCollectionJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_CONFIG);
     kFileSyncUtils::file_put_contents($syncKey, $presetXml);
     $fileSync = kFileSyncUtils::getLocalFileSyncForKey($syncKey);
     $remoteUrl = $fileSync->getExternalUrl($entry->getId());
     $localPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
//.........这里部分代码省略.........
开发者ID:ace3535,项目名称:server,代码行数:101,代码来源:kJobsManager.php

示例2: generateFileName

 public function generateFileName($sub_type, $version = null)
 {
     if ($sub_type == self::FILE_SYNC_ENTRY_SUB_TYPE_LIVE_PRIMARY || $sub_type == self::FILE_SYNC_ENTRY_SUB_TYPE_LIVE_SECONDARY) {
         return $this->getId() . '_' . $sub_type;
     }
     return parent::generateFileName($sub_type, $version);
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:LiveEntry.php

示例3: addConvertIsmCollectionJob

 /**
  * addConvertIsmCollectionJob creates a convert collection job 
  * 
  * @param string $tag 
  * @param FileSyncKey $srcSyncKey
  * @param entry $entry
  * @param BatchJob $parentJob
  * @param array<flavorParamsOutput> $flavorParamsOutputs
  * @return BatchJob
  */
 public static function addConvertIsmCollectionJob($tag, FileSyncKey $srcSyncKey, entry $entry, BatchJob $parentJob = null, array $flavorParamsOutputs, $dbConvertCollectionJob = null)
 {
     list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false);
     $localPath = null;
     $remoteUrl = null;
     if ($fileSync) {
         if ($fileSync->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_URL) {
             $localPath = $fileSync->getFullPath();
         }
         $remoteUrl = $fileSync->getExternalUrl($entry->getId());
     }
     // increment entry version
     $ismVersion = $entry->incrementIsmVersion();
     $entry->save();
     $fileName = $entry->generateFileName(0, $ismVersion);
     // creates convert data
     $convertCollectionData = new kConvertCollectionJobData();
     $convertCollectionData->setSrcFileSyncLocalPath($localPath);
     $convertCollectionData->setSrcFileSyncRemoteUrl($remoteUrl);
     $convertCollectionData->setDestFileName($fileName);
     $clipOffset = null;
     $clipDuration = null;
     // look for clipping params
     foreach ($flavorParamsOutputs as $flavorParamsOutput) {
         $clipOffset = $flavorParamsOutput->getClipOffset();
         $clipDuration = $flavorParamsOutput->getClipDuration();
         if (isset($clipOffset) || isset($clipDuration)) {
             KalturaLog::log("Found clipping params: clipOffset({$clipOffset}),clipDuration({$clipDuration})");
             break;
         }
     }
     $bitrates = array();
     $finalFlavorParamsOutputs = array();
     // check bitrates duplications & update clipping params
     foreach ($flavorParamsOutputs as $flavorParamsOutputIndex => $flavorParamsOutput) {
         if (!isset($bitrates[$flavorParamsOutput->getVideoBitrate()])) {
             $bitrates[$flavorParamsOutput->getVideoBitrate()] = array();
         }
         // if one of clip params exsits - update the object and db
         if (isset($clipOffset)) {
             $flavorParamsOutputs[$flavorParamsOutputIndex]->setClipOffset($clipOffset);
         }
         if (isset($clipDuration)) {
             $flavorParamsOutputs[$flavorParamsOutputIndex]->setClipDuration($clipDuration);
         }
         if (isset($clipOffset) || isset($clipDuration)) {
             $flavorParamsOutputs[$flavorParamsOutputIndex]->save();
         }
         $bitrates[$flavorParamsOutput->getVideoBitrate()][] = $flavorParamsOutput->getId();
         $finalFlavorParamsOutputs[$flavorParamsOutput->getId()] = $flavorParamsOutput;
     }
     foreach ($bitrates as $bitrate => $flavorParamsOutputIds) {
         if (count($flavorParamsOutputIds) == 1) {
             // no bitrate dupliaction
             continue;
         }
         $tempFlavorParamsOutputs = array();
         foreach ($flavorParamsOutputIds as $index => $flavorParamsOutputId) {
             $tempFlavorParamsOutputs[] = $finalFlavorParamsOutputs[$flavorParamsOutputId];
         }
         // sort the flavors by height
         usort($tempFlavorParamsOutputs, array('kBusinessConvertDL', 'compareFlavorsByHeight'));
         // increment the bitrate so it will be a bit different for each flavor
         $index = 0;
         foreach ($tempFlavorParamsOutputs as $flavorParamsOutput) {
             $finalFlavorParamsOutputs[$flavorParamsOutput->getId()]->setVideoBitrate($bitrate + $index++);
         }
     }
     foreach ($finalFlavorParamsOutputs as $flavorParamsOutput) {
         $convertCollectionFlavorData = new kConvertCollectionFlavorData();
         $convertCollectionFlavorData->setFlavorAssetId($flavorParamsOutput->getFlavorAssetId());
         $convertCollectionFlavorData->setFlavorParamsOutputId($flavorParamsOutput->getId());
         $convertCollectionFlavorData->setReadyBehavior($flavorParamsOutput->getReadyBehavior());
         $convertCollectionFlavorData->setVideoBitrate($flavorParamsOutput->getVideoBitrate());
         $convertCollectionFlavorData->setAudioBitrate($flavorParamsOutput->getAudioBitrate());
         $convertCollectionFlavorData->setAudioBitrate($flavorParamsOutput->getAudioBitrate());
         $convertCollectionData->addFlavor($convertCollectionFlavorData);
     }
     $currentConversionEngine = conversionEngineType::EXPRESSION_ENCODER3;
     KalturaLog::log("Using conversion engine [{$currentConversionEngine}]");
     if (!$dbConvertCollectionJob) {
         // creats a child convert job
         if ($parentJob) {
             $dbConvertCollectionJob = $parentJob->createChild();
             KalturaLog::log("Created from parent convert job with entry id [" . $dbConvertCollectionJob->getEntryId() . "]");
         } else {
             $dbConvertCollectionJob = new BatchJob();
             $dbConvertCollectionJob->setEntryId($entry->getId());
             $dbConvertCollectionJob->setPartnerId($entry->getPartnerId());
             $dbConvertCollectionJob->save();
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:kJobsManager.php


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