本文整理汇总了PHP中assetPeer::retrieveReadyByEntryId方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveReadyByEntryId方法的具体用法?PHP assetPeer::retrieveReadyByEntryId怎么用?PHP assetPeer::retrieveReadyByEntryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveReadyByEntryId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: internalFulfilled
/**
* @param kScope $scope
* @return bool
*/
protected function internalFulfilled(kScope $scope)
{
// no properties defined, the condition is fulfilled
if (count($this->getProperties()) == 0) {
return true;
}
$entryId = $scope->getEntryId();
$entryAssets = assetPeer::retrieveReadyByEntryId($scope->getEntryId());
foreach ($entryAssets as $asset) {
$assetFulfilled = $this->assetFulfilled($asset);
if ($assetFulfilled) {
return true;
}
}
return false;
}
示例2: assignAssets
/**
* @param EntryDistribution $entryDistribution
* @param entry $entry
* @param DistributionProfile $distributionProfile
* @return boolean
*/
public static function assignAssets(EntryDistribution $entryDistribution, entry $entry, DistributionProfile $distributionProfile)
{
$submittingStatuses = array(EntryDistributionStatus::PENDING, EntryDistributionStatus::QUEUED, EntryDistributionStatus::SUBMITTING, EntryDistributionStatus::IMPORT_SUBMITTING, EntryDistributionStatus::ERROR_SUBMITTING);
// if not in first submmiting status then it's an update and need to check if update is supported.
if (!in_array($entryDistribution->getStatus(), $submittingStatuses)) {
$distributionProvider = $distributionProfile->getProvider();
if (!$distributionProvider) {
KalturaLog::log("Entry distribution [" . $entryDistribution->getId() . "] provider not found");
return false;
}
if (!$distributionProvider->isUpdateEnabled() || !$distributionProvider->isMediaUpdateEnabled()) {
KalturaLog::log("Entry distribution [" . $entryDistribution->getId() . "] provider [" . $distributionProvider->getName() . "] does not support update");
return false;
}
}
$requiredAssetsConditions = $distributionProfile->getRequiredAssetDistributionRules();
$optionalAssetsConditions = $distributionProfile->getOptionalAssetDistributionRules();
$assetDistributionRules = array_merge($requiredAssetsConditions, $optionalAssetsConditions);
if (!is_array($assetDistributionRules)) {
return false;
}
$assetIds = array();
$originalList = $entryDistribution->getAssetIds();
$entryAssets = assetPeer::retrieveReadyByEntryId($entryDistribution->getEntryId());
foreach ($assetDistributionRules as $assetDistributionRule) {
/* @var $assetDistributionRule kAssetDistributionRule */
foreach ($entryAssets as $asset) {
/* @var $asset asset */
if ($assetDistributionRule->fulfilled($asset)) {
$assetIds[] = $asset->getId();
}
}
}
$entryDistribution->setAssetIds($assetIds);
return $originalList != $entryDistribution->getAssetIds();
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:42,代码来源:kContentDistributionManager.php
示例3: initFlavorAssetArray
protected function initFlavorAssetArray()
{
if (!$this->shouldInitFlavorAssetsArray()) {
return;
}
$oneOnly = false;
if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::HTTP || $this->deliveryAttributes->getFormat() == "url" || $this->deliveryAttributes->getFormat() == "rtsp") {
$oneOnly = true;
}
// get initial flavor list by input
$flavorAssets = array();
if ($this->flavorIds) {
$flavorAssets = assetPeer::retrieveReadyByEntryId($this->entryId, $this->flavorIds);
$flavorAssets = $this->removeNotAllowedFlavors($flavorAssets);
$flavorAssets = $this->removeMaxBitrateFlavors($flavorAssets);
}
if (!$flavorAssets || !count($flavorAssets)) {
$flavorAssets = assetPeer::retrieveReadyFlavorsByEntryId($this->entryId);
$flavorAssets = $this->deliveryAttributes->filterFlavorsByTags($flavorAssets);
$flavorAssets = $this->removeNotAllowedFlavors($flavorAssets);
$flavorAssets = $this->removeMaxBitrateFlavors($flavorAssets);
}
if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::SILVER_LIGHT) {
$this->initSilverLightManifest($flavorAssets);
return;
}
if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::HDS || $this->deliveryAttributes->getFormat() == PlaybackProtocol::APPLE_HTTP) {
// try to look for a smil manifest, if it was found, we will use it for hds and hls
if ($this->initSmilManifest($flavorAssets)) {
return;
}
}
// get flavors availability
$servePriority = $this->entry->getPartner()->getStorageServePriority();
$localFlavors = array();
$remoteFlavorsByDc = array();
$remoteFileSyncs = array();
foreach ($flavorAssets as $flavorAsset) {
$flavorId = $flavorAsset->getId();
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$c = new Criteria();
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->addAnd(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
switch ($servePriority) {
case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY:
$c->addAnd(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL, Criteria::NOT_EQUAL);
break;
case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY:
$c->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
break;
}
if ($this->deliveryAttributes->getStorageId()) {
$c->addAnd(FileSyncPeer::DC, $this->deliveryAttributes->getStorageId());
}
$fileSyncs = FileSyncPeer::doSelect($c);
foreach ($fileSyncs as $fileSync) {
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
$dc = $fileSync->getDc();
$remoteFlavorsByDc[$dc][$flavorId] = $flavorAsset;
$remoteFileSyncs[$dc][$flavorId] = $fileSync;
} else {
$localFlavors[$flavorId] = $flavorAsset;
}
}
}
// filter out any invalid / disabled storage profiles
if ($remoteFileSyncs) {
$storageProfileIds = array_keys($remoteFileSyncs);
$storageProfiles = StorageProfilePeer::retrieveExternalByPartnerId($this->entry->getPartnerId(), $storageProfileIds);
$activeStorageProfileIds = array();
foreach ($storageProfiles as $storageProfile) {
$activeStorageProfileIds[] = $storageProfile->getId();
}
foreach ($storageProfileIds as $storageProfileId) {
if (in_array($storageProfileId, $activeStorageProfileIds)) {
continue;
}
unset($remoteFlavorsByDc[$storageProfileId]);
unset($remoteFileSyncs[$storageProfileId]);
}
}
// choose the storage profile with the highest number of flavors
$maxDc = null;
$maxDcFlavorCount = 0;
$remoteFlavors = array();
foreach ($remoteFlavorsByDc as $dc => $curDcFlavors) {
$curDcFlavorCount = count($curDcFlavors);
if ($curDcFlavorCount <= $maxDcFlavorCount) {
continue;
}
$maxDc = $dc;
$maxDcFlavorCount = $curDcFlavorCount;
$remoteFlavors = $curDcFlavors;
}
// choose the flavor set according to the serve priority
if ($this->shouldUseLocalFlavors($localFlavors, $remoteFlavors)) {
$this->deliveryAttributes->setStorageId(null);
$this->deliveryAttributes->setFlavorAssets($localFlavors);
} else {
if ($maxDc) {
//.........这里部分代码省略.........
示例4: validateForSubmission
/**
* @param EntryDistribution $entryDistribution
* @param int $action enum from DistributionAction
* @return array<kDistributionValidationError>
*/
public function validateForSubmission(EntryDistribution $entryDistribution, $action)
{
$validationErrors = array();
$distributionProvider = $this->getProvider();
if (!$distributionProvider) {
KalturaLog::err("Entry distribution [" . $entryDistribution->getId() . "] provider [" . $this->getProviderType() . "] not found");
return $validationErrors;
}
if ($action == DistributionAction::UPDATE || $entryDistribution->getStatus() == EntryDistributionStatus::READY || $entryDistribution->getStatus() == EntryDistributionStatus::ERROR_UPDATING) {
if (!$distributionProvider->isUpdateEnabled() || !$distributionProvider->isMediaUpdateEnabled()) {
KalturaLog::log("Entry distribution [" . $entryDistribution->getId() . "] provider [" . $distributionProvider->getName() . "] does not support update");
return $validationErrors;
}
}
$requiredFlavorParamsIds = $this->getRequiredFlavorParamsIdsArray();
KalturaLog::log("Required Flavor Params Ids [" . print_r($requiredFlavorParamsIds, true) . "]");
$entryFlavorAssets = assetPeer::retrieveReadyFlavorsByEntryId($entryDistribution->getEntryId());
$requiredFlavorParamsIdsKeys = array_flip($requiredFlavorParamsIds);
foreach ($entryFlavorAssets as $entryFlavorAsset) {
$flavorParamsId = $entryFlavorAsset->getFlavorParamsId();
if (isset($requiredFlavorParamsIdsKeys[$flavorParamsId])) {
unset($requiredFlavorParamsIds[$requiredFlavorParamsIdsKeys[$flavorParamsId]]);
}
}
foreach ($requiredFlavorParamsIds as $requiredFlavorParamsId) {
$validationErrors[] = $this->createValidationError($action, DistributionErrorType::MISSING_FLAVOR, $requiredFlavorParamsId);
}
$requiredThumbDimensions = $this->getRequiredThumbDimensionsObjects();
KalturaLog::log("Required Thumb Dimensions [" . print_r($requiredThumbDimensions, true) . "]");
$entryThumbAssets = assetPeer::retrieveReadyThumbnailsByEntryId($entryDistribution->getEntryId());
$requiredThumbDimensionsWithKeys = array();
foreach ($requiredThumbDimensions as $requiredThumbDimension) {
$key = $requiredThumbDimension->getKey();
$requiredThumbDimensionsWithKeys[$key] = $requiredThumbDimension;
}
foreach ($entryThumbAssets as $entryThumbAsset) {
$key = $entryThumbAsset->getWidth() . 'x' . $entryThumbAsset->getHeight();
if (isset($requiredThumbDimensionsWithKeys[$key])) {
unset($requiredThumbDimensionsWithKeys[$key]);
}
}
foreach ($requiredThumbDimensionsWithKeys as $key => $requiredThumbDimension) {
$validationErrors[] = $this->createValidationError($action, DistributionErrorType::MISSING_THUMBNAIL, $key);
}
$entryAssets = assetPeer::retrieveReadyByEntryId($entryDistribution->getEntryId());
$requiredAssetDistributionRules = $this->getRequiredAssetDistributionRules();
foreach ($requiredAssetDistributionRules as $entryAssetDistributionRule) {
$foundMatchingAsset = false;
/* @var $entryAssetDistributionRule kAssetDistributionRule */
foreach ($entryAssets as $entryAsset) {
/* @var $entryAsset asset */
if ($entryAssetDistributionRule->fulfilled($entryAsset)) {
$foundMatchingAsset = true;
break;
}
}
if (!$foundMatchingAsset) {
$validationErrors[] = $this->createValidationError($action, DistributionErrorType::MISSING_ASSET, $entryAssetDistributionRule->getValidationError());
}
}
return $validationErrors;
}
示例5: conditionalAssetLocalFileSyncsDelete
private static function conditionalAssetLocalFileSyncsDelete(FileSync $fileSync, asset $asset)
{
$unClosedStatuses = array(asset::ASSET_STATUS_QUEUED, asset::ASSET_STATUS_CONVERTING, asset::ASSET_STATUS_WAIT_FOR_CONVERT, asset::ASSET_STATUS_EXPORTING);
$unClosedAssets = assetPeer::retrieveReadyByEntryId($asset->getEntryId(), null, $unClosedStatuses);
if (count($unClosedAssets)) {
$asset->setFileSyncVersionsToDelete(array($fileSync->getVersion()));
$asset->save();
return;
}
$assetsToDelete = assetPeer::retrieveReadyByEntryId($asset->getEntryId());
self::deleteAssetLocalFileSyncsByAssetArray($assetsToDelete);
self::deleteAssetLocalFileSyncs($fileSync->getVersion(), $asset);
}
示例6: getEntryMrssXml
//.........这里部分代码省略.........
kEntitlementUtils::initEntitlementEnforcement($partner->getId(), false);
$categories = array();
$categoryEntries = categoryEntryPeer::retrieveActiveByEntryId($entry->getId());
$categoryIds = array();
foreach ($categoryEntries as $categoryEntry) {
$categoryIds[] = $categoryEntry->getCategoryId();
}
$entryCats = categoryPeer::retrieveByPKs($categoryIds);
foreach ($entryCats as $entryCat) {
$categories[] = $entryCat->getFullName();
}
if ($partnerEntitlement) {
kEntitlementUtils::initEntitlementEnforcement($partner->getId(), true);
}
$keyToDelete = array_search(ObjectFeatureType::CATEGORY_ENTRIES, $features);
unset($features[$keyToDelete]);
}
foreach ($categories as $category) {
$category = trim($category);
if ($category) {
$categoryNode = $mrss->addChild('category', self::stringToSafeXml($category));
if (strrpos($category, '>') > 0) {
$categoryNode->addAttribute('name', self::stringToSafeXml(substr($category, strrpos($category, '>') + 1)));
} else {
$categoryNode->addAttribute('name', self::stringToSafeXml($category));
}
}
}
$mrss->addChild('partnerData', self::stringToSafeXml($entry->getPartnerData()));
if ($entry->getAccessControlId()) {
$mrss->addChild('accessControlId', $entry->getAccessControlId());
}
if ($entry->getConversionProfileId()) {
$mrss->addChild('conversionProfileId', $entry->getConversionProfileId());
}
if ($entry->getStartDate(null)) {
$mrss->addChild('startDate', $entry->getStartDate(null));
}
if ($entry->getEndDate(null)) {
$mrss->addChild('endDate', $entry->getEndDate(null));
}
switch ($entry->getType()) {
case entryType::MEDIA_CLIP:
self::appendMediaEntryMrss($entry, $mrss);
break;
case entryType::MIX:
self::appendMixEntryMrss($entry, $mrss);
break;
case entryType::PLAYLIST:
self::appendPlaylistEntryMrss($entry, $mrss);
break;
case entryType::DATA:
self::appendDataEntryMrss($entry, $mrss);
break;
case entryType::LIVE_STREAM:
self::appendLiveStreamEntryMrss($entry, $mrss);
break;
default:
break;
}
$assetsStatuses = array(asset::ASSET_STATUS_READY);
if ($mrssParams && $mrssParams->getStatuses()) {
$assetsStatuses = $mrssParams->getStatuses();
}
$assets = assetPeer::retrieveReadyByEntryId($entry->getId(), null, $assetsStatuses);
foreach ($assets as $asset) {
if ($mrssParams && !is_null($mrssParams->getFilterByFlavorParams()) && $asset->getFlavorParamsId() != $mrssParams->getFilterByFlavorParams()) {
continue;
}
if ($asset instanceof flavorAsset) {
self::appendFlavorAssetMrss($asset, $mrss, $mrssParams);
}
if ($asset instanceof thumbAsset) {
self::appendThumbAssetMrss($asset, $mrss);
}
}
$mrssContributors = self::getMrssContributors();
if (count($mrssContributors)) {
foreach ($mrssContributors as $mrssContributor) {
try {
if (!count($features) || in_array($mrssContributor->getObjectFeatureType(), $features)) {
$mrssContributor->contribute($entry, $mrss, $mrssParams);
}
} catch (kCoreException $ex) {
KalturaLog::err("Unable to add MRSS element for contributor [" . get_class($mrssContributor) . "] message [" . $ex->getMessage() . "]");
}
}
}
if ($mrssParams && $mrssParams->getIncludePlayerTag()) {
$uiconfId = !is_null($mrssParams->getPlayerUiconfId()) ? '/ui_conf_id/' . $mrssParams->getPlayerUiconfId() : '';
$playerUrl = kConf::get('apphome_url') . '/kwidget/wid/_' . $entry->getPartnerId() . '/entry_id/' . $entry->getId() . '/ui_conf' . ($uiconfId ? "/{$uiconfId}" : '');
$player = $mrss->addChild('player');
$player->addAttribute('url', $playerUrl);
}
if ($mrssParams && $mrssParams->getItemXpathsToExtend()) {
self::addExtendingItemsToMrss($mrss, $mrssParams);
}
self::addInstanceToPool($instanceKey, $mrss);
return $mrss;
}
示例7: getEntryMrssXml
/**
* @param entry $entry
* @param SimpleXMLElement $mrss
* @param kMrssParameters $mrssParams
* @return SimpleXMLElement
*/
public static function getEntryMrssXml(entry $entry, SimpleXMLElement $mrss = null, kMrssParameters $mrssParams = null)
{
if ($mrss === null) {
$mrss = new SimpleXMLElement('<item/>');
}
$mrss->addChild('entryId', $entry->getId());
if ($entry->getReferenceID()) {
$mrss->addChild('referenceID', $entry->getReferenceID());
}
$mrss->addChild('createdAt', $entry->getCreatedAt(null));
$mrss->addChild('updatedAt', $entry->getUpdatedAt(null));
$mrss->addChild('title', self::stringToSafeXml($entry->getName()));
if ($mrssParams && !is_null($mrssParams->getLink())) {
$mrss->addChild('link', $mrssParams->getLink() . $entry->getId());
}
$mrss->addChild('type', $entry->getType());
$mrss->addChild('licenseType', $entry->getLicenseType());
$mrss->addChild('userId', $entry->getPuserId(true));
$mrss->addChild('name', self::stringToSafeXml($entry->getName()));
$mrss->addChild('status', self::stringToSafeXml($entry->getStatus()));
$mrss->addChild('description', self::stringToSafeXml($entry->getDescription()));
$thumbnailUrl = $mrss->addChild('thumbnailUrl');
$thumbnailUrl->addAttribute('url', $entry->getThumbnailUrl());
if (trim($entry->getTags(), " \r\n\t")) {
$tags = $mrss->addChild('tags');
foreach (explode(',', $entry->getTags()) as $tag) {
$tags->addChild('tag', self::stringToSafeXml($tag));
}
}
$categories = explode(',', $entry->getCategories());
foreach ($categories as $category) {
$category = trim($category);
if ($category) {
$categoryNode = $mrss->addChild('category', self::stringToSafeXml($category));
if (strrpos($category, '>') > 0) {
$categoryNode->addAttribute('name', self::stringToSafeXml(substr($category, strrpos($category, '>') + 1)));
} else {
$categoryNode->addAttribute('name', self::stringToSafeXml($category));
}
}
}
$mrss->addChild('partnerData', self::stringToSafeXml($entry->getPartnerData()));
if ($entry->getAccessControlId()) {
$mrss->addChild('accessControlId', $entry->getAccessControlId());
}
if ($entry->getConversionProfileId()) {
$mrss->addChild('conversionProfileId', $entry->getConversionProfileId());
}
if ($entry->getStartDate(null)) {
$mrss->addChild('startDate', $entry->getStartDate(null));
}
if ($entry->getEndDate(null)) {
$mrss->addChild('endDate', $entry->getEndDate(null));
}
switch ($entry->getType()) {
case entryType::MEDIA_CLIP:
self::appendMediaEntryMrss($entry, $mrss);
break;
case entryType::MIX:
self::appendMixEntryMrss($entry, $mrss);
break;
case entryType::PLAYLIST:
self::appendPlaylistEntryMrss($entry, $mrss);
break;
case entryType::DATA:
self::appendDataEntryMrss($entry, $mrss);
break;
case entryType::LIVE_STREAM:
self::appendLiveStreamEntryMrss($entry, $mrss);
break;
default:
break;
}
$assets = assetPeer::retrieveReadyByEntryId($entry->getId());
foreach ($assets as $asset) {
if ($mrssParams && !is_null($mrssParams->getFilterByFlavorParams()) && $asset->getFlavorParamsId() != $mrssParams->getFilterByFlavorParams()) {
continue;
}
if ($asset instanceof flavorAsset) {
self::appendFlavorAssetMrss($asset, $mrss, $mrssParams);
}
if ($asset instanceof thumbAsset) {
self::appendThumbAssetMrss($asset, $mrss);
}
}
$mrssContributors = self::getMrssContributors();
if (count($mrssContributors)) {
foreach ($mrssContributors as $mrssContributor) {
$mrssContributor->contribute($entry, $mrss, $mrssParams);
}
}
if ($mrssParams && $mrssParams->getIncludePlayerTag()) {
$uiconfId = !is_null($mrssParams->getPlayerUiconfId()) ? '/ui_conf_id/' . $mrssParams->getPlayerUiconfId() : '';
$playerUrl = 'http://' . kConf::get('www_host') . '/kwidget/wid/_' . $entry->getPartnerId() . '/entry_id/' . $entry->getId() . '/ui_conf' . ($uiconfId ? "/{$uiconfId}" : '');
//.........这里部分代码省略.........