本文整理汇总了PHP中assetPeer::retrieveByIds方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveByIds方法的具体用法?PHP assetPeer::retrieveByIds怎么用?PHP assetPeer::retrieveByIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveByIds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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
示例2: validateForSubmission
public function validateForSubmission(EntryDistribution $entryDistribution, $action)
{
$validationErrors = parent::validateForSubmission($entryDistribution, $action);
$inListOrNullFields = array(FacebookDistributionField::CALL_TO_ACTION_TYPE_VALID_VALUES => explode(',', self::CALL_TO_ACTION_TYPE_VALID_VALUES));
if (count($entryDistribution->getFlavorAssetIds())) {
$flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
} else {
$flavorAssets = assetPeer::retrieveReadyFlavorsByEntryId($entryDistribution->getEntryId());
}
$validVideo = false;
foreach ($flavorAssets as $flavorAsset) {
$validVideo = $this->validateVideo($flavorAsset);
if ($validVideo) {
// even one valid video is enough
break;
}
}
if (!$validVideo) {
KalturaLog::err("No valid video found for entry [" . $entryDistribution->getEntryId() . "]");
$validationErrors[] = $this->createCustomValidationError($action, DistributionErrorType::INVALID_DATA, 'flavorAsset', ' No valid flavor found');
}
$allFieldValues = $this->getAllFieldValues($entryDistribution);
if (!$allFieldValues || !is_array($allFieldValues)) {
KalturaLog::err('Error getting field values from entry distribution id [' . $entryDistribution->getId() . '] profile id [' . $this->getId() . ']');
return $validationErrors;
}
if ($allFieldValues[FacebookDistributionField::SCHEDULE_PUBLISHING_TIME] && $allFieldValues[FacebookDistributionField::SCHEDULE_PUBLISHING_TIME] > time() && !dateUtils::isWithinTimeFrame($allFieldValues[FacebookDistributionField::SCHEDULE_PUBLISHING_TIME], FacebookConstants::FACEBOOK_MIN_POSTPONE_POST_IN_SECONDS, FacebookConstants::FACEBOOK_MAX_POSTPONE_POST_IN_SECONDS)) {
KalturaLog::err("Scheduled time to publish defies the facebook restriction of six minute to six months from now got" . $allFieldValues[FacebookDistributionField::SCHEDULE_PUBLISHING_TIME]);
$validationErrors[] = $this->createCustomValidationError($action, DistributionErrorType::INVALID_DATA, 'sunrise', 'Distribution sunrise is invalid (should be 6 minutes to 6 months from now)');
}
$validationErrors = array_merge($validationErrors, $this->validateInListOrNull($inListOrNullFields, $allFieldValues, $action));
return $validationErrors;
}
示例3: validateForSubmission
public function validateForSubmission(EntryDistribution $entryDistribution, $action)
{
$validationErrors = parent::validateForSubmission($entryDistribution, $action);
//validation of flavor format
$flavorAsset = null;
$flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
// if we have specific flavor assets for this distribution, grab the first one
if (count($flavorAssets)) {
$flavorAsset = reset($flavorAssets);
$fileExt = $flavorAsset->getFileExt();
$allowedExts = explode(',', self::FLAVOR_VALID_FORMATS);
if (!in_array($fileExt, $allowedExts)) {
KalturaLog::debug('flavor asset id [' . $flavorAsset->getId() . '] does not have a valid extension [' . $fileExt . ']');
$errorMsg = 'Flavor format must be one of [' . self::FLAVOR_VALID_FORMATS . ']';
$validationError = $this->createValidationError($action, DistributionErrorType::INVALID_DATA);
$validationError->setValidationErrorType(DistributionValidationErrorType::CUSTOM_ERROR);
$validationError->setValidationErrorParam($errorMsg);
$validationError->setDescription($errorMsg);
$validationErrors[] = $validationError;
}
}
$inListOrNullFields = array(IdeticDistributionField::GENRE => explode(',', self::GENRE_VALID_VALUES));
$allFieldValues = $this->getAllFieldValues($entryDistribution);
if (!$allFieldValues || !is_array($allFieldValues)) {
KalturaLog::err('Error getting field values from entry distribution id [' . $entryDistribution->getId() . '] profile id [' . $this->getId() . ']');
return $validationErrors;
}
$validationErrors = array_merge($validationErrors, $this->validateInListOrNull($inListOrNullFields, $allFieldValues, $action));
//validating Slot is a whole number
$validationErrors = array_merge($validationErrors, $this->validateIsWholeNumber(IdeticDistributionField::SLOT, $allFieldValues, $action));
return $validationErrors;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:32,代码来源:IdeticDistributionProfile.php
示例4: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaQuickPlayDistributionProfile) {
return;
}
$this->videoFilePaths = new KalturaStringArray();
$this->thumbnailFilePaths = new KalturaStringArray();
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
$entry = entryPeer::retrieveByPK($distributionJobData->entryDistribution->entryId);
foreach ($flavorAssets as $asset) {
$syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$str = new KalturaString();
$str->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->videoFilePaths[] = $str;
}
}
foreach ($thumbAssets as $asset) {
$syncKey = $asset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$str = new KalturaString();
$str->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->thumbnailFilePaths[] = $str;
}
}
$feed = new QuickPlayFeed($distributionJobData, $this, $flavorAssets, $thumbAssets, $entry);
$this->xml = $feed->getXml();
}
示例5: createPlayManifestURLs
private function createPlayManifestURLs(KalturaEntryDistribution $entryDistribution, entry $entry, TvinciDistributionFeedHelper $feedHelper)
{
$distributionFlavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->flavorAssetIds));
$videoAssetDataMap = $this->getVideoAssetDataMap();
foreach ($videoAssetDataMap as $videoAssetData) {
$tvinciAssetName = $videoAssetData[0];
$playbackProtocol = $videoAssetData[1];
$tags = $videoAssetData[2];
$fileExt = $videoAssetData[3];
$keys = array();
$relevantTags = array();
foreach ($distributionFlavorAssets as $distributionFlavorAsset) {
foreach ($tags as $tag) {
if ($distributionFlavorAsset->isLocalReadyStatus() && $distributionFlavorAsset->hasTag($tag)) {
$key = $this->createFileCoGuid($entry->getEntryId(), $distributionFlavorAsset->getFlavorParamsId());
if (!in_array($key, $keys)) {
$keys[] = $key;
}
if (!in_array($tag, $relevantTags)) {
$relevantTags[] = $tag;
}
}
}
}
if ($keys) {
$fileCoGuid = implode(",", $keys);
$tagFlag = implode(",", $relevantTags);
$url = $this->getPlayManifestUrl($entry, $playbackProtocol, $tagFlag, $fileExt);
$feedHelper->setVideoAssetData($tvinciAssetName, $url, $fileCoGuid);
}
}
}
示例6: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaFreewheelGenericDistributionProfile) {
return;
}
$this->videoAssetFilePaths = new KalturaStringArray();
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
foreach ($flavorAssets as $flavorAsset) {
$videoAssetFilePath = new KalturaString();
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$videoAssetFilePath->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->videoAssetFilePaths[] = $videoAssetFilePath;
}
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$thumbAsset = reset($thumbAssets);
$syncKey = $thumbAssets->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
// entry cue points
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->add(CuePointPeer::PARTNER_ID, $distributionJobData->entryDistribution->partnerId);
$c->add(CuePointPeer::ENTRY_ID, $distributionJobData->entryDistribution->entryId);
$c->add(CuePointPeer::TYPE, AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD));
$c->addAscendingOrderByColumn(CuePointPeer::START_TIME);
$cuePointsDb = CuePointPeer::doSelect($c);
$this->cuePoints = KalturaCuePointArray::fromDbArray($cuePointsDb);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:38,代码来源:KalturaFreewheelGenericDistributionJobProviderData.php
示例7: __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');
}
}
示例8: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaMsnDistributionProfile) {
return;
}
$flavorAssetsByMsnId = array();
$entryId = $distributionJobData->entryDistribution->entryId;
$distributionProfile = $distributionJobData->distributionProfile;
/* @var $distributionProfile KalturaMsnDistributionProfile */
$this->addFlavorByMsnId($flavorAssetsByMsnId, 1001, $entryId, $distributionProfile->sourceFlavorParamsId);
$this->addFlavorByMsnId($flavorAssetsByMsnId, 1002, $entryId, $distributionProfile->wmvFlavorParamsId);
$this->addFlavorByMsnId($flavorAssetsByMsnId, 1003, $entryId, $distributionProfile->flvFlavorParamsId);
$this->addFlavorByMsnId($flavorAssetsByMsnId, 1004, $entryId, $distributionProfile->slFlavorParamsId);
$this->addFlavorByMsnId($flavorAssetsByMsnId, 1005, $entryId, $distributionProfile->slHdFlavorParamsId);
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
$feed = new MsnDistributionFeed($distributionJobData, $this);
$feed->addFlavorAssetsByMsnId($flavorAssetsByMsnId);
$feed->addThumbnailAssets($thumbAssets);
if ($distributionJobData instanceof KalturaDistributionSubmitJobData) {
$this->xml = $feed->getXml();
}
if ($distributionJobData instanceof KalturaDistributionUpdateJobData) {
$feed->setUUID($distributionJobData->remoteId);
$this->xml = $feed->getXml();
}
}
示例9: handleEntry
protected function handleEntry($context, $feed, entry $entry, Entrydistribution $entryDistribution)
{
$fields = $this->profile->getAllFieldValues($entryDistribution);
$flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
$thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds()));
return $feed->getItemXml($fields, count($flavorAssets) ? $flavorAssets[0] : null, count($thumbAssets) ? $thumbAssets[0] : null);
}
示例10: __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
示例11: getFeedAction
/**
* @action getFeed
* @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
* @param int $distributionProfileId
* @param string $hash
* @return file
*/
public function getFeedAction($distributionProfileId, $hash)
{
if (!$this->getPartnerId() || !$this->getPartner()) {
throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId());
}
$profile = DistributionProfilePeer::retrieveByPK($distributionProfileId);
if (!$profile || !$profile instanceof UverseDistributionProfile) {
throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId);
}
if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) {
throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId);
}
if ($profile->getUniqueHashForFeedUrl() != $hash) {
throw new KalturaAPIException(UverseDistributionErrors::INVALID_FEED_URL);
}
// "Creates advanced filter on distribution profile
$distributionAdvancedSearch = new ContentDistributionSearchFilter();
$distributionAdvancedSearch->setDistributionProfileId($profile->getId());
$distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
$distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
$distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false);
//Creates entry filter with advanced filter
$entryFilter = new entryFilter();
$entryFilter->setStatusEquel(entryStatus::READY);
$entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED);
$entryFilter->setPartnerSearchScope($this->getPartnerId());
$entryFilter->setAdvancedSearch($distributionAdvancedSearch);
$baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
$baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
$entryFilter->attachToCriteria($baseCriteria);
$entries = entryPeer::doSelect($baseCriteria);
$feed = new UverseFeed('uverse_template.xml');
$feed->setDistributionProfile($profile);
$feed->setChannelFields();
$lastBuildDate = $profile->getUpdatedAt(null);
foreach ($entries as $entry) {
/* @var $entry entry */
$entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId());
if (!$entryDistribution) {
KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']');
continue;
}
$fields = $profile->getAllFieldValues($entryDistribution);
$flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
$flavorAsset = reset($flavorAssets);
$flavorAssetRemoteUrl = $entryDistribution->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_URL);
$thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds()));
$feed->addItem($fields, $flavorAsset, $flavorAssetRemoteUrl, $thumbAssets);
// we want to find the newest update time between all entries
if ($entry->getUpdatedAt(null) > $lastBuildDate) {
$lastBuildDate = $entry->getUpdatedAt(null);
}
}
$feed->setChannelLastBuildDate($lastBuildDate);
header('Content-Type: text/xml');
echo $feed->getXml();
die;
}
示例12: getFeedAction
/**
* @action getFeed
* @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
* @param int $distributionProfileId
* @param string $hash
* @return file
*/
public function getFeedAction($distributionProfileId, $hash)
{
if (!$this->getPartnerId() || !$this->getPartner()) {
throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId());
}
$profile = DistributionProfilePeer::retrieveByPK($distributionProfileId);
if (!$profile || !$profile instanceof SynacorHboDistributionProfile) {
throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId);
}
if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) {
throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId);
}
if ($profile->getUniqueHashForFeedUrl() != $hash) {
throw new KalturaAPIException(SynacorHboDistributionErrors::INVALID_FEED_URL);
}
// "Creates advanced filter on distribution profile
$distributionAdvancedSearch = new ContentDistributionSearchFilter();
$distributionAdvancedSearch->setDistributionProfileId($profile->getId());
$distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
$distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
$distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE);
$distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false);
//Creates entry filter with advanced filter
$entryFilter = new entryFilter();
$entryFilter->setStatusEquel(entryStatus::READY);
$entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED);
$entryFilter->setPartnerSearchScope($this->getPartnerId());
$entryFilter->setAdvancedSearch($distributionAdvancedSearch);
$baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
$baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
$entryFilter->attachToCriteria($baseCriteria);
$entries = entryPeer::doSelect($baseCriteria);
$feed = new SynacorHboFeed('synacor_hbo_feed_template.xml');
$feed->setDistributionProfile($profile);
$counter = 0;
foreach ($entries as $entry) {
/* @var $entry entry */
$entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId());
if (!$entryDistribution) {
KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']');
continue;
}
$fields = $profile->getAllFieldValues($entryDistribution);
$flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
$thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds()));
$additionalAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getAssetIds()));
$feed->addItem($fields, $entry, $flavorAssets, $thumbAssets, $additionalAssets);
$counter++;
//to avoid the cache exceeding the memory size
if ($counter >= 100) {
kMemoryManager::clearMemory();
$counter = 0;
}
}
header('Content-Type: text/xml');
echo $feed->getXml();
die;
}
示例13: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaHuluDistributionProfile) {
return;
}
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$flavorAsset = reset($flavorAssets);
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$thumbAsset = reset($thumbAssets);
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$additionalAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->assetIds));
$this->captionLocalPaths = new KalturaStringArray();
if (count($additionalAssets)) {
$captionAssetFilePathArray = array();
foreach ($additionalAssets as $additionalAsset) {
$assetType = $additionalAsset->getType();
$syncKey = $additionalAsset->getSyncKey(CaptionAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
if ($assetType == CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION) || $assetType == AttachmentPlugin::getAssetTypeCoreValue(AttachmentAssetType::ATTACHMENT)) {
$string = new KalturaString();
$string->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->captionLocalPaths[] = $string;
}
}
}
}
$tempFieldValues = unserialize($this->fieldValues);
$pattern = '/[^A-Za-z0-9_\\-]/';
$seriesTitle = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::SERIES_TITLE]);
$seasonNumber = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::SEASON_NUMBER]);
$videoEpisodeNumber = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::VIDEO_EPISODE_NUMBER]);
$videoTitle = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::VIDEO_TITLE]);
$this->fileBaseName = $seriesTitle . '-' . $seasonNumber . '-' . $videoEpisodeNumber . '-' . $videoTitle;
// entry cue points
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->add(CuePointPeer::PARTNER_ID, $distributionJobData->entryDistribution->partnerId);
$c->add(CuePointPeer::ENTRY_ID, $distributionJobData->entryDistribution->entryId);
$c->add(CuePointPeer::TYPE, AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD));
$c->addAscendingOrderByColumn(CuePointPeer::START_TIME);
$cuePointsDb = CuePointPeer::doSelect($c);
$this->cuePoints = KalturaCuePointArray::fromDbArray($cuePointsDb);
}
示例14: handleEntry
protected function handleEntry($context, $feed, entry $entry, Entrydistribution $entryDistribution)
{
$fields = $this->profile->getAllFieldValues($entryDistribution);
$flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
$thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds()));
$xml = $feed->getItemXml($fields, $flavorAssets, $thumbAssets, $entry);
if ($entry->getUpdatedAt(null) > $this->lastBuildDate) {
$context->lastBuildDate = $entry->getUpdatedAt(null);
}
return $xml;
}
示例15: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaYahooDistributionProfile) {
return;
}
//Flavor Assets
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$videoAssetFilePathArray = array();
foreach ($flavorAssets as $flavorAsset) {
if ($flavorAsset) {
/* @var $flavorAsset flavorAsset */
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$id = $flavorAsset->getId();
//$this->videoAssetFilePath[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$videoAssetFilePathArray[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
}
$this->videoAssetFilePath = serialize($videoAssetFilePathArray);
}
//Thumbnails
$c = new Criteria();
$c->addAnd(assetPeer::ID, explode(',', $distributionJobData->entryDistribution->thumbAssetIds), Criteria::IN);
$c->addAscendingOrderByColumn(assetPeer::ID);
$thumbAssets = assetPeer::doSelect($c);
//$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets) >= 2) {
if ($thumbAssets[0]->getWidth() <= $thumbAssets[1]->getWidth()) {
$smallThumbAsset = $thumbAssets[0];
$largeThumbAsset = $thumbAssets[1];
} else {
$smallThumbAsset = $thumbAssets[1];
$largeThumbAsset = $thumbAssets[0];
}
$syncKey = $smallThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->smallThumbPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$syncKey = $largeThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->largeThumbPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
}