本文整理匯總了PHP中assetPeer類的典型用法代碼示例。如果您正苦於以下問題:PHP assetPeer類的具體用法?PHP assetPeer怎麽用?PHP assetPeer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了assetPeer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
}
}
示例2: __construct
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: addFileSyncImportJob
/**
* @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: 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;
}
示例5: entryHandled
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();
}
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:29,代碼來源:KalturaWebcamTokenResource.php
示例6: copyAssets
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: getAsset
/**
* @return CaptionAsset
*/
public function getAsset()
{
if (!$this->aAsset && $this->getCaptionAssetId()) {
$this->aAsset = assetPeer::retrieveById($this->getCaptionAssetId());
}
return $this->aAsset;
}
示例8: __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();
}
示例9: updatedParseMulti
private function updatedParseMulti($dbBatchJob, $data)
{
$captionId = $data->getMultiLanaguageCaptionAssetId();
$captionAsset = assetPeer::retrieveById($captionId);
$captionAsset->setStatus(asset::ASSET_STATUS_ERROR);
$captionAsset->save();
}
示例10: 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);
}
示例11: __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
示例12: 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
示例13: __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');
}
}
示例14: parseAction
/**
* 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: listAction
/**
* 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;
}