/** * 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 getTypeListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null, $type = null) { list($list, $totalCount) = $this->doGetListResponse($pager, $type); $response = new KalturaCuePointListResponse(); $response->objects = KalturaCuePointArray::fromDbArray($list, $responseProfile); $response->totalCount = $totalCount; return $response; }
/** * 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); }
/** * Allows you to add multiple cue points objects by uploading XML that contains multiple cue point definitions * * @action addFromBulk * @param file $fileData * @return KalturaCuePointListResponse * @throws KalturaCuePointErrors::XML_FILE_NOT_FOUND * @throws KalturaCuePointErrors::XML_INVALID */ function addFromBulkAction($fileData) { try { $list = kCuePointManager::addFromXml($fileData['tmp_name'], $this->getPartnerId()); } catch (kCoreException $e) { throw new KalturaAPIException($e->getCode()); } $response = new KalturaCuePointListResponse(); $response->objects = KalturaCuePointArray::fromDbArray($list, $this->getResponseProfile()); $response->totalCount = count($list); return $response; }
/** * List cue point objects by filter and pager * * @action list * @param KalturaCuePointFilter $filter * @param KalturaFilterPager $pager * @return KalturaCuePointListResponse */ function listAction(KalturaCuePointFilter $filter = null, KalturaFilterPager $pager = null) { if (!$filter) { $filter = new KalturaCuePointFilter(); } $c = KalturaCriteria::create(CuePointPeer::OM_CLASS); if ($this->getCuePointType()) { $c->add(CuePointPeer::TYPE, $this->getCuePointType()); } $cuePointFilter = $filter->toObject(); $cuePointFilter->attachToCriteria($c); if ($pager) { $pager->attachToCriteria($c); } $list = CuePointPeer::doSelect($c); $response = new KalturaCuePointListResponse(); $response->objects = KalturaCuePointArray::fromDbArray($list); $response->totalCount = $c->getRecordsCount(); return $response; }