本文整理汇总了PHP中kDataCenterMgr::getRemoteDcExternalUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP kDataCenterMgr::getRemoteDcExternalUrl方法的具体用法?PHP kDataCenterMgr::getRemoteDcExternalUrl怎么用?PHP kDataCenterMgr::getRemoteDcExternalUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kDataCenterMgr
的用法示例。
在下文中一共展示了kDataCenterMgr::getRemoteDcExternalUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: generateAction
/**
* @action generate
* @param string $entryId
* @param KalturaThumbParams $thumbParams
* @param string $sourceAssetId id of the source asset (flavor or thumbnail) to be used as source for the thumbnail generation
* @return KalturaThumbAsset
*
* @throws KalturaErrors::ENTRY_ID_NOT_FOUND
* @throws KalturaErrors::ENTRY_TYPE_NOT_SUPPORTED
* @throws KalturaErrors::ENTRY_MEDIA_TYPE_NOT_SUPPORTED
* @throws KalturaErrors::THUMB_ASSET_PARAMS_ID_NOT_FOUND
* @throws KalturaErrors::INVALID_ENTRY_STATUS
* @throws KalturaErrors::THUMB_ASSET_IS_NOT_READY
* @validateUser entry entryId edit
*/
public function generateAction($entryId, KalturaThumbParams $thumbParams, $sourceAssetId = null)
{
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
if (!in_array($entry->getType(), $this->mediaTypes)) {
throw new KalturaAPIException(KalturaErrors::ENTRY_TYPE_NOT_SUPPORTED, $entry->getType());
}
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO) {
throw new KalturaAPIException(KalturaErrors::ENTRY_MEDIA_TYPE_NOT_SUPPORTED, $entry->getMediaType());
}
$validStatuses = array(entryStatus::ERROR_CONVERTING, entryStatus::PRECONVERT, entryStatus::READY);
if (!in_array($entry->getStatus(), $validStatuses)) {
throw new KalturaAPIException(KalturaErrors::INVALID_ENTRY_STATUS);
}
$destThumbParams = new thumbParams();
$thumbParams->toUpdatableObject($destThumbParams);
$srcAsset = kBusinessPreConvertDL::getSourceAssetForGenerateThumbnail($sourceAssetId, $destThumbParams->getSourceParamsId(), $entryId);
if (is_null($srcAsset)) {
throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_IS_NOT_READY);
}
$sourceFileSyncKey = $srcAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($sourceFileSyncKey, true);
/* @var $fileSync FileSync */
if (is_null($fileSync)) {
throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_IS_NOT_READY);
}
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
throw new KalturaAPIException(KalturaErrors::SOURCE_FILE_REMOTE);
}
if (!$local) {
kFile::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrl($fileSync));
}
$runSync = is_null($fileSync->getWamsAssetId());
$dbThumbAsset = kBusinessPreConvertDL::decideThumbGenerate($entry, $destThumbParams, null, $sourceAssetId, $runSync, $srcAsset);
if (!$dbThumbAsset) {
return null;
}
$thumbAsset = new KalturaThumbAsset();
$thumbAsset->fromObject($dbThumbAsset);
return $thumbAsset;
}
示例3: convertPptToSwf
/**
* This will queue a batch job for converting the document file to swf
* Returns the URL where the new swf will be available
*
* @action convertPptToSwf
* @param string $entryId
* @return string
*/
function convertPptToSwf($entryId)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::DOCUMENT) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$flavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (is_null($flavorAsset) || !$flavorAsset->isLocalReadyStatus()) {
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
}
$sync_key = null;
$sync_key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (!kFileSyncUtils::file_exists($sync_key)) {
// if not found local file - perhaps wasn't created here and wasn't synced yet
// try to see if remote exists - and proxy the request if it is.
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($sync_key, true, true);
if (!$local) {
$remoteDCHost = kDataCenterMgr::getRemoteDcExternalUrl($fileSync);
kFileUtils::dumpApiRequest($remoteDCHost);
}
KalturaLog::log("convertPptToSwf sync key doesn't exists");
return;
}
$flavorParams = myConversionProfileUtils::getFlavorParamsFromFileFormat($dbEntry->getPartnerId(), flavorParams::CONTAINER_FORMAT_SWF);
$flavorParamsId = $flavorParams->getId();
$puserId = $this->getKuser()->getPuserId();
$err = "";
kBusinessPreConvertDL::decideAddEntryFlavor(null, $dbEntry->getId(), $flavorParamsId, $err);
$downloadPath = $dbEntry->getDownloadUrl();
//TODO: once api_v3 will support parameters with '/' instead of '?', we can change this to war with api_v3
return $downloadPath . '/direct_serve/true/type/download/forceproxy/true/format/swf';
}
示例4: convertAction
/**
* Add and convert new Flavor Asset for Entry with specific Flavor Params
*
* @action convert
* @param string $entryId
* @param int $flavorParamsId
* @param int $priority
* @validateUser entry entryId edit
*/
public function convertAction($entryId, $flavorParamsId, $priority = 0)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$flavorParamsDb = assetParamsPeer::retrieveByPK($flavorParamsId);
assetParamsPeer::setUseCriteriaFilter(false);
if (!$flavorParamsDb) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND, $flavorParamsId);
}
$validStatuses = array(entryStatus::ERROR_CONVERTING, entryStatus::PRECONVERT, entryStatus::READY);
if (!in_array($dbEntry->getStatus(), $validStatuses)) {
throw new KalturaAPIException(KalturaErrors::INVALID_ENTRY_STATUS);
}
$conversionProfile = $dbEntry->getconversionProfile2();
if (!$conversionProfile) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $dbEntry->getConversionProfileId());
}
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (is_null($originalFlavorAsset) || !$originalFlavorAsset->isLocalReadyStatus()) {
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
}
$srcSyncKey = $originalFlavorAsset->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);
/* @var $fileSync FileSync */
if (!$fileSync) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
if (!$local && $fileSync->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_URL) {
kFileUtils::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrl($fileSync));
}
$err = "";
$dynamicFlavorAttributes = $dbEntry->getDynamicFlavorAttributesForAssetParams($flavorParamsDb->getId());
kBusinessPreConvertDL::decideAddEntryFlavor(null, $dbEntry->getId(), $flavorParamsId, $err, null, $dynamicFlavorAttributes, $priority);
}