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


PHP assetPeer::retrieveOriginalReadyByEntryId方法代码示例

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


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

示例1: __construct

 public function __construct(KalturaDistributionJobData $distributionJobData = null)
 {
     parent::__construct($distributionJobData);
     if (!$distributionJobData) {
         return;
     }
     if (!$distributionJobData->distributionProfile instanceof KalturaYoutubeApiDistributionProfile) {
         return;
     }
     $flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
     if (count($flavorAssets)) {
         // if we have specific flavor assets for this distribution, grab the first one
         $flavorAsset = reset($flavorAssets);
     } else {
         // take the source asset
         $flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($distributionJobData->entryDistribution->entryId);
     }
     if ($flavorAsset) {
         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         if (kFileSyncUtils::fileSync_exists($syncKey)) {
             $this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
         }
     }
     $thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
     if (count($thumbAssets)) {
         $syncKey = reset($thumbAssets)->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         if (kFileSyncUtils::fileSync_exists($syncKey)) {
             $this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
         }
     }
     $this->addCaptionsData($distributionJobData);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:32,代码来源:KalturaYoutubeApiDistributionJobProviderData.php

示例2: __construct

 public function __construct(KalturaDistributionJobData $distributionJobData = null)
 {
     parent::__construct($distributionJobData);
     if (!$distributionJobData) {
         return;
     }
     if (!$distributionJobData->distributionProfile instanceof KalturaDailymotionDistributionProfile) {
         return;
     }
     $flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
     if (count($flavorAssets)) {
         // if we have specific flavor assets for this distribution, grab the first one
         $flavorAsset = reset($flavorAssets);
     } else {
         // take the source asset
         $flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($distributionJobData->entryDistribution->entryId);
     }
     if ($flavorAsset) {
         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         $this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
     }
     // look for krule with action block and condition of country
     $entry = entryPeer::retrieveByPK($distributionJobData->entryDistribution->entryId);
     if ($entry && $entry->getAccessControl()) {
         $this->setGeoBlocking($entry->getAccessControl());
     }
     $this->addCaptionsData($distributionJobData);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:28,代码来源:KalturaDailymotionDistributionJobProviderData.php

示例3: __construct

 public function __construct(KalturaDistributionJobData $distributionJobData = null)
 {
     parent::__construct($distributionJobData);
     if (!$distributionJobData) {
         return;
     }
     if (!$distributionJobData->distributionProfile instanceof KalturaUverseDistributionProfile) {
         return;
     }
     $flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
     if (count($flavorAssets)) {
         // if we have specific flavor assets for this distribution, grab the first one
         $flavorAsset = reset($flavorAssets);
     } else {
         // take the source asset
         $flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($distributionJobData->entryDistribution->entryId);
     }
     if ($flavorAsset) {
         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         if (kFileSyncUtils::fileSync_exists($syncKey)) {
             $this->localAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
         }
     }
     $entryDistributionDb = EntryDistributionPeer::retrieveByPK($distributionJobData->entryDistributionId);
     if ($entryDistributionDb) {
         $this->remoteAssetUrl = $entryDistributionDb->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_URL);
         $this->remoteAssetFileName = $entryDistributionDb->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_FILE_NAME);
     } else {
         KalturaLog::err('Entry distribution [' . $distributionJobData->entryDistributionId . '] not found');
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:KalturaUverseDistributionJobProviderData.php

示例4: attachLiveEntryResource

 /**
  * @param kLiveEntryResource $resource
  * @param entry $dbEntry
  * @param asset $dbAsset
  * @return array $operationAttributes
  * @return asset
  */
 protected function attachLiveEntryResource(kLiveEntryResource $resource, entry $dbEntry, asset $dbAsset = null, array $operationAttributes = null)
 {
     $dbEntry->setRootEntryId($resource->getEntry()->getId());
     $dbEntry->setSource(EntrySourceType::RECORDED_LIVE);
     $dbEntry->save();
     if (!$dbAsset) {
         $dbAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId());
     }
     $offset = null;
     $duration = null;
     $requiredDuration = null;
     $clipAttributes = null;
     if (is_array($operationAttributes)) {
         foreach ($operationAttributes as $operationAttributesItem) {
             if ($operationAttributesItem instanceof kClipAttributes) {
                 $clipAttributes = $operationAttributesItem;
                 // convert milliseconds to seconds
                 $offset = $operationAttributesItem->getOffset();
                 $duration = $operationAttributesItem->getDuration();
                 $requiredDuration = $offset + $duration;
             }
         }
     }
     $dbLiveEntry = $resource->getEntry();
     $dbRecordedEntry = entryPeer::retrieveByPK($dbLiveEntry->getRecordedEntryId());
     if (!$dbRecordedEntry || $requiredDuration && $requiredDuration > $dbRecordedEntry->getLengthInMsecs()) {
         $mediaServer = $dbLiveEntry->getMediaServer(true);
         if (!$mediaServer) {
             throw new KalturaAPIException(KalturaErrors::NO_MEDIA_SERVER_FOUND, $dbLiveEntry->getId());
         }
         $mediaServerLiveService = $mediaServer->getWebService($mediaServer->getLiveWebServiceName());
         if ($mediaServerLiveService && $mediaServerLiveService instanceof KalturaMediaServerLiveService) {
             $mediaServerLiveService->splitRecordingNow($dbLiveEntry->getId());
             $dbLiveEntry->attachPendingMediaEntry($dbEntry, $requiredDuration, $offset, $duration);
             $dbLiveEntry->save();
         } else {
             throw new KalturaAPIException(KalturaErrors::MEDIA_SERVER_SERVICE_NOT_FOUND, $mediaServer->getId(), $mediaServer->getLiveWebServiceName());
         }
         return $dbAsset;
     }
     $dbRecordedAsset = assetPeer::retrieveOriginalReadyByEntryId($dbRecordedEntry->getId());
     if (!$dbRecordedAsset) {
         $dbRecordedAssets = assetPeer::retrieveReadyFlavorsByEntryId($dbRecordedEntry->getId());
         $dbRecordedAsset = array_pop($dbRecordedAssets);
     }
     /* @var $dbRecordedAsset flavorAsset */
     $isNewAsset = false;
     if (!$dbAsset) {
         $isNewAsset = true;
         $dbAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId());
     }
     if (!$dbAsset && $dbEntry->getStatus() == entryStatus::NO_CONTENT) {
         $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
         $dbEntry->save();
     }
     $sourceSyncKey = $dbRecordedAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $dbAsset->setFileExt($dbRecordedAsset->getFileExt());
     $dbAsset->save();
     $syncKey = $dbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     try {
         kFileSyncUtils::createSyncFileLinkForKey($syncKey, $sourceSyncKey);
     } catch (Exception $e) {
         if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
             $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
             $dbEntry->save();
         }
         $dbAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
         $dbAsset->save();
         throw $e;
     }
     if ($requiredDuration) {
         $errDescription = '';
         kBusinessPreConvertDL::decideAddEntryFlavor(null, $dbEntry->getId(), $clipAttributes->getAssetParamsId(), $errDescription, $dbAsset->getId(), array($clipAttributes));
     } else {
         if ($isNewAsset) {
             kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
         }
     }
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAsset));
     return $dbAsset;
 }
开发者ID:DBezemer,项目名称:server,代码行数:88,代码来源:KalturaEntryService.php

示例5: toObject

 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     $object = parent::toObject($object_to_fill, $props_to_skip);
     $entryId = $object->getEntryId();
     $entry = entryPeer::retrieveByPK($entryId);
     $partnerId = $entry->getPartnerId();
     $transcriptId = $object->getInputTranscriptId();
     $voicebaseOptionsObj = VoicebasePlugin::getPartnerVoicebaseOptions($partnerId);
     $object->setApiKey($voicebaseOptionsObj->apiKey);
     $object->setApiPassword($voicebaseOptionsObj->apiPassword);
     if (!$object->getFlavorAssetId()) {
         $sourceAsset = assetPeer::retrieveOriginalReadyByEntryId($entryId);
         if (!$sourceAsset) {
             throw new KalturaAPIException(KalturaVoicebaseErrors::NO_FLAVOR_ASSET_FOUND, $entryId);
         }
         $object->setFlavorAssetId($sourceAsset->getId());
     }
     $voicebaseParamsMap = kConf::get('voicebase', 'integration');
     if (!$object->getSpokenLanguage()) {
         $object->setSpokenLanguage($voicebaseParamsMap['default_language']);
     }
     $formatsString = $object->getCaptionAssetFormats();
     if ($formatsString) {
         $formatsArray = explode(',', $formatsString);
         $excludedFormats = $voicebaseParamsMap['exclude_formats'];
         $sanitizedFormatsArray = array();
         foreach ($formatsArray as $format) {
             $format = preg_replace("/[^A-Z_]/", "", $format);
             if (!constant("KalturaCaptionType::" . $format) || in_array($format, $excludedFormats)) {
                 throw new KalturaAPIException(KalturaVoicebaseErrors::INVALID_TYPES, $formatsString);
             }
             $sanitizedFormatsArray[] = $format;
         }
         $sanitizedFormats = implode(",", $sanitizedFormatsArray);
         $object->setCaptionAssetFormats($sanitizedFormats);
     } else {
         $defaultFormats = implode(",", $voicebaseParamsMap['default_formats']);
         $object->setCaptionAssetFormats($defaultFormats);
     }
     if ($transcriptId) {
         $transcript = assetPeer::retrieveById($transcriptId);
         $key = $transcript->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
         $fileSync = FileSyncPeer::retrieveByFileSyncKey($key, true);
         $object->setFileLocation($fileSync->getFullPath());
     }
     return $object;
 }
开发者ID:DBezemer,项目名称:server,代码行数:47,代码来源:KalturaVoicebaseJobProviderData.php

示例6: toObject

 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     $object = parent::toObject($object_to_fill, $props_to_skip);
     $entryId = $object->getEntryId();
     $entry = entryPeer::retrieveByPK($entryId);
     $partnerId = $entry->getPartnerId();
     $cielo24OptionsObj = Cielo24Plugin::getPartnerCielo24Options($partnerId);
     $object->setUsername($cielo24OptionsObj->username);
     $object->setPassword($cielo24OptionsObj->password);
     if (!$object->getFlavorAssetId()) {
         $sourceAsset = assetPeer::retrieveOriginalReadyByEntryId($entryId);
         if (!$sourceAsset) {
             throw new KalturaAPIException(KalturaCielo24Errors::NO_FLAVOR_ASSET_FOUND, $entryId);
         }
         $object->setFlavorAssetId($sourceAsset->getId());
     }
     $cielo24ParamsMap = kConf::get('cielo24', 'integration');
     if (!$object->getSpokenLanguage()) {
         $object->setSpokenLanguage($cielo24ParamsMap['default_language']);
     }
     $formatsString = $object->getCaptionAssetFormats();
     if ($formatsString) {
         $formatsArray = explode(',', $formatsString);
         $excludedFormats = $cielo24ParamsMap['exclude_formats'];
         $sanitizedFormatsArray = array();
         foreach ($formatsArray as $format) {
             $format = preg_replace("/[^A-Z_]/", "", $format);
             if (!constant("KalturaCaptionType::" . $format) || in_array($format, $excludedFormats)) {
                 throw new KalturaAPIException(KalturaCielo24Errors::INVALID_TYPES, $formatsString);
             }
             $sanitizedFormatsArray[] = $format;
         }
         $sanitizedFormats = implode(",", $sanitizedFormatsArray);
         $object->setCaptionAssetFormats($sanitizedFormats);
     } else {
         $defaultFormats = implode(",", $cielo24ParamsMap['default_formats']);
         $object->setCaptionAssetFormats($defaultFormats);
     }
     if (!$object->getPriority()) {
         $object->setPriority($cielo24ParamsMap['default_priority']);
     }
     if (!$object->getFidelity()) {
         $object->setFidelity($cielo24ParamsMap['default_fidelity']);
     }
     return $object;
 }
开发者ID:DBezemer,项目名称:server,代码行数:46,代码来源:KalturaCielo24JobProviderData.php

示例7: resizeEntryImage

 public static function resizeEntryImage(entry $entry, $version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $orig_image_path = null, $density = 0, $stripProfiles = false, $thumbParams = null, $format = null)
 {
     if (is_null($thumbParams) || !$thumbParams instanceof kThumbnailParameters) {
         $thumbParams = new kThumbnailParameters();
     }
     $contentPath = myContentStorage::getFSContentRootPath();
     $entry_status = $entry->getStatus();
     $thumbName = $entry->getId() . "_{$width}_{$height}_{$type}_{$crop_provider}_{$bgcolor}_{$quality}_{$src_x}_{$src_y}_{$src_w}_{$src_h}_{$vid_sec}_{$vid_slice}_{$vid_slices}_{$entry_status}";
     if ($orig_image_path) {
         $thumbName .= '_oip_' . basename($orig_image_path);
     }
     if ($density) {
         $thumbName .= "_dns_{$density}";
     }
     if ($stripProfiles) {
         $thumbName .= "_stp_{$stripProfiles}";
     }
     $entryThumbFilename = $entry->getThumbnail() ? $entry->getThumbnail() : "0.jpg";
     if ($entry->getStatus() != entryStatus::READY || @$entryThumbFilename[0] == '&') {
         $thumbName .= "_NOCACHE_";
     }
     // we remove the & from the template thumb otherwise getGeneralEntityPath will drop $tempThumbName from the final path
     $entryThumbFilename = str_replace("&", "", $entryThumbFilename);
     //create final path for thumbnail created
     $finalBasePath = myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $thumbName, $entryThumbFilename, $version);
     $finalThumbPath = $contentPath . $finalBasePath;
     //Add unique id to the proccesing file path to avoid file being overwritten when several identical (with same parameters) calls are made before the final thumbnail is created
     $thumbName .= "_" . uniqid() . "_";
     //create path for processing thumbnail request
     $processingBasePath = myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $thumbName, $entryThumbFilename, $version);
     $processingThumbPath = $contentPath . $processingBasePath;
     if (!is_null($format)) {
         $finalThumbPath = kFile::replaceExt($finalThumbPath, $format);
         $processingThumbPath = kFile::replaceExt($processingThumbPath, $format);
     }
     if (file_exists($finalThumbPath) && @filesize($finalThumbPath)) {
         header("X-Kaltura:cached-thumb-exists," . md5($finalThumbPath));
         return $finalThumbPath;
     }
     if ($orig_image_path === null || !file_exists($orig_image_path)) {
         $orig_image_path = self::getLocalImageFilePathByEntry($entry, $version);
     }
     // remark added so ffmpeg will try to load the thumbnail from the original source
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE && !file_exists($orig_image_path)) {
         throw new kFileSyncException('no ready filesync on current DC', kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC);
     }
     // check a request for animated thumbs without a concrete vid_slice
     // in which case we'll create all the frames as one wide image
     $multi = $vid_slice == -1 && $vid_slices != -1;
     $count = $multi ? $vid_slices : 1;
     $im = null;
     if ($multi) {
         $vid_slice = 0;
     }
     while ($count--) {
         if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO && ($vid_sec != -1 || $vid_slices != -1) || !file_exists($orig_image_path)) {
             if ($vid_sec != -1) {
                 $calc_vid_sec = min($vid_sec, floor($entry->getLengthInMsecs() / 1000));
             } else {
                 if ($vid_slices != -1) {
                     $calc_vid_sec = floor($entry->getLengthInMsecs() / $vid_slices * min($vid_slice, $vid_slices) / 1000);
                 } else {
                     if ($entry->getStatus() != entryStatus::READY && $entry->getLengthInMsecs() == 0) {
                         $calc_vid_sec = $entry->getPartner() && $entry->getPartner()->getDefThumbOffset() ? $entry->getPartner()->getDefThumbOffset() : 3;
                     } else {
                         $calc_vid_sec = $entry->getBestThumbOffset();
                     }
                 }
             }
             $capturedThumbName = $entry->getId() . "_sec_{$calc_vid_sec}";
             $capturedThumbPath = $contentPath . myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $capturedThumbName, $entry->getThumbnail(), $version);
             $orig_image_path = $capturedThumbPath . "temp_1.jpg";
             // if we already captured the frame at that second, dont recapture, just use the existing file
             if (!file_exists($orig_image_path)) {
                 // limit creation of more than XX ffmpeg image extraction processes
                 if (kConf::hasParam("resize_thumb_max_processes_ffmpeg") && trim(exec("ps -e -ocmd|awk '{print \$1}'|grep -c " . kConf::get("bin_path_ffmpeg"))) > kConf::get("resize_thumb_max_processes_ffmpeg")) {
                     KExternalErrors::dieError(KExternalErrors::TOO_MANY_PROCESSES);
                 }
                 // creating the thumbnail is a very heavy operation
                 // prevent calling it in parallel for the same thubmnail for 5 minutes
                 $cache = new myCache("thumb-processing", 5 * 60);
                 // 5 minutes
                 $processing = $cache->get($orig_image_path);
                 if ($processing) {
                     KExternalErrors::dieError(KExternalErrors::PROCESSING_CAPTURE_THUMBNAIL);
                 }
                 $cache->put($orig_image_path, true);
                 $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId(), flavorParams::TAG_THUMBSOURCE);
                 if (is_null($flavorAsset)) {
                     $flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($entry->getId());
                     if ($flavorAsset) {
                         $flavorSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                         list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($flavorSyncKey, false, false);
                         if (!$fileSync) {
                             $flavorAsset = null;
                         }
                     }
                     if (is_null($flavorAsset) || !($flavorAsset->hasTag(flavorParams::TAG_MBR) || $flavorAsset->hasTag(flavorParams::TAG_WEB))) {
                         // try the best playable
                         $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId(), null, flavorParams::TAG_SAVE_SOURCE);
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:myEntryUtils.class.php

示例8: resizeEntryImage

 public static function resizeEntryImage(entry $entry, $version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $orig_image_path = null, $density = 0, $stripProfiles = false, $thumbParams = null)
 {
     if (is_null($thumbParams) || !$thumbParams instanceof kThumbnailParameters) {
         $thumbParams = new kThumbnailParameters();
     }
     $contentPath = myContentStorage::getFSContentRootPath();
     $entry_status = $entry->getStatus();
     $tempThumbName = $entry->getId() . "_{$width}_{$height}_{$type}_{$crop_provider}_{$bgcolor}_{$quality}_{$src_x}_{$src_y}_{$src_w}_{$src_h}_{$vid_sec}_{$vid_slice}_{$vid_slices}_{$entry_status}";
     if ($orig_image_path) {
         $tempThumbName .= '_oip_' . basename($orig_image_path);
     }
     if ($density) {
         $tempThumbName .= "_dns_{$density}";
     }
     if ($stripProfiles) {
         $tempThumbName .= "_stp_{$stripProfiles}";
     }
     $entryThumbFilename = $entry->getThumbnail() ? $entry->getThumbnail() : "0.jpg";
     if ($entry->getStatus() != entryStatus::READY || @$entryThumbFilename[0] == '&') {
         $tempThumbName .= "_NOCACHE_";
     }
     // we remove the & from the template thumb otherwise getGeneralEntityPath will drop $tempThumbName from the final path
     $entryThumbFilename = str_replace("&", "", $entryThumbFilename);
     $basePath = myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $tempThumbName, $entryThumbFilename, $version);
     $tempThumbPath = $contentPath . $basePath;
     if (file_exists($tempThumbPath) && @filesize($tempThumbPath)) {
         header("X-Kaltura:cached-thumb-exists," . md5($tempThumbPath));
         return $tempThumbPath;
     }
     if ($orig_image_path === null || !file_exists($orig_image_path)) {
         $sub_type = $entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE ? entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA : entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB;
         $orig_image_key = $entry->getSyncKey($sub_type, $version);
         $orig_image_path = kFileSyncUtils::getReadyLocalFilePathForKey($orig_image_key);
     }
     // remark added so ffmpeg will try to load the thumbnail from the original source
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE && !file_exists($orig_image_path)) {
         throw new kFileSyncException('no ready filesync on current DC', kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC);
     }
     // check a request for animated thumbs without a concrete vid_slice
     // in which case we'll create all the frames as one wide image
     $multi = $vid_slice == -1 && $vid_slices != -1;
     $count = $multi ? $vid_slices : 1;
     $im = null;
     if ($multi) {
         $vid_slice = 0;
     }
     while ($count--) {
         if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO && ($vid_sec != -1 || $vid_slices != -1) || !file_exists($orig_image_path)) {
             if ($vid_sec != -1) {
                 $calc_vid_sec = min($vid_sec, floor($entry->getLengthInMsecs() / 1000));
             } else {
                 if ($vid_slices != -1) {
                     $calc_vid_sec = floor($entry->getLengthInMsecs() / $vid_slices * min($vid_slice, $vid_slices) / 1000);
                 } else {
                     if ($entry->getStatus() != entryStatus::READY && $entry->getLengthInMsecs() == 0) {
                         $calc_vid_sec = $entry->getPartner() && $entry->getPartner()->getDefThumbOffset() ? $entry->getPartner()->getDefThumbOffset() : 3;
                     } else {
                         $calc_vid_sec = $entry->getBestThumbOffset();
                     }
                 }
             }
             $capturedThumbName = $entry->getId() . "_sec_{$calc_vid_sec}";
             $capturedThumbPath = $contentPath . myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $capturedThumbName, $entry->getThumbnail(), $version);
             $orig_image_path = $capturedThumbPath . "temp_1.jpg";
             // if we already captured the frame at that second, dont recapture, just use the existing file
             if (!file_exists($orig_image_path)) {
                 // creating the thumbnail is a very heavy operation
                 // prevent calling it in parallel for the same thubmnail for 5 minutes
                 $cache = new myCache("thumb-processing", 5 * 60);
                 // 5 minutes
                 $processing = $cache->get($orig_image_path);
                 if ($processing) {
                     KExternalErrors::dieError(KExternalErrors::PROCESSING_CAPTURE_THUMBNAIL);
                 }
                 $cache->put($orig_image_path, true);
                 $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId(), flavorParams::TAG_THUMBSOURCE);
                 if (is_null($flavorAsset)) {
                     $flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($entry->getId());
                     if (is_null($flavorAsset) || !($flavorAsset->hasTag(flavorParams::TAG_MBR) || $flavorAsset->hasTag(flavorParams::TAG_WEB))) {
                         // try the best playable
                         $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId());
                     }
                     if (is_null($flavorAsset)) {
                         // if no READY ORIGINAL entry is available, try to retrieve a non-READY ORIGINAL entry
                         $flavorAsset = assetPeer::retrieveOriginalByEntryId($entry->getId());
                     }
                 }
                 if (is_null($flavorAsset)) {
                     // if no READY ORIGINAL entry is available, try to retrieve a non-READY ORIGINAL entry
                     $flavorAsset = assetPeer::retrieveOriginalByEntryId($entry->getId());
                 }
                 if (is_null($flavorAsset)) {
                     KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
                 }
                 $flavorSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 $entry_data_path = kFileSyncUtils::getReadyLocalFilePathForKey($flavorSyncKey);
                 $entry_data_wams_asset_id = kFileSyncUtils::getWamsAssetIdForKey($flavorSyncKey);
                 if (!$entry_data_path) {
                     // since this is not really being processed on this server, and will probably cause redirect in thumbnailAction
                     // remove from cache so later requests will still get redirected and will not fail on PROCESSING_CAPTURE_THUMBNAIL
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:myEntryUtils.class.php


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