本文整理汇总了PHP中kFileSyncUtils::getReadyInternalFileSyncForKey方法的典型用法代码示例。如果您正苦于以下问题:PHP kFileSyncUtils::getReadyInternalFileSyncForKey方法的具体用法?PHP kFileSyncUtils::getReadyInternalFileSyncForKey怎么用?PHP kFileSyncUtils::getReadyInternalFileSyncForKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFileSyncUtils
的用法示例。
在下文中一共展示了kFileSyncUtils::getReadyInternalFileSyncForKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addParseCaptionAssetJob
/**
* @param CaptionAsset $captionAsset
* @param BatchJob $parentJob
* @throws kCoreException FILE_NOT_FOUND
* @return BatchJob
*/
public function addParseCaptionAssetJob(CaptionAsset $captionAsset, BatchJob $parentJob = null)
{
$syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if (!$fileSync) {
if (!PermissionPeer::isValidForPartner(CaptionPermissionName::IMPORT_REMOTE_CAPTION_FOR_INDEXING, $captionAsset->getPartnerId())) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$fullPath = myContentStorage::getFSUploadsPath() . '/' . $captionAsset->getId() . '.tmp';
if (!kFile::downloadUrlToFile($fileSync->getExternalUrl($captionAsset->getEntryId()), $fullPath)) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
kFileSyncUtils::moveFromFile($fullPath, $syncKey, true, false, true);
}
$jobData = new kParseCaptionAssetJobData();
$jobData->setCaptionAssetId($captionAsset->getId());
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild();
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($captionAsset->getEntryId());
$batchJob->setPartnerId($captionAsset->getPartnerId());
}
return kJobsManager::addJob($batchJob, $jobData, CaptionSearchPlugin::getBatchJobTypeCoreValue(CaptionSearchBatchJobType::PARSE_CAPTION_ASSET));
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:36,代码来源:kCaptionSearchFlowManager.php
示例2: doGetFlavorAssetUrl
protected function doGetFlavorAssetUrl(flavorAsset $flavorAsset)
{
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
$url = $this->getFileSyncUrl($fileSync);
$url = $this->formatByExtension($url, false);
return $url;
}
示例3: doGetFlavorAssetUrl
/**
* Returns the url for the given flavor. in case of rtmp, return the file path in order ot use a local streaming server
*
* @param flavorAsset $flavorAsset
* @return string
*/
protected function doGetFlavorAssetUrl(flavorAsset $flavorAsset)
{
if ($this->protocol != StorageProfile::PLAY_FORMAT_RTMP) {
return parent::doGetFlavorAssetUrl($flavorAsset);
}
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
$url = $this->doGetFileSyncUrl($fileSync);
if ($this->extention && strtolower($this->extention) != 'flv' || $this->containerFormat && strtolower($this->containerFormat) != 'flash video') {
$url = "mp4:{$url}";
}
$url = str_replace('\\', '/', $url);
return $url;
}
示例4: serveAsset
/**
* @param asset $asset
* @param string $fileName
* @param bool $forceProxy
* @param int $version
* @throws KalturaErrors::FILE_DOESNT_EXIST
*/
protected function serveAsset(asset $asset, $fileName, $forceProxy = false, $version = null)
{
$syncKey = $asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET, $version);
$fileSync = null;
$serveRemote = false;
$partner = PartnerPeer::retrieveByPK($asset->getPartnerId());
switch ($partner->getStorageServePriority()) {
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY:
$serveRemote = true;
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync || $fileSync->getStatus() != FileSync::FILE_SYNC_STATUS_READY) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_FIRST:
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if ($fileSync && $fileSync->getStatus() == FileSync::FILE_SYNC_STATUS_READY) {
$serveRemote = true;
}
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST:
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if ($fileSync) {
break;
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync || $fileSync->getStatus() != FileSync::FILE_SYNC_STATUS_READY) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
$serveRemote = true;
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY:
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if (!$fileSync) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
break;
}
if ($serveRemote && $fileSync) {
header("Location: " . $fileSync->getExternalUrl($asset->getEntryId()));
die;
}
return $this->serveFile($asset, asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET, $fileName, $asset->getEntryId(), $forceProxy);
}
示例5: getThumbnailUrl
public function getThumbnailUrl($version = null, $protocol = null)
{
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_DISABLE_KMC_DRILL_DOWN_THUMB_RESIZE, $this->getPartnerId())) {
$subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA;
if ($this->getType() == entryType::MEDIA_CLIP && $this->getMediaType() != entry::ENTRY_MEDIA_TYPE_IMAGE) {
$subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB;
}
$syncKey = $this->getSyncKey($subType);
$fileSync = null;
$serveRemote = false;
$partner = PartnerPeer::retrieveByPK($this->getPartnerId());
switch ($partner->getStorageServePriority()) {
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY:
$serveRemote = true;
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync) {
return null;
}
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_FIRST:
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if ($fileSync) {
$serveRemote = true;
}
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST:
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if ($fileSync) {
break;
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync) {
return null;
}
$serveRemote = true;
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY:
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if (!$fileSync) {
return null;
}
break;
}
if ($serveRemote && $fileSync) {
$url = $fileSync->getExternalUrl($this->getId());
if (!is_null($protocol)) {
$url = preg_replace('/^https?/', $protocol, $url);
}
return $url;
}
}
//$path = $this->getThumbnailPath ( $version );
$path = myPartnerUtils::getUrlForPartner($this->getPartnerId(), $this->getSubpId()) . "/thumbnail/entry_id/" . $this->getId();
$partner = $this->getPartner();
if ($partner && $this->getMediaType() == entry::ENTRY_MEDIA_TYPE_AUDIO && $partner->getAudioThumbEntryId() && $partner->getAudioThumbEntryVersion()) {
$thumbEntryId = $partner->getAudioThumbEntryId();
$thumbVersion = $partner->getAudioThumbEntryVersion();
$current_version = "{$thumbVersion}/thumb_entry_id/{$thumbEntryId}";
} elseif ($partner && in_array($this->getType(), array(entryType::LIVE_STREAM, entryType::LIVE_CHANNEL)) && $partner->getLiveThumbEntryId() && $partner->getLiveThumbEntryVersion()) {
$thumbEntryId = $partner->getLiveThumbEntryId();
$thumbVersion = $partner->getLiveThumbEntryVersion();
$current_version = "{$thumbVersion}/thumb_entry_id/{$thumbEntryId}";
} else {
$current_version = $this->getThumbnailVersion();
}
if ($version) {
$path .= "/version/{$version}";
} else {
$path .= "/version/{$current_version}";
}
$assetCacheVersion = $this->getAssetCacheVersion();
if ($assetCacheVersion != self::DEFAULT_ASSETCACHEVERSION) {
// If the version is not the default, include it as part of the URL in order
// to bypass existing image cache and produce a fresh thumbnail (which will
// persist until assetCacheVersion is modified again)
$path .= "/acv/{$assetCacheVersion}";
}
$url = myPartnerUtils::getThumbnailHost($this->getPartnerId(), $protocol) . $path;
return $url;
}
示例6: unset
}
if (kFileSyncUtils::getReadyExternalFileSyncForKey($key, $storageProfileId)) {
unset($keys[$index]);
}
if (!kFileSyncUtils::getReadyInternalFileSyncForKey($key)) {
echo 'file sync key does not have an internal file -' . serialize($key) . PHP_EOL;
unset($keys[$index]);
}
}
if (!count($keys)) {
echo $entry->getId() . " - has no keys to export\n";
continue;
}
foreach ($keys as $key) {
$fileSync = kFileSyncUtils::createPendingExternalSyncFileForKey($key, $storageProfile);
$dcFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);
/* @var $dcFileSync FileSync */
$srcFileSyncLocalPath = $dcFileSync->getFileRoot() . $dcFileSync->getFilePath();
kJobsManager::addStorageExportJob(null, $entry->getId(), $partnerId, $storageProfile, $fileSync, $srcFileSyncLocalPath, true, $dcFileSync->getDc());
}
echo $entry->getId() . " - " . count($keys) . " keys exported\n\n";
$totalExported++;
if ($maxEntriesToExport > 0 && $totalExported >= $maxEntriesToExport) {
echo 'Max entries limit of [' . $maxEntriesToExport . '] reached - stopping executin';
$moreEntries = false;
break;
}
usleep(100);
}
if (count($entries) < $curLimit) {
$moreEntries = false;
示例7: serveRtmp
private function serveRtmp()
{
switch ($this->entry->getType()) {
case entryType::MEDIA_CLIP:
$duration = $this->entry->getDurationInt();
$flavorAssets = array();
if ($this->flavorId) {
$flavorAsset = flavorAssetPeer::retrieveById($this->flavorId);
if (!$flavorAsset->hasTag(flavorParams::TAG_WEB)) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
if (!$flavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
$flavorAssets[] = $flavorAsset;
} else {
$flavorAssets = flavorAssetPeer::retreiveReadyByEntryIdAndTag($this->entryId, flavorParams::TAG_MBR);
if (!count($flavorAssets)) {
$flavorAssets = flavorAssetPeer::retreiveReadyByEntryIdAndTag($this->entryId, flavorParams::TAG_WEB);
}
}
$flavorAssets = $this->removeMaxBitrateFlavors($flavorAssets);
if (!$this->storageId) {
$partner = $this->entry->getPartner();
$finalFlavors = array();
if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
foreach ($flavorAssets as $flavorAsset) {
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);
if ($fileSync) {
$finalFlavors[] = $flavorAsset;
}
}
}
if (!count($finalFlavors) && $partner->getStorageServePriority() && $partner->getStorageServePriority() != StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
$storages = StorageProfilePeer::retrieveExternalByPartnerId($partner->getId());
if (count($storages) == 1) {
$this->storageId = $storages[0]->getId();
} elseif (count($storages)) {
$storagesFlavors = array();
foreach ($storages as $storage) {
$storagesFlavors[$storage->getId()] = array();
foreach ($flavorAssets as $flavorAsset) {
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key, $storage->getId());
if ($fileSync) {
$storagesFlavors[$storage->getId()][] = $flavorAsset;
}
}
}
$maxCount = 0;
foreach ($storagesFlavors as $storageId => $storageFlavors) {
$count = count($storageFlavors);
if ($count > $maxCount) {
$maxCount = $count;
$this->storageId = $storageId;
$finalFlavors = $storageFlavors;
}
}
$flavorAssets = $finalFlavors;
} else {
foreach ($flavorAssets as $flavorAsset) {
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);
if ($fileSync) {
$finalFlavors[] = $flavorAsset;
}
}
}
}
}
foreach ($flavorAssets as $flavorAsset) {
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($flavorAsset->getId());
if ($mediaInfo && ($mediaInfo->getVideoDuration() || $mediaInfo->getAudioDuration() || $mediaInfo->getContainerDuration())) {
$duration = $mediaInfo->getVideoDuration() ? $mediaInfo->getVideoDuration() : ($mediaInfo->getAudioDuration() ? $mediaInfo->getAudioDuration() : $mediaInfo->getContainerDuration());
$duration /= 1000;
break;
}
}
$baseUrl = null;
$flavors = array();
if ($this->storageId) {
$storage = StorageProfilePeer::retrieveByPK($this->storageId);
if (!$storage) {
die;
}
$baseUrl = $storage->getDeliveryRmpBaseUrl();
// get all flavors with external urls
foreach ($flavorAssets as $flavorAsset) {
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key, $this->storageId);
if (!$fileSync) {
continue;
}
$urlManager = kUrlManager::getUrlManagerByStorageProfile($fileSync->getDc());
$urlManager->setClipTo($this->clipTo);
$urlManager->setFileExtension($flavorAsset->getFileExt());
$urlManager->setProtocol(StorageProfile::PLAY_FORMAT_RTMP);
$url = $urlManager->getFileSyncUrl($fileSync);
$url = preg_replace('/^\\//', '', $url);
//.........这里部分代码省略.........
示例8: getExternalStorageUrl
private static function getExternalStorageUrl(Partner $partner, asset $asset, FileSyncKey $key, $servePlayManifest = false, $playManifestClientTag = null, $storageId = null)
{
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
return null;
}
if (is_null($storageId) && $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
if (kFileSyncUtils::getReadyInternalFileSyncForKey($key)) {
// check if having file sync on kaltura dcs
return null;
}
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key, $storageId);
if (!$fileSync) {
return null;
}
$storage = StorageProfilePeer::retrieveByPK($fileSync->getDc());
if (!$storage) {
return null;
}
if ($servePlayManifest) {
// in case of an https request, if a delivery profile which supports https doesn't exist use an http cdn api host
if (infraRequestUtils::getProtocol() == infraRequestUtils::PROTOCOL_HTTPS && DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($fileSync->getDc(), $asset->getEntryId(), PlaybackProtocol::HTTP, "https"))) {
$url = requestUtils::getApiCdnHost();
} else {
$url = infraRequestUtils::PROTOCOL_HTTP . "://" . kConf::get("cdn_api_host");
}
$url .= $asset->getPlayManifestUrl($playManifestClientTag, $storageId);
} else {
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($fileSync->getDc(), $asset->getEntryId()));
if ($urlManager) {
$dynamicAttrs = new DeliveryProfileDynamicAttributes();
$dynamicAttrs->setFileExtension($asset->getFileExt());
$dynamicAttrs->setStorageId($fileSync->getDc());
$urlManager->setDynamicAttributes($dynamicAttrs);
$url = ltrim($urlManager->getFileSyncUrl($fileSync), '/');
if (strpos($url, "://") === false) {
$url = rtrim($urlManager->getUrl(), "/") . "/" . $url;
}
} else {
KalturaLog::debug("Couldn't determine delivery profile for storage id");
$url = null;
}
}
return $url;
}
示例9: getDownloadUrl
public function getDownloadUrl($useCdn = false, $forceProxy = false, $preview = null, $fileName = null)
{
$syncKey = $this->getSyncKey(self::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$fileSync = null;
$serveRemote = false;
$partner = PartnerPeer::retrieveByPK($this->getPartnerId());
switch ($partner->getStorageServePriority()) {
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY:
$serveRemote = true;
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync || $fileSync->getStatus() != FileSync::FILE_SYNC_STATUS_READY) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_FIRST:
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if ($fileSync && $fileSync->getStatus() == FileSync::FILE_SYNC_STATUS_READY) {
$serveRemote = true;
break;
}
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY:
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if (!$fileSync) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST:
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if ($fileSync) {
break;
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync || $fileSync->getStatus() != FileSync::FILE_SYNC_STATUS_READY) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$serveRemote = true;
break;
}
if ($serveRemote && $fileSync) {
$downloadUrl = $fileSync->getExternalUrl($this->getEntryId());
} else {
$downloadUrl = $this->getDownloadUrlWithExpiry(86400, $useCdn, $forceProxy, $preview);
}
$downloadUrl = $this->finalizeDownloadUrl($fileSync, $downloadUrl, $fileName, $serveRemote);
return $downloadUrl;
}
示例10: initSmilManifest
protected function initSmilManifest($flavorAssets)
{
$key = $this->getFlavorKeyByTag($flavorAssets, assetParams::TAG_SMIL_MANIFEST, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (!$key) {
return false;
}
$localFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);
$remoteFileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key);
if ($this->shouldUseLocalFlavors($localFileSync, $remoteFileSync)) {
$this->deliveryAttributes->setStorageId(null);
$this->deliveryAttributes->setManifestFileSync($localFileSync);
} else {
if ($remoteFileSync) {
$this->deliveryAttributes->setStorageId($remoteFileSync->getDc());
}
$this->deliveryAttributes->setManifestFileSync($remoteFileSync);
}
return !is_null($this->deliveryAttributes->getManifestFileSync());
}
示例11: getExternalStorageUrl
private function getExternalStorageUrl(Partner $partner, flavorAsset $flavorAsset, FileSyncKey $key)
{
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
return null;
}
if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
if (kFileSyncUtils::getReadyInternalFileSyncForKey($key)) {
// check if having file sync on kaltura dcs
return null;
}
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key);
if (!$fileSync) {
return null;
}
$storage = StorageProfilePeer::retrieveByPK($fileSync->getDc());
if (!$storage) {
return null;
}
if ($this->syndicationFeedDb->getServePlayManifest()) {
$deliveryProfile = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($storage->getId(), $flavorAsset->getEntryId(), PlaybackProtocol::HTTP, "https"));
$clientTag = 'feed:' . $this->syndicationFeedDb->getId();
if (is_null($deliveryProfile)) {
$url = infraRequestUtils::PROTOCOL_HTTP . "://" . kConf::get("cdn_api_host");
} else {
$url = requestUtils::getApiCdnHost();
}
$url .= $flavorAsset->getPlayManifestUrl($clientTag, $storage->getId());
} else {
$dpda = new DeliveryProfileDynamicAttributes();
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($fileSync->getDc(), $flavorAsset->getEntryId()), null, $flavorAsset);
$url = ltrim($urlManager->getFileSyncUrl($fileSync), '/');
if (strpos($url, "://") === false) {
$url = rtrim($urlManager->getUrl(), "/") . "/" . $url;
}
}
return $url;
}
示例12: addIsmLink
private static function addIsmLink(entry $entry, SimpleXMLElement $mrss)
{
if (self::$addedIsmUrl) {
return;
}
self::$addedIsmUrl = true;
$syncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
$kalturaFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
$urlManager = DeliveryProfilePeer::getDeliveryProfile($entry->getId(), PlaybackProtocol::SILVER_LIGHT);
if (!$urlManager) {
return;
}
$urlManager->initDeliveryDynamicAttributes($kalturaFileSync);
$partner = $entry->getPartner();
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
if ($kalturaFileSync) {
$urlPrefix = $urlManager->getUrl();
$url = $urlManager->getFileSyncUrl($kalturaFileSync, false);
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
}
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
return null;
}
$externalFileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if ($externalFileSync) {
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($externalFileSync->getDc(), $entry->getId(), PlaybackProtocol::SILVER_LIGHT));
if (is_null($urlManager)) {
return;
}
$url = $urlManager->getFileSyncUrl($externalFileSync, false);
$urlPrefix = $urlManager->getUrl();
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
if ($partner->getStorageServePriority() != StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) {
if ($kalturaFileSync) {
$url = $urlManager->getFileSyncUrl($kalturaFileSync, false);
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
}
}
示例13: getExternalStorageUrl
private function getExternalStorageUrl(Partner $partner, flavorAsset $flavorAsset, FileSyncKey $key)
{
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
return null;
}
if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
if (kFileSyncUtils::getReadyInternalFileSyncForKey($key)) {
// check if having file sync on kaltura dcs
return null;
}
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key);
if (!$fileSync) {
return null;
}
$storage = StorageProfilePeer::retrieveByPK($fileSync->getDc());
if (!$storage) {
return null;
}
$urlManager = kUrlManager::getUrlManagerByStorageProfile($fileSync->getDc(), $flavorAsset->getEntryId());
$urlManager->setFileExtension($flavorAsset->getFileExt());
$url = $storage->getDeliveryHttpBaseUrl() . '/' . $urlManager->getFileSyncUrl($fileSync);
return $url;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:24,代码来源:KalturaSyndicationFeedRenderer.php
示例14: addIsmLink
private static function addIsmLink(entry $entry, SimpleXMLElement $mrss)
{
if (self::$addedIsmUrl) {
return;
}
self::$addedIsmUrl = true;
$syncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
$kalturaFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
$urlPrefix = myPartnerUtils::getIisHost($entry->getPartnerId(), StorageProfile::PLAY_FORMAT_HTTP);
$iisHost = parse_url($urlPrefix, PHP_URL_HOST);
$matches = null;
if (preg_match('/(https?:\\/\\/[^\\/]+)(.*)/', $urlPrefix, $matches)) {
$urlPrefix = $matches[1];
}
$urlPrefix = rtrim($urlPrefix, '/') . '/';
$urlManager = kUrlManager::getUrlManagerByCdn($iisHost, $entry->getId());
if ($kalturaFileSync) {
$urlManager->setFileExtension(pathinfo($kalturaFileSync->getFilePath(), PATHINFO_EXTENSION));
}
$urlManager->setProtocol(StorageProfile::PLAY_FORMAT_SILVER_LIGHT);
$partner = $entry->getPartner();
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
if ($kalturaFileSync) {
$url = $urlManager->getFileSyncUrl($kalturaFileSync, false);
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
}
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
return null;
}
$externalFileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if ($externalFileSync) {
$urlManager = kUrlManager::getUrlManagerByStorageProfile($externalFileSync->getDc(), $entry->getId());
$urlManager->setFileExtension(pathinfo($externalFileSync->getFilePath(), PATHINFO_EXTENSION));
$urlManager->setProtocol(StorageProfile::PLAY_FORMAT_SILVER_LIGHT);
$url = $urlManager->getFileSyncUrl($externalFileSync, false);
$url = ltrim($url, '/');
if (strpos($url, "://") !== false) {
$urlPrefix = '';
}
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
if ($partner->getStorageServePriority() != StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) {
if ($kalturaFileSync) {
$url = $urlManager->getFileSyncUrl($kalturaFileSync, false);
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
}
}
示例15: getThumbnailUrl
public function getThumbnailUrl($version = null, $protocol = null)
{
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_DISABLE_KMC_DRILL_DOWN_THUMB_RESIZE, $this->getPartnerId())) {
$subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA;
if ($this->getType() == entryType::MEDIA_CLIP && $this->getMediaType() != entry::ENTRY_MEDIA_TYPE_IMAGE) {
$subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB;
}
$syncKey = $this->getSyncKey($subType);
$fileSync = null;
$serveRemote = false;
$partner = PartnerPeer::retrieveByPK($this->getPartnerId());
switch ($partner->getStorageServePriority()) {
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY:
$serveRemote = true;
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync) {
return null;
}
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_FIRST:
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if ($fileSync) {
$serveRemote = true;
}
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST:
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if ($fileSync) {
break;
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync) {
return null;
}
$serveRemote = true;
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY:
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if (!$fileSync) {
return null;
}
break;
}
if ($serveRemote && $fileSync) {
$url = $fileSync->getExternalUrl($this->getId());
if (!is_null($protocol)) {
$url = preg_replace('/^https?/', $protocol, $url);
}
return $url;
}
}
//$path = $this->getThumbnailPath ( $version );
$path = myPartnerUtils::getUrlForPartner($this->getPartnerId(), $this->getSubpId()) . "/thumbnail/entry_id/" . $this->getId();
$current_version = $this->getThumbnailVersion();
if ($version) {
$path .= "/version/{$version}";
} else {
$path .= "/version/{$current_version}";
}
$url = myPartnerUtils::getThumbnailHost($this->getPartnerId(), $protocol) . $path;
return $url;
}