コード例 #1
0
 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);
         }
     }
 }
コード例 #2
0
 public function __construct(KalturaDistributionJobData $distributionJobData = null)
 {
     parent::__construct($distributionJobData);
     $this->notificationBaseUrl = 'http://' . kConf::get('cdn_api_host');
     if (!$distributionJobData) {
         return;
     }
     if (!$distributionJobData->distributionProfile instanceof KalturaUnicornDistributionProfile) {
         return;
     }
     $entryDistributionDb = EntryDistributionPeer::retrieveByPK($distributionJobData->entryDistributionId);
     $distributionProfileDb = DistributionProfilePeer::retrieveByPK($distributionJobData->distributionProfileId);
     /* @var $distributionProfileDb UnicornDistributionProfile */
     $flavorAssetIds = explode(',', $entryDistributionDb->getFlavorAssetIds());
     $flavorAssetId = reset($flavorAssetIds);
     $flavorAsset = assetPeer::retrieveById($flavorAssetId);
     $flavorAssetOldVersion = $entryDistributionDb->getFromCustomData(kUnicornDistributionJobProviderData::CUSTOM_DATA_FLAVOR_ASSET_OLD_VERSION);
     $flavorAssetNewVersion = null;
     if ($flavorAsset) {
         $flavorAssetNewVersion = $flavorAsset->getVersion();
     }
     $values = $distributionProfileDb->getAllFieldValues($entryDistributionDb);
     $this->catalogGuid = $values[UnicornDistributionField::CATALOG_GUID];
     $this->title = $values[UnicornDistributionField::TITLE];
     $this->flavorAssetVersion = $flavorAssetNewVersion;
     $this->mediaChanged = $flavorAssetOldVersion != $flavorAssetNewVersion;
 }
コード例 #3
0
 /**
  * @param string $entryId
  * @param FileSync $object
  * @param int $fileSyncId
  * @param string $sourceFileUrl
  * @return BatchJob
  */
 public static function addFileSyncImportJob($entryId, FileSync $fileSync, $sourceFileUrl, BatchJob $parentJob = null, $fileSize = null)
 {
     $partnerId = $fileSync->getPartnerId();
     $fileSyncId = $fileSync->getId();
     $dc = $fileSync->getDc();
     KalturaLog::log(__METHOD__ . " entryId[{$entryId}], partnerId[{$partnerId}], fileSyncId[{$fileSyncId}], sourceFileUrl[{$sourceFileUrl}]");
     $fileSyncImportData = new kFileSyncImportJobData();
     $fileSyncImportData->setSourceUrl($sourceFileUrl);
     $fileSyncImportData->setFilesyncId($fileSyncId);
     $fileSyncImportData->setFileSize($fileSize);
     // tmpFilePath and destFilePath will be set later during get exlusive call on the target data center
     $batchJob = null;
     if ($parentJob) {
         $batchJob = $parentJob->createChild(BatchJobType::FILESYNC_IMPORT, null, true, $dc);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setDc($dc);
         $batchJob->setEntryId($entryId);
         $batchJob->setPartnerId($partnerId);
     }
     $batchJob->setObjectId($fileSyncId);
     $batchJob->setObjectType(BatchJobObjectType::FILE_SYNC);
     //In case file sync is of type data and holds flavor asset than we need to check if its the source asset that is being synced and raise it sync priority
     if ($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET && $fileSync->getObjectSubType() == entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA && $fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
         $assetdb = assetPeer::retrieveById($fileSync->getObjectId());
         if ($assetdb) {
             $isSourceAsset = $assetdb->getIsOriginal();
             if ($isSourceAsset) {
                 $fileSyncImportData->setIsSourceAsset(true);
             }
         }
     }
     KalturaLog::log("Creating Filesync Import job, with file sync id: {$fileSyncId} size: {$fileSize}");
     return kJobsManager::addJob($batchJob, $fileSyncImportData, BatchJobType::FILESYNC_IMPORT);
 }
コード例 #4
0
 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;
 }
 public function entryHandled(entry $dbEntry)
 {
     parent::entryHandled($dbEntry);
     $originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($dbEntry->getId());
     $syncKey = $originalFlavorAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $sourceFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     // call mediaInfo for file
     $dbMediaInfo = new mediaInfo();
     try {
         $mediaInfoParser = new KMediaInfoMediaParser($sourceFilePath, kConf::get('bin_path_mediainfo'));
         $mediaInfo = $mediaInfoParser->getMediaInfo();
         $dbMediaInfo = $mediaInfo->toInsertableObject($dbMediaInfo);
         $dbMediaInfo->setFlavorAssetId($originalFlavorAsset->getId());
         $dbMediaInfo->save();
     } catch (Exception $e) {
         KalturaLog::err("Getting media info: " . $e->getMessage());
         $dbMediaInfo = null;
     }
     // fix flavor asset according to mediainfo
     if ($dbMediaInfo) {
         KDLWrap::ConvertMediainfoCdl2FlavorAsset($dbMediaInfo, $originalFlavorAsset);
         $flavorTags = KDLWrap::CDLMediaInfo2Tags($dbMediaInfo, array(flavorParams::TAG_WEB, flavorParams::TAG_MBR));
         $originalFlavorAsset->setTags(implode(',', array_unique($flavorTags)));
     }
     $originalFlavorAsset->setStatusLocalReady();
     $originalFlavorAsset->save();
     $dbEntry->setStatus(entryStatus::READY);
     $dbEntry->save();
 }
コード例 #6
0
ファイル: ThumbCuePoint.php プロジェクト: kubrickfr/server
 public function copyAssets(entry $toEntry, ThumbCuePoint $toCuePoint, $adjustedStartTime = null)
 {
     $timedThumbAsset = assetPeer::retrieveById($this->getAssetId());
     if (!$timedThumbAsset) {
         KalturaLog::debug("Can't retrieve timedThumbAsset with id: {$this->getAssetId()}");
         return;
     }
     // Offset the startTime according to the duration gap between the live and VOD entries
     if (!is_null($adjustedStartTime)) {
         $toCuePoint->setStartTime($adjustedStartTime);
     }
     $toCuePoint->save();
     // Must save in order to produce an id
     $timedThumbAsset->setCuePointID($toCuePoint->getId());
     // Set the destination cue point's id
     $timedThumbAsset->setCustomDataObj();
     // Write the cached custom data object into the thumb asset
     // Make a copy of the current thumb asset
     // copyToEntry will create a filesync softlink to the original filesync
     $toTimedThumbAsset = $timedThumbAsset->copyToEntry($toEntry->getId(), $toEntry->getPartnerId());
     $toCuePoint->setAssetId($toTimedThumbAsset->getId());
     $toCuePoint->save();
     // Restore the thumb asset's prev. cue point id (for good measures)
     $timedThumbAsset->setCuePointID($this->getId());
     $timedThumbAsset->setCustomDataObj();
     // Save the destination entry's thumb asset
     $toTimedThumbAsset->setCuePointID($toCuePoint->getId());
     $toTimedThumbAsset->save();
     KalturaLog::log("Saved cue point [{$toCuePoint->getId()}] and timed thumb asset [{$toTimedThumbAsset->getId()}]");
 }
コード例 #7
0
ファイル: CaptionAssetItem.php プロジェクト: DBezemer/server
 /**
  * @return CaptionAsset
  */
 public function getAsset()
 {
     if (!$this->aAsset && $this->getCaptionAssetId()) {
         $this->aAsset = assetPeer::retrieveById($this->getCaptionAssetId());
     }
     return $this->aAsset;
 }
コード例 #8
0
 /**
  * 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();
 }
コード例 #9
0
 private function updatedParseMulti($dbBatchJob, $data)
 {
     $captionId = $data->getMultiLanaguageCaptionAssetId();
     $captionAsset = assetPeer::retrieveById($captionId);
     $captionAsset->setStatus(asset::ASSET_STATUS_ERROR);
     $captionAsset->save();
 }
コード例 #10
0
ファイル: AvnService.php プロジェクト: DBezemer/server
 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);
 }
 /**
  * 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);
 }
 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;
 }
コード例 #13
0
 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');
     }
 }
 /**
  * Parse content of caption asset and index it
  *
  * @action parse
  * @param string $captionAssetId
  * @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
  */
 function parseAction($captionAssetId)
 {
     $captionAsset = assetPeer::retrieveById($captionAssetId);
     if (!$captionAsset) {
         throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND, $captionAssetId);
     }
     $captionAssetItems = CaptionAssetItemPeer::retrieveByAssetId($captionAssetId);
     foreach ($captionAssetItems as $captionAssetItem) {
         /* @var $captionAssetItem CaptionAssetItem */
         $captionAssetItem->delete();
     }
     $syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $content = kFileSyncUtils::file_get_contents($syncKey, true, false);
     if (!$content) {
         return;
     }
     $captionsContentManager = kCaptionsContentManager::getCoreContentManager($captionAsset->getContainerFormat());
     $itemsData = $captionsContentManager->parse($content);
     foreach ($itemsData as $itemData) {
         $item = new CaptionAssetItem();
         $item->setCaptionAssetId($captionAsset->getId());
         $item->setEntryId($captionAsset->getEntryId());
         $item->setPartnerId($captionAsset->getPartnerId());
         $item->setStartTime($itemData['startTime']);
         $item->setEndTime($itemData['endTime']);
         $item->setContent(utf8_encode($itemData['content']));
         $item->save();
     }
 }
コード例 #15
0
ファイル: MediaInfoService.php プロジェクト: DBezemer/server
 /**
  * List media info objects by filter and pager
  * 
  * @action list
  * @param KalturaMediaInfoFilter $filter
  * @param KalturaFilterPager $pager
  * @return KalturaMediaInfoListResponse
  */
 function listAction(KalturaMediaInfoFilter $filter = null, KalturaFilterPager $pager = null)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
     if (!$filter) {
         $filter = new KalturaMediaInfoFilter();
     }
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $mediaInfoFilter = new MediaInfoFilter();
     $filter->toObject($mediaInfoFilter);
     if ($filter->flavorAssetIdEqual) {
         // Since media_info table does not have partner_id column, enforce partner by getting the asset
         if (!assetPeer::retrieveById($filter->flavorAssetIdEqual)) {
             throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $filter->flavorAssetIdEqual);
         }
     }
     $c = new Criteria();
     $mediaInfoFilter->attachToCriteria($c);
     $totalCount = mediaInfoPeer::doCount($c);
     $pager->attachToCriteria($c);
     $dbList = mediaInfoPeer::doSelect($c);
     $list = KalturaMediaInfoArray::fromDbArray($dbList, $this->getResponseProfile());
     $response = new KalturaMediaInfoListResponse();
     $response->objects = $list;
     $response->totalCount = $totalCount;
     return $response;
 }
コード例 #16
0
ファイル: EntryAdminService.php プロジェクト: DBezemer/server
 /**
  * Get base entry by flavor ID with no filters.
  * 
  * @action getByFlavorId
  * @param string $flavorId
  * @param int $version Desired version of the data
  * @return KalturaBaseEntry The requested entry
  */
 public function getByFlavorIdAction($flavorId, $version = -1)
 {
     $flavorAssetDb = assetPeer::retrieveById($flavorId);
     if (!$flavorAssetDb) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $flavorId);
     }
     return $this->getAction($flavorAssetDb->getEntryId(), $version);
 }
コード例 #17
0
 /**
  * @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;
 }
 /**
  * @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;
 }
コード例 #19
0
 protected function addFlavorByMsnId(array &$flavorAssetsByMsnId, $msnId, $entryId, $flavorAssetId)
 {
     if ($flavorAssetId != -1) {
         $flavorAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $flavorAssetId);
         if ($flavorAsset) {
             $flavorAssetsByMsnId[$msnId] = $flavorAsset;
         }
     }
 }
コード例 #20
0
 protected function getCaptions($partnerId, $entryId)
 {
     $c = new Criteria();
     $c->add(assetPeer::PARTNER_ID, $partnerId);
     $c->add(assetPeer::ENTRY_ID, $entryId);
     $c->add(assetPeer::TYPE, CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION));
     $c->add(assetPeer::STATUS, asset::ASSET_STATUS_READY);
     return assetPeer::doSelect($c);
 }
コード例 #21
0
 public function execute()
 {
     $widgetId = $this->getRequestParameter("wid");
     $widget = widgetPeer::retrieveByPK($widgetId);
     if (!$widget) {
         KalturaLog::err("Widget id [{$widgetId}] not found");
         die;
     }
     $entry = $widget->getentry();
     $entryId = $widget->getEntryId();
     if (!$entry) {
         KalturaLog::err("Entry id [{$entryId}] not found");
         die;
     }
     $uiConf = $widget->getuiConf();
     $uiConfId = $widget->getUiConfId();
     if (!$uiConf) {
         KalturaLog::err("UI Conf id [{$uiConfId}] not found");
         die;
     }
     $this->entry_name = $entry->getName();
     $this->entry_description = $entry->getDescription();
     $this->entry_thumbnail_url = $entry->getThumbnailUrl();
     $this->entry_thumbnail_secure_url = $entry->getThumbnailUrl(null, 'https');
     $this->entry_duration = $entry->getDuration();
     $flavor_tag = $this->getRequestParameter('flavor_tag', 'iphone');
     $flavor_assets = assetPeer::retrieveReadyFlavorsByEntryIdAndTag($entryId, $flavor_tag);
     $flavor_asset = reset($flavor_assets);
     $flavorId = null;
     if ($flavor_asset) {
         $flavorId = $flavor_asset->getId();
     }
     $embed_host = kConf::hasParam('cdn_api_host') ? kConf::get('cdn_api_host') : kConf::get('www_host');
     $embed_host_https = kConf::hasParam('cdn_api_host_https') ? kConf::get('cdn_api_host_https') : kConf::get('www_host');
     $https_enabled = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false;
     $protocol = $https_enabled ? 'https' : 'http';
     $port = $_SERVER["SERVER_PORT"] != "80" ? ":" . $_SERVER["SERVER_PORT"] : '';
     $partnerId = $widget->getPartnerId();
     $this->widget = $widget;
     $this->entry = $entry;
     $this->uiConf = $uiConf;
     // Build SWF Path
     $swfPath = "/index.php/kwidget/wid/" . $widgetId . "/uiconf_id/" . $uiConfId . "/entry_id/" . $entryId;
     // Set SWF URLs
     $this->swfUrl = 'http://' . $embed_host . $swfPath;
     $this->swfSecureUrl = 'https://' . $embed_host_https . $swfPath;
     // set player url
     $this->playerUrl = 'https://' . $embed_host_https . '/p/' . $this->partner_id . '/sp/' . $this->partner_id . '00/embedIframeJs/uiconf_id/' . $this->uiconf_id . '/partner_id/' . $this->partner_id . '?iframeembed=true&entry_id=' . $this->entry_id . '&flashvars[streamerType]=auto';
     $host = $https_enabled ? $embed_host_https : $embed_host;
     $this->html5Url = $protocol . "://" . $host . "/p/" . $partnerId . "/sp/" . $partnerId . "00/embedIframeJs/uiconf_id/" . $uiConfId . "/partner_id/" . $partnerId;
     $this->pageURL = $protocol . '://' . $_SERVER["SERVER_NAME"] . $port . $_SERVER["REQUEST_URI"];
     $this->flavorUrl = null;
     if (isset($flavorId)) {
         $this->flavorUrl = 'https://' . $embed_host_https . '/p/' . $partnerId . '/sp/' . $partnerId . '00/playManifest/entryId/' . $entryId . '/flavorId/' . $flavorId . '/format/url/protocol/' . $protocol . '/a.mp4';
     }
 }
コード例 #22
0
 public function validateTimedThumbAssetId()
 {
     $timedThumb = assetPeer::retrieveById($this->assetId);
     if (!$timedThumb) {
         throw new KalturaAPIException(KalturaErrors::ASSET_ID_NOT_FOUND, $this->assetId);
     }
     if ($timedThumb->getType() != ThumbCuePointPlugin::getAssetTypeCoreValue(timedThumbAssetType::TIMED_THUMB_ASSET)) {
         throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_IS_NOT_TIMED_THUMB_TYPE, $this->assetId);
     }
 }
コード例 #23
0
 /**
  * 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);
 }
コード例 #24
0
ファイル: mediaInfoPeer.php プロジェクト: kubrickfr/server
 /**
  * @param string $entryId
  * @return mediaInfo
  */
 public static function retrieveOriginalByEntryId($entryId)
 {
     $sourceFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
     if (!$sourceFlavorAsset) {
         return null;
     }
     $criteria = new Criteria();
     $criteria->add(mediaInfoPeer::FLAVOR_ASSET_ID, $sourceFlavorAsset->getId());
     $criteria->addDescendingOrderByColumn(mediaInfoPeer::CREATED_AT);
     return mediaInfoPeer::doSelectOne($criteria);
 }
コード例 #25
0
ファイル: NdnService.php プロジェクト: DBezemer/server
 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;
 }
コード例 #26
0
 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);
         }
     }
 }
コード例 #27
0
ファイル: KalturaAssetFilter.php プロジェクト: visomar/server
 protected function doGetListResponse(KalturaFilterPager $pager, array $types = null)
 {
     $this->validateEntryIdFiltered();
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
     // verify access to the relevant entries - either same partner as the KS or kaltura network
     if ($this->entryIdEqual) {
         $entryIds = array($this->entryIdEqual);
     } else {
         if ($this->entryIdIn) {
             $entryIds = explode(',', $this->entryIdIn);
         } else {
             throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, 'KalturaAssetFilter::entryIdEqual/KalturaAssetFilter::entryIdIn');
         }
     }
     $entryIds = array_slice($entryIds, 0, baseObjectFilter::getMaxInValues());
     $c = KalturaCriteria::create(entryPeer::OM_CLASS);
     $c->addAnd(entryPeer::ID, $entryIds, Criteria::IN);
     $criterionPartnerOrKn = $c->getNewCriterion(entryPeer::PARTNER_ID, kCurrentContext::getCurrentPartnerId());
     $criterionPartnerOrKn->addOr($c->getNewCriterion(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK));
     $c->addAnd($criterionPartnerOrKn);
     $dbEntries = entryPeer::doSelect($c);
     if (!$dbEntries) {
         return array(array(), 0);
     }
     $entryIds = array();
     foreach ($dbEntries as $dbEntry) {
         $entryIds[] = $dbEntry->getId();
     }
     $this->entryIdEqual = null;
     $this->entryIdIn = implode(',', $entryIds);
     // get the flavors
     $flavorAssetFilter = new AssetFilter();
     $this->toObject($flavorAssetFilter);
     $c = new Criteria();
     $flavorAssetFilter->attachToCriteria($c);
     if ($types) {
         $c->add(assetPeer::TYPE, $types, Criteria::IN);
     }
     $pager->attachToCriteria($c);
     $list = assetPeer::doSelect($c);
     $resultCount = count($list);
     if ($resultCount && $resultCount < $pager->pageSize) {
         $totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
     } else {
         KalturaFilterPager::detachFromCriteria($c);
         $totalCount = assetPeer::doCount($c);
     }
     myDbHelper::$use_alternative_con = null;
     return array($list, $totalCount);
 }
コード例 #28
0
 protected function validateFlavorAssetssAllowed(DrmLicenseUtils $drmLU, $flavorIdsArr)
 {
     $secureEntryHelper = $drmLU->getSecureEntryHelper();
     foreach ($flavorIdsArr as $flavorId) {
         $flavorAsset = assetPeer::retrieveById($flavorId);
         if (isset($flavorAsset)) {
             if (!$secureEntryHelper->isAssetAllowed($flavorAsset)) {
                 KalturaLog::err("Asset '{$flavorId}' is not allowed according to policy'");
                 return false;
             }
         }
     }
     return true;
 }
コード例 #29
0
 /**
  * 
  * @param int $objectType
  * @param string $objectId
  * @return ISyncableFile
  */
 public static function retrieveObject($objectType, $objectId)
 {
     $object = null;
     switch ($objectType) {
         case FileSyncObjectType::ENTRY:
             entryPeer::setUseCriteriaFilter(false);
             $object = entryPeer::retrieveByPK($objectId);
             entryPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::UICONF:
             uiConfPeer::setUseCriteriaFilter(false);
             $object = uiConfPeer::retrieveByPK($objectId);
             uiConfPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::BATCHJOB:
             BatchJobPeer::setUseCriteriaFilter(false);
             $object = BatchJobPeer::retrieveByPK($objectId);
             BatchJobPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::FLAVOR_ASSET:
             assetPeer::setUseCriteriaFilter(false);
             $object = assetPeer::retrieveById($objectId);
             assetPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::SYNDICATION_FEED:
             syndicationFeedPeer::setUseCriteriaFilter(false);
             $object = syndicationFeedPeer::retrieveByPK($objectId);
             syndicationFeedPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::CONVERSION_PROFILE:
             conversionProfile2Peer::setUseCriteriaFilter(false);
             $object = conversionProfile2Peer::retrieveByPK($objectId);
             conversionProfile2Peer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::FILE_ASSET:
             conversionProfile2Peer::setUseCriteriaFilter(false);
             $object = FileAssetPeer::retrieveByPK($objectId);
             conversionProfile2Peer::setUseCriteriaFilter(true);
             break;
     }
     if ($object == null) {
         $object = KalturaPluginManager::loadObject('ISyncableFile', $objectType, array('objectId' => $objectId));
     }
     if ($object == null) {
         $error = __METHOD__ . " Cannot find object type [" . $objectType . "] with object_id [" . $objectId . "]";
         KalturaLog::err($error);
         throw new kFileSyncException($error);
     }
     return $object;
 }
コード例 #30
0
ファイル: UverseService.php プロジェクト: DBezemer/server
 protected function handleEntry($context, $feed, entry $entry, Entrydistribution $entryDistribution)
 {
     $fields = $this->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()));
     $xml = $feed->getItemXml($fields, $flavorAsset, $flavorAssetRemoteUrl, $thumbAssets);
     // we want to find the newest update time between all entries
     if ($entry->getUpdatedAt(null) > $context->lastBuildDate) {
         $context->lastBuildDate = $entry->getUpdatedAt(null);
     }
     return $xml;
 }