本文整理汇总了PHP中entry::getPartnerId方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::getPartnerId方法的具体用法?PHP entry::getPartnerId怎么用?PHP entry::getPartnerId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::getPartnerId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasPermissionToCopyToEntry
/**
* @param entry $entry
* @return bool true if cuepoints should be copied to given entry
*/
public function hasPermissionToCopyToEntry(entry $entry)
{
if (!$entry->getIsTemporary() && PermissionPeer::isValidForPartner(AnnotationCuePointPermissionName::COPY_ANNOTATIONS_TO_CLIP, $entry->getPartnerId())) {
return true;
}
if ($entry->getIsTemporary() && !PermissionPeer::isValidForPartner(AnnotationCuePointPermissionName::DO_NOT_COPY_ANNOTATIONS_TO_TRIMMED_ENTRY, $entry->getPartnerId())) {
return true;
}
return false;
}
示例2: 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()}]");
}
示例3: validateKs
protected function validateKs()
{
if ($this->_ksStr) {
try {
// todo need to check if partner is within a partner group
$ks = kSessionUtils::crackKs($this->_ksStr);
// if entry is "display_in_search=2" validate partner ID from the KS
// => meaning it will alwasy pass on partner_id
if ($this->_entry->getDisplayInSearch() != mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK) {
$valid = $ks->isValidForPartner($this->_entry->getPartnerId());
} else {
$valid = $ks->isValidForPartner($ks->partner_id);
}
if ($valid === ks::EXPIRED) {
die("This URL is expired");
} else {
if ($valid === ks::INVALID_PARTNER) {
if ($this->hasRestrictions()) {
// todo - for now if the entry doesnt have restrictions any way disregard a partner group check
die("Invalid session [" . $valid . "]");
}
} else {
if ($valid !== ks::OK) {
die("Invalid session [" . $valid . "]");
}
}
}
$this->_ks = $ks;
} catch (Exception $ex) {
KExternalErrors::dieError(KExternalErrors::INVALID_KS_SRT);
}
}
}
示例4: 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()));
$captionAssets = null;
if ($this->profile instanceof ComcastMrssDistributionProfile && $this->profile->getShouldIncludeCaptions()) {
KalturaLog::info("Adding entry captions.");
$captionAssets = $this->getCaptions($entry->getPartnerId(), $entry->getId());
}
$cuePoints = null;
if ($this->profile instanceof ComcastMrssDistributionProfile && $this->profile->getShouldIncludeCuePoints()) {
KalturaLog::info("Adding entry cue points.");
$cuePoints = $this->getCuePoints($entry->getPartnerId(), $entry->getId());
}
return $feed->getItemXml($fields, $flavorAssets, $thumbAssets, $captionAssets, $cuePoints);
}
示例5: updateAdminTags
public static function updateAdminTags(entry $entry)
{
// be ready to update the admin_tags if the admin_tags OR the status was modified
if ($entry->isColumnModified(entryPeer::ADMIN_TAGS) || $entry->isColumnModified(entryPeer::STATUS)) {
$partner_id = $entry->getPartnerId();
$admin_tags_str = self::getAdminTags($partner_id, null, true, $entry->getId());
$admin_tags = explode(self::TAG_SEPARATOR, $admin_tags_str);
$admin_tags = self::mergeAdminTags($admin_tags, $entry->getAdminTags());
$after_change = self::sortAndSetAdminTags($partner_id, $admin_tags);
}
}
示例6: purgeEntryFromEdgeCast
private static function purgeEntryFromEdgeCast(entry $entry)
{
// get partner
$partnerId = $entry->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
KalturaLog::err('Cannot find partner with id [' . $partnerId . ']');
return false;
}
$mediaTypePathList = array(array('MediaType' => self::EDGE_SERVICE_HTTP_LARGE_OBJECT_MEDIA_TYPE, 'MediaPath' => $entry->getDownloadUrl()), array('MediaType' => self::EDGE_SERVICE_HTTP_SMALL_OBJECT_MEDIA_TYPE, 'MediaPath' => $entry->getThumbnailUrl()));
return self::purgeFromEdgeCast($mediaTypePathList, $partner);
}
示例7: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
// where file is {entryId/flavorId}.{ism,ismc,ismv}
$objectId = $type = null;
$objectIdStr = $this->getRequestParameter("objectId");
if ($objectIdStr) {
list($objectId, $type) = @explode(".", $objectIdStr);
}
if (!$type || !$objectId) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER);
}
$ks = $this->getRequestParameter("ks");
$referrer = base64_decode($this->getRequestParameter("referrer"));
if (!is_string($referrer)) {
// base64_decode can return binary data
$referrer = '';
}
$syncKey = $this->getFileSyncKey($objectId, $type);
KalturaMonitorClient::initApiMonitor(false, 'extwidget.serveIsm', $this->entry->getPartnerId());
myPartnerUtils::enforceDelivery($this->entry, $this->flavorAsset);
if (!kFileSyncUtils::file_exists($syncKey, false)) {
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
if (is_null($fileSync)) {
KalturaLog::log("Error - no FileSync for type [{$type}] objectId [{$objectId}]");
KExternalErrors::dieError(KExternalErrors::FILE_NOT_FOUND);
}
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
kFileUtils::dumpUrl($remoteUrl);
}
$path = kFileSyncUtils::getReadyLocalFilePathForKey($syncKey);
if ($type == 'ism') {
$fileData = $this->fixIsmManifestForReplacedEntry($path);
$renderer = new kRendererString($fileData, 'image/ism');
$renderer->output();
KExternalErrors::dieGracefully();
} else {
kFileUtils::dumpFile($path);
}
}
示例8: execute
public function execute()
{
$this->entryId = $this->getRequestParameter("entryId", null);
$this->flavorId = $this->getRequestParameter("flavorId", null);
$this->storageId = $this->getRequestParameter("storageId", null);
$this->maxBitrate = $this->getRequestParameter("maxBitrate", null);
$flavorIdsStr = $this->getRequestParameter("flavorIds", null);
if ($flavorIdsStr) {
$this->flavorIds = explode(",", $flavorIdsStr);
}
$this->entry = entryPeer::retrieveByPKNoFilter($this->entryId);
if (!$this->entry) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
if (!$this->flavorId) {
$flavorParamId = $this->getRequestParameter("flavorParamId", null);
if ($flavorParamId) {
$flavorAsset = flavorAssetPeer::retrieveByEntryIdAndFlavorParams($entry->getId(), $flavorParamId);
if (!$flavorAsset) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
$this->flavorId = $flavorAsset->getId();
}
}
$this->validateStorageId();
$this->protocol = $this->getRequestParameter("protocol", null);
if (!$this->protocol) {
$this->protocol = StorageProfile::PLAY_FORMAT_HTTP;
}
$this->format = $this->getRequestParameter("format");
if (!$this->format) {
$this->format = StorageProfile::PLAY_FORMAT_HTTP;
}
$this->cdnHost = $this->getRequestParameter("cdnHost", null);
$partner = $this->entry->getPartner();
if (!$this->cdnHost || $partner->getForceCdnHost()) {
$this->cdnHost = myPartnerUtils::getCdnHost($this->entry->getPartnerId(), $this->protocol);
}
if ($this->maxBitrate && (!is_numeric($this->maxBitrate) || $this->maxBitrate <= 0)) {
KExternalErrors::dieError(KExternalErrors::INVALID_MAX_BITRATE);
}
$ksStr = $this->getRequestParameter("ks");
$base64Referrer = $this->getRequestParameter("referrer");
$referrer = base64_decode($base64Referrer);
if (!is_string($referrer)) {
$referrer = "";
}
// base64_decode can return binary data
$securyEntryHelper = new KSecureEntryHelper($this->entry, $ksStr, $referrer);
if ($securyEntryHelper->shouldPreview()) {
$this->clipTo = $securyEntryHelper->getPreviewLength() * 1000;
} else {
$securyEntryHelper->validateForPlay($this->entry, $ksStr);
}
// grab seekFrom parameter and normalize url
$this->seekFrom = $this->getRequestParameter("seekFrom", -1);
if ($this->seekFrom <= 0) {
$this->seekFrom = -1;
}
if ($this->entry->getStatus() == entryStatus::DELETED) {
// because the fiter was turned off - a manual check for deleted entries must be done.
die;
}
$xml = null;
switch ($this->format) {
case StorageProfile::PLAY_FORMAT_HTTP:
$xml = $this->serveHttp();
break;
case StorageProfile::PLAY_FORMAT_RTMP:
$xml = $this->serveRtmp();
break;
case StorageProfile::PLAY_FORMAT_SILVER_LIGHT:
$xml = $this->serveSilverLight();
break;
case StorageProfile::PLAY_FORMAT_APPLE_HTTP:
$xml = $this->serveAppleHttp();
break;
case "url":
return $this->serveUrl();
break;
case "hdnetworksmil":
$xml = $this->serveHDNetwork();
break;
case "hdnetwork":
$duration = $this->entry->getDurationInt();
$mediaUrl = "<media url=\"" . requestUtils::getHost() . str_replace("f4m", "smil", str_replace("hdnetwork", "hdnetworksmil", $_SERVER["REQUEST_URI"])) . "\"/>";
$xml = $this->buildXml(self::PLAY_STREAM_TYPE_RECORDED, array(), 'video/x-flv', $duration, null, $mediaUrl);
break;
}
if ($this->format == StorageProfile::PLAY_FORMAT_APPLE_HTTP) {
header("Content-Type: text/plain; charset=UTF-8");
} else {
header("Content-Type: text/xml; charset=UTF-8");
header("Content-Disposition: inline; filename=manifest.xml");
}
echo $xml;
die;
}
示例9: addConvertProfileJob
//.........这里部分代码省略.........
$conversionProfile = myPartnerUtils::getConversionProfile2ForEntry($entry->getId());
// load the asset params to the instance pool
$flavorIds = flavorParamsConversionProfilePeer::getFlavorIdsByProfileId($conversionProfile->getId());
assetParamsPeer::retrieveByPKs($flavorIds);
$conversionRequired = false;
$sourceFileRequiredStorages = array();
$sourceIncludedInProfile = false;
$flavorAsset = assetPeer::retrieveById($flavorAssetId);
$flavors = flavorParamsConversionProfilePeer::retrieveByConversionProfile($conversionProfile->getId());
KalturaLog::debug("Found flavors [" . count($flavors) . "] in conversion profile [" . $conversionProfile->getId() . "]");
foreach ($flavors as $flavor) {
/* @var $flavor flavorParamsConversionProfile */
if ($flavor->getFlavorParamsId() == $flavorAsset->getFlavorParamsId()) {
KalturaLog::debug("Flavor [" . $flavor->getFlavorParamsId() . "] is ingested source");
$sourceIncludedInProfile = true;
continue;
}
$flavorParams = assetParamsPeer::retrieveByPK($flavor->getFlavorParamsId());
if ($flavorParams instanceof liveParams || $flavor->getOrigin() == assetParamsOrigin::INGEST) {
KalturaLog::debug("Flavor [" . $flavor->getFlavorParamsId() . "] should be ingested");
continue;
}
if ($flavor->getOrigin() == assetParamsOrigin::CONVERT_WHEN_MISSING) {
$siblingFlavorAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $flavor->getFlavorParamsId());
if ($siblingFlavorAsset) {
KalturaLog::debug("Flavor [" . $flavor->getFlavorParamsId() . "] already ingested");
continue;
}
}
$sourceFileRequiredStorages[] = $flavorParams->getSourceRemoteStorageProfileId();
$conversionRequired = true;
break;
}
if ($conversionRequired) {
foreach ($sourceFileRequiredStorages as $storageId) {
if ($storageId == StorageProfile::STORAGE_KALTURA_DC) {
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
list($syncFile, $local) = kFileSyncUtils::getReadyFileSyncForKey($key, true, false);
if ($syncFile && $syncFile->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL && $partner && $partner->getImportRemoteSourceForConvert()) {
KalturaLog::debug("Creates import job for remote file sync");
$url = $syncFile->getExternalUrl($entry->getId());
kJobsManager::addImportJob($parentJob, $entry->getId(), $partner->getId(), $url, $flavorAsset, null, null, true);
$importingSources = true;
continue;
}
} elseif ($flavorAsset->getExternalUrl($storageId)) {
continue;
}
kBatchManager::updateEntry($entry->getId(), entryStatus::ERROR_CONVERTING);
$flavorAsset = assetPeer::retrieveById($flavorAssetId);
$flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
$flavorAsset->setDescription('Entry of size 0 should not be converted');
$flavorAsset->save();
KalturaLog::err('Entry of size 0 should not be converted');
return null;
}
} else {
if ($flavorAsset->getStatus() == asset::FLAVOR_ASSET_STATUS_QUEUED) {
if ($sourceIncludedInProfile) {
$flavorAsset->setStatusLocalReady();
} else {
$flavorAsset->setStatus(asset::FLAVOR_ASSET_STATUS_DELETED);
$flavorAsset->setDeletedAt(time());
}
$flavorAsset->save();
if ($sourceIncludedInProfile) {
kBusinessPostConvertDL::handleConvertFinished(null, $flavorAsset);
}
}
return null;
}
}
if ($entry->getStatus() != entryStatus::READY) {
$entry->setStatus(entryStatus::PRECONVERT);
}
$jobData = new kConvertProfileJobData();
$jobData->setFlavorAssetId($flavorAssetId);
$jobData->setInputFileSyncLocalPath($inputFileSyncLocalPath);
$jobData->setExtractMedia(true);
if ($entry->getType() != entryType::MEDIA_CLIP) {
$jobData->setExtractMedia(false);
$entry->setCreateThumb(false);
}
$entry->save();
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild(BatchJobType::CONVERT_PROFILE);
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($entry->getId());
$batchJob->setPartnerId($entry->getPartnerId());
$batchJob->setUseNewRoot(true);
}
$batchJob->setObjectId($entry->getId());
$batchJob->setObjectType(BatchJobObjectType::ENTRY);
if ($importingSources) {
$batchJob->setStatus(BatchJob::BATCHJOB_STATUS_DONT_PROCESS);
}
return self::addJob($batchJob, $jobData, BatchJobType::CONVERT_PROFILE);
}
示例10: deleteEntry
public static function deleteEntry(entry $entry, $partner_id = null)
{
if ($entry->getStatus() == entryStatus::DELETED || $entry->getStatus() == entryStatus::BLOCKED) {
return;
}
// don't do this twice !
KalturaLog::log("myEntryUtils::delete Entry [" . $entry->getId() . "] Partner [" . $entry->getPartnerId() . "]");
kJobsManager::abortEntryJobs($entry->getId());
$media_type = $entry->getMediaType();
$need_to_fix_roughcut = false;
$thumb_template_file = "&deleted_image.jpg";
KalturaLog::log("media type [{$media_type}]");
switch ($media_type) {
case entry::ENTRY_MEDIA_TYPE_AUDIO:
$template_file = "&deleted_audio.flv";
$need_to_fix_roughcut = true;
break;
case entry::ENTRY_MEDIA_TYPE_IMAGE:
$template_file = "&deleted_image.jpg";
$need_to_fix_roughcut = false;
// no need to add a batch job for images
break;
case entry::ENTRY_MEDIA_TYPE_VIDEO:
$template_file = "&deleted_video.flv";
$need_to_fix_roughcut = true;
break;
case entry::ENTRY_MEDIA_TYPE_LIVE_STREAM_FLASH:
case entry::ENTRY_MEDIA_TYPE_LIVE_STREAM_WINDOWS_MEDIA:
case entry::ENTRY_MEDIA_TYPE_LIVE_STREAM_REAL_MEDIA:
case entry::ENTRY_MEDIA_TYPE_LIVE_STREAM_QUICKTIME:
kJobsManager::addProvisionDeleteJob(null, $entry);
break;
case entry::ENTRY_MEDIA_TYPE_SHOW:
default:
$template_file = "&deleted_rc.xml";
$need_to_fix_roughcut = false;
break;
}
// in this case we'll need some batch job to fix all related roughcuts for this entry
// use the batch_job mechanism to indicate there is a deleted entry to handle
if ($need_to_fix_roughcut) {
// Should use a different job type
// BatchJob::createDeleteEntryJob ( $entry );
}
$entry->putInCustomData("deleted_original_data", $entry->getData());
$entry->putInCustomData("deleted_original_thumb", $entry->getThumbnail());
$content_path = myContentStorage::getFSContentRootPath();
// Remarked by Tan-Tan 27/09/2010
// Handled by kObjectDeleteHandler
// $currentDataKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA); // replaced__getDataPath
// $currentDataEditKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT); // replaced__getDataPathEdit
// $currentThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB); // replaced__getThumbnailPath
$entry->setData($entry->getData());
// once to increment the verions
$entry->setData($template_file);
// the other to set the template
$entry->setThumbnail($entry->getThumbnail());
// once to increment the verions
$entry->setThumbnail($thumb_template_file);
// the other to set the template
// Remarked by Tan-Tan 27/09/2010
// Handled by kObjectDeleteHandler
// // move file so there will be no access to it
// $deleted_content = kFileSyncUtils::deleteSyncFileForKey($currentDataKey);
// $deleted_content .= "|" . kFileSyncUtils::deleteSyncFileForKey($currentDataEditKey,false); // for some entries there may not be an edit version
// $deleted_content .= "|" . kFileSyncUtils::deleteSyncFileForKey($currentThumbKey,false); // for some entries (empty mix / audio) there may not be a thumb FileSync
// Remarked by Tan-Tan 27/09/2010
// $deleted_content is always null anyway
// $entry->putInCustomData( "deleted_file_path" , $deleted_content ? $deleted_content : serialize($currentDataKey) ) ;
$entry->setStatus(entryStatus::DELETED);
$entry->setCategories("");
// make sure the moderation_status is set to moderation::MODERATION_STATUS_DELETE
$entry->setModerationStatus(moderation::MODERATION_STATUS_DELETE);
$entry->setModifiedAt(time());
$entry->save();
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_DELETE, $entry, null, null, null, null, $entry->getId());
}
示例11: checkForPendingLiveClips
public static function checkForPendingLiveClips(entry $entry)
{
if ($entry->getSource() != EntrySourceType::RECORDED_LIVE) {
KalturaLog::notice("Entry [" . $entry->getId() . "] is not a recorded live");
return;
}
$liveEntry = entryPeer::retrieveByPKNoFilter($entry->getRootEntryId());
if (!$liveEntry || $liveEntry->getStatus() == entryStatus::DELETED || !$liveEntry instanceof LiveEntry) {
KalturaLog::notice("Entry root [" . $entry->getRootEntryId() . "] is not a valid live entry");
return;
}
/* @var $liveEntry LiveEntry */
$pendingMediaEntries = $liveEntry->getAttachedPendingMediaEntries();
foreach ($pendingMediaEntries as $pendingMediaEntry) {
/* @var $pendingMediaEntry kPendingMediaEntry */
if ($pendingMediaEntry->getRequiredDuration() && $pendingMediaEntry->getRequiredDuration() > $entry->getLengthInMsecs()) {
KalturaLog::info("Pending entry [" . $pendingMediaEntry->getEntryId() . "] required duration [" . $pendingMediaEntry->getRequiredDuration() . "] while entry duration [" . $entry->getLengthInMsecs() . "] is too short");
continue;
}
$liveEntry->dettachPendingMediaEntry($pendingMediaEntry->getEntryId());
$pendingEntry = entryPeer::retrieveByPK($pendingMediaEntry->getEntryId());
if (!$pendingEntry) {
KalturaLog::info("Pending entry [" . $pendingMediaEntry->getEntryId() . "] not found");
continue;
}
$sourceAsset = assetPeer::retrieveOriginalByEntryId($entry->getId());
if (!$sourceAsset) {
$sourceAssets = assetPeer::retrieveReadyFlavorsByEntryId($entry->getId());
$sourceAsset = array_pop($sourceAssets);
}
if (!$sourceAsset) {
KalturaLog::info("Pending entry [" . $pendingMediaEntry->getEntryId() . "] source asset not found");
continue;
}
/* @var $sourceAsset flavorAsset */
$operationAttributes = new kClipAttributes();
$operationAttributes->setOffset($pendingMediaEntry->getOffset());
$operationAttributes->setDuration($pendingMediaEntry->getDuration());
$targetAsset = assetPeer::retrieveOriginalByEntryId($pendingMediaEntry->getEntryId());
if (!$targetAsset) {
$targetAsset = kFlowHelper::createOriginalFlavorAsset($entry->getPartnerId(), $pendingMediaEntry->getEntryId());
}
$targetAsset->setFileExt($sourceAsset->getFileExt());
$targetAsset->save();
$sourceSyncKey = $sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$targetSyncKey = $targetAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::createSyncFileLinkForKey($targetSyncKey, $sourceSyncKey);
$errDescription = '';
kBusinessPreConvertDL::decideAddEntryFlavor(null, $pendingMediaEntry->getEntryId(), $operationAttributes->getAssetParamsId(), $errDescription, $targetAsset->getId(), array($operationAttributes));
}
$liveEntry->save();
}
示例12: onEntryReady
/**
* @param entry $entry
*/
public static function onEntryReady(entry $entry)
{
if (!ContentDistributionPlugin::isAllowedPartner($entry->getPartnerId())) {
return true;
}
//no temp entries should be handled
if ($entry->getDisplayInSearch() == mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM && $entry->getReplacedEntryId()) {
return true;
}
$distributionProfiles = DistributionProfilePeer::retrieveByPartnerId($entry->getPartnerId());
foreach ($distributionProfiles as $distributionProfile) {
$entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $distributionProfile->getId());
if ($entryDistribution) {
KalturaLog::info("Found entry distribution object with id [" . $entryDistribution->getId() . "] for distrinution profle [" . $distributionProfile->getId() . "]");
self::onEntryDistributionUpdateRequired($entryDistribution);
continue;
}
if ($distributionProfile->getSubmitEnabled() == DistributionProfileActionStatus::AUTOMATIC) {
self::addEntryDistribution($entry, $distributionProfile, true);
}
}
return true;
}
示例13: enforceDelivery
/**
* Ensure the request for media arrived in a way approved by the partner.
* this may include restricting to a specific cdn, enforcing token usage etc..
* Die in case of a breach.
*
* @param entry $entry
* @param asset $asset
*/
public static function enforceDelivery($entry, $asset = null)
{
// block inactive partner
$partnerId = $entry->getPartnerId();
self::blockInactivePartner($partnerId);
// validate serve access control
$flavorParamsId = $asset ? $asset->getFlavorParamsId() : null;
$secureEntryHelper = new KSecureEntryHelper($entry, null, null, ContextType::SERVE);
$secureEntryHelper->validateForServe($flavorParamsId);
// enforce delivery
$partner = PartnerPeer::retrieveByPK($partnerId);
// Note: Partner was already loaded by blockInactivePartner, no need to check for null
$restricted = DeliveryProfilePeer::isRequestRestricted($partner);
if ($restricted) {
KalturaLog::log("DELIVERY_METHOD_NOT_ALLOWED partner [{$partnerId}]");
KExternalErrors::dieError(KExternalErrors::DELIVERY_METHOD_NOT_ALLOWED);
}
}
示例14: decideThumbGenerate
/**
* decideThumbGenerate is the decision layer for a single thumbnail generation
*
* @param entry $entry
* @param thumbParams $destThumbParams
* @param BatchJob $parentJob
* @return thumbAsset
*/
public static function decideThumbGenerate(entry $entry, thumbParams $destThumbParams, BatchJob $parentJob = null, $sourceAssetId = null, $runSync = false, $srcAsset = null)
{
if (is_null($srcAsset)) {
$srcAsset = self::getSourceAssetForGenerateThumbnail($sourceAssetId, $destThumbParams->getSourceParamsId(), $entry->getId());
if (is_null($srcAsset)) {
throw new APIException(APIErrors::FLAVOR_ASSET_IS_NOT_READY);
}
}
$errDescription = null;
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($srcAsset->getId());
$destThumbParamsOutput = self::validateThumbAndMediaInfo($destThumbParams, $mediaInfo, $errDescription);
if ($srcAsset->getType() == assetType::FLAVOR && is_null($destThumbParamsOutput->getVideoOffset())) {
$destThumbParamsOutput->setVideoOffset($entry->getThumbOffset());
}
$destThumbParamsOutput->setVideoOffset(min($destThumbParamsOutput->getVideoOffset(), $entry->getDuration()));
if (!$destThumbParamsOutput->getDensity()) {
$partner = $entry->getPartner();
if (!is_null($partner)) {
$destThumbParamsOutput->setDensity($partner->getDefThumbDensity());
}
}
$thumbAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $destThumbParams->getId());
if ($thumbAsset) {
$description = $thumbAsset->getDescription() . "\n" . $errDescription;
$thumbAsset->setDescription($description);
} else {
$thumbAsset = new thumbAsset();
$thumbAsset->setPartnerId($entry->getPartnerId());
$thumbAsset->setEntryId($entry->getId());
$thumbAsset->setDescription($errDescription);
$thumbAsset->setFlavorParamsId($destThumbParams->getId());
}
$thumbAsset->incrementVersion();
$thumbAsset->setTags($destThumbParamsOutput->getTags());
$thumbAsset->setFileExt($destThumbParamsOutput->getFileExt());
if ($thumbAsset->getStatus() != asset::ASSET_STATUS_READY) {
$thumbAsset->setStatus(asset::ASSET_STATUS_CONVERTING);
}
//Sets the default thumb if this the only default thumb
kBusinessPreConvertDL::setIsDefaultThumb($thumbAsset);
if (!$destThumbParamsOutput) {
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
$thumbAsset->save();
return null;
}
$thumbAsset->save();
// save flavor params
$destThumbParamsOutput->setPartnerId($entry->getPartnerId());
$destThumbParamsOutput->setEntryId($entry->getId());
$destThumbParamsOutput->setFlavorAssetId($thumbAsset->getId());
$destThumbParamsOutput->setFlavorAssetVersion($thumbAsset->getVersion());
$destThumbParamsOutput->save();
$srcSyncKey = $srcAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$srcAssetType = $srcAsset->getType();
if (!$runSync) {
$job = kJobsManager::addCapturaThumbJob($parentJob, $entry->getPartnerId(), $entry->getId(), $thumbAsset->getId(), $srcSyncKey, $srcAsset->getId(), $srcAssetType, $destThumbParamsOutput);
return $thumbAsset;
}
$errDescription = null;
// Since this method is called when trying to crop an existing thumbnail, need to add this check - thumbAssets have no mediaInfo.
$capturedPath = self::generateThumbnail($srcAsset, $destThumbParamsOutput, $errDescription, $mediaInfo ? $mediaInfo->getVideoRotation() : null);
// failed
if (!$capturedPath) {
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
$thumbAsset->setDescription($thumbAsset->getDescription() . "\n{$errDescription}");
$thumbAsset->save();
return $thumbAsset;
}
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_READY);
if (file_exists($capturedPath)) {
list($width, $height, $type, $attr) = getimagesize($capturedPath);
$thumbAsset->setWidth($width);
$thumbAsset->setHeight($height);
$thumbAsset->setSize(filesize($capturedPath));
}
$logPath = $capturedPath . '.log';
if (file_exists($logPath)) {
$thumbAsset->incLogFileVersion();
$thumbAsset->save();
// creats the file sync
$logSyncKey = $thumbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
kFileSyncUtils::moveFromFile($logPath, $logSyncKey);
KalturaLog::debug("Log archived file to: " . kFileSyncUtils::getLocalFilePathForKey($logSyncKey));
} else {
$thumbAsset->save();
}
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::moveFromFile($capturedPath, $syncKey);
KalturaLog::debug("Thumbnail archived file to: " . kFileSyncUtils::getLocalFilePathForKey($syncKey));
if ($thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
//.........这里部分代码省略.........
示例15: entryDeleted
/**
* @param entry $entry
*/
protected function entryDeleted(entry $entry)
{
$this->syncableDeleted($entry->getId(), FileSyncObjectType::ENTRY);
// delete flavor assets
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $entry->getId());
$c->add(assetPeer::STATUS, asset::FLAVOR_ASSET_STATUS_DELETED, Criteria::NOT_EQUAL);
$c->add(assetPeer::DELETED_AT, null, Criteria::ISNULL);
$assets = assetPeer::doSelect($c);
foreach ($assets as $asset) {
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_DELETED);
$asset->setDeletedAt(time());
$asset->save();
}
$c = new Criteria();
$c->add(assetParamsOutputPeer::ENTRY_ID, $entry->getId());
$c->add(assetParamsOutputPeer::DELETED_AT, null, Criteria::ISNULL);
$flavorParamsOutputs = assetParamsOutputPeer::doSelect($c);
foreach ($flavorParamsOutputs as $flavorParamsOutput) {
$flavorParamsOutput->setDeletedAt(time());
$flavorParamsOutput->save();
}
$filter = new categoryEntryFilter();
$filter->setEntryIdEqual($entry->getId());
$c = new Criteria();
$c->add(categoryEntryPeer::ENTRY_ID, $entry->getId());
if (!categoryEntryPeer::doSelectOne($c)) {
return;
}
kJobsManager::addDeleteJob($entry->getPartnerId(), DeleteObjectType::CATEGORY_ENTRY, $filter);
}