本文整理汇总了PHP中entry::save方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::save方法的具体用法?PHP entry::save怎么用?PHP entry::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->akshowRelatedByKshowId !== null) {
if ($this->akshowRelatedByKshowId->isModified() || $this->akshowRelatedByKshowId->isNew()) {
$affectedRows += $this->akshowRelatedByKshowId->save($con);
}
$this->setkshowRelatedByKshowId($this->akshowRelatedByKshowId);
}
if ($this->aentry !== null) {
if ($this->aentry->isModified() || $this->aentry->isNew()) {
$affectedRows += $this->aentry->save($con);
}
$this->setentry($this->aentry);
}
if ($this->akshowRelatedByKuserId !== null) {
if ($this->akshowRelatedByKuserId->isModified() || $this->akshowRelatedByKuserId->isNew()) {
$affectedRows += $this->akshowRelatedByKuserId->save($con);
}
$this->setkshowRelatedByKuserId($this->akshowRelatedByKuserId);
}
if ($this->isNew()) {
$this->modifiedColumns[] = kvotePeer::ID;
}
// If this object has been modified, then save it to the database.
$this->objectSaved = false;
if ($this->isModified()) {
if ($this->isNew()) {
$pk = kvotePeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
$this->objectSaved = true;
} else {
$affectedObjects = kvotePeer::doUpdate($this, $con);
if ($affectedObjects) {
$this->objectSaved = true;
}
$affectedRows += $affectedObjects;
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例2: syncEntryEntitlementInfo
public function syncEntryEntitlementInfo(entry $vodEntry, LiveEntry $liveEntry)
{
$entitledPusersEdit = $liveEntry->getEntitledPusersEdit();
$entitledPusersPublish = $liveEntry->getEntitledPusersPublish();
if (!$entitledPusersEdit && !$entitledPusersPublish) {
return;
}
if ($entitledPusersEdit) {
$vodEntry->setEntitledPusersEdit($entitledPusersEdit);
}
if ($entitledPusersPublish) {
$vodEntry->setEntitledPusersPublish($entitledPusersPublish);
}
$vodEntry->save();
}
示例3: executeImpl
protected function executeImpl(kshow $kshow, entry &$entry)
{
$this->res = "";
$likuser_id = $this->getLoggedInUserId();
if ($likuser_id != $entry->getKuserId()) {
// ERROR - attempting to update an entry which doesnt belong to the user
return "<xml>!</xml>";
//$this->securityViolation( $kshow->getId() );
}
$name = @$_GET["RoughcutName"];
$entry->setName($name);
$entry->save();
//myEntryUtils::createWidgetImage($entry, false);
$this->name = $name;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:15,代码来源:setRoughcutNameAction.class.php
示例4: postInsert
public function postInsert(PropelPDO $con = null)
{
parent::postInsert($con);
if (!$this->getFeedId() || !$this->getId()) {
return;
}
$syndicationFeed = syndicationFeedPeer::retrieveByPK($this->getFeedId());
if (!$syndicationFeed || !$syndicationFeed instanceof genericSyndicationFeed) {
return;
}
// "Creates advanced filter on distribution profile
$distributionAdvancedSearch = new ContentDistributionSearchFilter();
$distributionAdvancedSearch->setDistributionProfileId($this->getId());
$distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
$distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
$distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE);
//Creates entry filter with advanced filter
$entryFilter = new entryFilter();
$entryFilter->setPartnerIdEquel($this->getPartnerId());
$entryFilter->setAdvancedSearch($distributionAdvancedSearch);
// Creates playlist with entry filter
$playlistXml = new SimpleXMLElement("<playlist/>");
$filtersXml = $playlistXml->addChild("filters");
$filterXml = $filtersXml->addChild("filter");
$entryFilter->toXml($filterXml);
$playlistContent = $playlistXml->asXML();
// creates playlist based on the filter XML
$playlist = new entry();
$playlist->setKuserId(kCurrentContext::$uid);
$playlist->setCreatorKuserId(kCurrentContext::$uid);
$playlist->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM);
$playlist->setPartnerId($this->getPartnerId());
$playlist->setStatus(entryStatus::READY);
$playlist->setKshowId(null);
$playlist->setType(entryType::PLAYLIST);
$playlist->setMediaType(entry::ENTRY_MEDIA_TYPE_XML);
$playlist->setDataContent($playlistContent);
$playlist->save();
KalturaLog::log("Playlist [" . $playlist->getId() . "] created");
// creates feed based on the playlist
$syndicationFeed->setPlaylistId($playlist->getId());
$syndicationFeed->save();
}
示例5: attachRemoteAssetResource
protected function attachRemoteAssetResource(entry $entry, kDistributionSubmitJobData $data)
{
$distributionProfile = DistributionProfilePeer::retrieveByPK($data->getDistributionProfileId());
/* @var $distributionProfile UnicornDistributionProfile */
$domainGuid = $distributionProfile->getDomainGuid();
$applicationGuid = $distributionProfile->getAdFreeApplicationGuid();
$assetParamsId = $distributionProfile->getRemoteAssetParamsId();
$mediaItemGuid = $data->getRemoteId();
$url = "{$domainGuid}/{$applicationGuid}/{$mediaItemGuid}/content.m3u8";
$entry->setSource(KalturaSourceType::URL);
$entry->save();
$isNewAsset = false;
$asset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $assetParamsId);
if (!$asset) {
$isNewAsset = true;
$assetParams = assetParamsPeer::retrieveByPK($assetParamsId);
$asset = assetPeer::getNewAsset($assetParams->getType());
$asset->setPartnerId($entry->getPartnerId());
$asset->setEntryId($entry->getId());
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
$asset->setFlavorParamsId($assetParamsId);
$asset->setFromAssetParams($assetParams);
if ($assetParams->hasTag(assetParams::TAG_SOURCE)) {
$asset->setIsOriginal(true);
}
}
$asset->incrementVersion();
$asset->setFileExt('m3u8');
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
$asset->save();
$syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$storageProfile = StorageProfilePeer::retrieveByPK($distributionProfile->getStorageProfileId());
$fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $url, $storageProfile);
if ($isNewAsset) {
kEventsManager::raiseEvent(new kObjectAddedEvent($asset));
}
kEventsManager::raiseEvent(new kObjectDataChangedEvent($asset));
kBusinessPostConvertDL::handleConvertFinished(null, $asset);
}
示例6: entryHandled
public function entryHandled(entry $dbEntry)
{
$srcEntry = entryPeer::retrieveByPK($this->entryId);
if ($srcEntry->getType() == KalturaEntryType::MEDIA_CLIP && $dbEntry->getType() == KalturaEntryType::MEDIA_CLIP && $dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$dbEntry->setDimensions($srcEntry->getWidth(), $srcEntry->getHeight());
$dbEntry->setMediaDate($srcEntry->getMediaDate(null));
$dbEntry->save();
} else {
$srcFlavorAsset = null;
if (is_null($this->flavorParamsId)) {
$srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($this->entryId);
} else {
$srcFlavorAsset = assetPeer::retrieveByEntryIdAndParams($this->entryId, $this->flavorParamsId);
}
if ($srcFlavorAsset) {
$dbEntry->setDimensions($srcFlavorAsset->getWidth(), $srcFlavorAsset->getHeight());
$dbEntry->save();
}
}
}
return parent::entryHandled($dbEntry);
}
示例7: createFriendsMakeover
public static function createFriendsMakeover($subp_id, $puser_id, $puser_ids)
{
list($kshow_id, $roughcut_entry) = self::getFriendsMakover($subp_id, $puser_id);
if (!$kshow_id) {
return array(0, 0, 0);
}
$kshow = kshowPeer::retrieveByPK($kshow_id);
if (!$roughcut_entry) {
$roughcut_entry = new entry();
$roughcut_entry->setKshowId($kshow->getId());
$roughcut_entry->setKuserId($kshow->getProducerId());
$roughcut_entry->setCreatorKuserId($kshow->getProducerId());
$roughcut_entry->setPartnerId($kshow->getPartnerId());
$roughcut_entry->setSubpId($kshow->getSubpId());
$roughcut_entry->setStatus(entryStatus::READY);
$roughcut_entry->setThumbnail("&kal_show.jpg");
$roughcut_entry->setType(entryType::MIX);
$roughcut_entry->setMediaType(entry::ENTRY_MEDIA_TYPE_SHOW);
$roughcut_entry->setName("Kaltura Video");
$roughcut_entry->setTags("");
$roughcut_entry->save();
}
list($entry_ids, $entry_puser_ids) = self::getMakeoverEntries($subp_id, $puser_id, $puser_ids);
$custom_data = implode(",", $entry_puser_ids);
if ($roughcut_entry->getFromCustomData("facelift", $subp_id) == $custom_data) {
// if the users list didnt change use the current roughcut
return array($kshow_id, $roughcut_entry->getId(), 0);
}
$c = new Criteria();
$c->add(entryPeer::ID, $entry_ids, Criteria::IN);
$entries = entryPeer::doSelect($c);
self::createKEditorMetadata($kshow, $roughcut_entry, $entries);
$roughcut_entry->putInCustomData("facelift", $custom_data, $subp_id);
$roughcut_entry->save();
return array($kshow_id, $roughcut_entry->getId(), 1);
}
示例8: replaceEntry
/**
* @param entry $entry
* @param entry $tempEntry
*/
public static function replaceEntry(entry $entry, entry $tempEntry = null)
{
if (!$tempEntry) {
$tempEntry = entryPeer::retrieveByPK($entry->getReplacingEntryId());
}
if (!$tempEntry) {
KalturaLog::err("Temp entry id [" . $entry->getReplacingEntryId() . "] not found");
return;
}
//Extract all assets of the temp entry
$tempAssets = assetPeer::retrieveByEntryId($tempEntry->getId());
//Extract all assets of the existing entry
$oldAssets = assetPeer::retrieveByEntryId($entry->getId());
$newAssets = array();
//Loop which creates a mapping between the new assets' paramsId and their type to the asset itself
foreach ($tempAssets as $newAsset) {
if ($newAsset->getStatus() != asset::FLAVOR_ASSET_STATUS_READY) {
KalturaLog::info("Do not add new asset [" . $newAsset->getId() . "] to flavor [" . $newAsset->getFlavorParamsId() . "] status [" . $newAsset->getStatus() . "]");
continue;
}
//If doesn't exist - create a new array for the current asset's type.
if (!isset($newAssets[$newAsset->getType()])) {
$newAssets[$newAsset->getType()] = array();
}
if ($newAsset->getFlavorParamsId() || $newAsset instanceof flavorAsset) {
$newAssets[$newAsset->getType()][$newAsset->getFlavorParamsId()] = $newAsset;
KalturaLog::info("Added new asset [" . $newAsset->getId() . "] for asset params [" . $newAsset->getFlavorParamsId() . "]");
} else {
$newAssets[$newAsset->getType()]['asset_' . count($newAssets[$newAsset->getType()])] = $newAsset;
KalturaLog::info("Added new asset [" . $newAsset->getId() . "] with no asset params");
}
}
$defaultThumbAssetNew = null;
$defaultThumbAssetOld = null;
foreach ($oldAssets as $oldAsset) {
/* @var $oldAsset asset */
//If the newAssets map contains an asset of the same type and paramsId as the current old asset,
// re-link the old asset to the new asset.
if (isset($newAssets[$oldAsset->getType()]) && isset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()])) {
$newAsset = $newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()];
if ($oldAsset->hasTag(assetParams::TAG_RECORDING_ANCHOR)) {
$newAsset->addTags(array(assetParams::TAG_RECORDING_ANCHOR));
}
/* @var $newAsset asset */
KalturaLog::info("Create link from new asset [" . $newAsset->getId() . "] to old asset [" . $oldAsset->getId() . "] for flavor [" . $oldAsset->getFlavorParamsId() . "]");
$oldAsset->linkFromAsset($newAsset);
$oldAsset->save();
self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_ISM);
self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_MPD);
$newFlavorMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($newAsset->getId());
if ($newFlavorMediaInfo) {
$oldFlavorNewMediaInfo = $newFlavorMediaInfo->copy();
$oldFlavorNewMediaInfo->setFlavorAssetId($oldAsset->getId());
$oldFlavorNewMediaInfo->setFlavorAssetVersion($oldAsset->getVersion());
$oldFlavorNewMediaInfo->save();
}
unset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()]);
if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $oldAsset;
KalturaLog::info("Nominating ThumbAsset [" . $oldAsset->getId() . "] as the default ThumbAsset after replacent");
}
} elseif ($oldAsset instanceof flavorAsset || $oldAsset instanceof thumbAsset) {
if ($oldAsset instanceof thumbAsset && $oldAsset->keepOnEntryReplacement()) {
KalturaLog::info("KeepManualThumbnails ind is set, manual thumbnail is not deleted [" . $oldAsset->getId() . "]");
if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetOld = $oldAsset;
}
} else {
KalturaLog::info("Delete old asset [" . $oldAsset->getId() . "] for paramsId [" . $oldAsset->getFlavorParamsId() . "]");
$oldAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
$oldAsset->setDeletedAt(time());
$oldAsset->save();
}
}
}
foreach ($newAssets as $newAssetsByTypes) {
foreach ($newAssetsByTypes as $newAsset) {
$createdAsset = $newAsset->copyToEntry($entry->getId(), $entry->getPartnerId());
KalturaLog::info("Copied from new asset [" . $newAsset->getId() . "] to copied asset [" . $createdAsset->getId() . "] for flavor [" . $newAsset->getFlavorParamsId() . "]");
if ($createdAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $newAsset;
KalturaLog::info("Nominating ThumbAsset [" . $newAsset->getId() . "] as the default ThumbAsset after replacent");
}
}
}
if ($defaultThumbAssetOld) {
KalturaLog::info("Kepping ThumbAsset [" . $defaultThumbAssetOld->getId() . "] as the default ThumbAsset");
} elseif ($defaultThumbAssetNew) {
kBusinessConvertDL::setAsDefaultThumbAsset($defaultThumbAssetNew);
KalturaLog::info("Setting ThumbAsset [" . $defaultThumbAssetNew->getId() . "] as the default ThumbAsset");
} else {
KalturaLog::info("No default ThumbAsset found for replacing entry [" . $tempEntry->getId() . "]");
$entry->setThumbnail(".jpg");
// thumbnailversion++
//.........这里部分代码省略.........
示例9: index
public static function index(entry $entry)
{
$categoriesWithNoPrivacyContext = $entry->getCategoriesWithNoPrivacyContext();
$categoriesFullName = array();
$categoriesIds = array();
foreach ($categoriesWithNoPrivacyContext as $category) {
$categoriesFullName[] = $category->getFullName();
$categoriesIds[] = $category->getId();
}
$entry->parentSetCategories(implode(',', $categoriesFullName));
$entry->parentsetCategoriesIds(implode(',', $categoriesIds));
if (!$entry->save()) {
$entry->indexToSearchIndex();
}
return $entry->getIntId();
}
示例10: createEntry
/**
* This helps create special entries in a kshow - the show_entry & intro
* $type can be either entry::ENTRY_MEDIA_TYPE_SHOW (for the show_entry) or entry::ENTRY_MEDIA_TYPE_VIDEO (for the intro)
*/
public function createEntry($type, $kuser_id, $thumbnail = null, $entry_name = null)
{
// for invites we use the default invites from the kaltura gallery show
if ($type != entry::ENTRY_MEDIA_TYPE_SHOW) {
$kshow_type = $this->getType();
$intros = array(kshow::KSHOW_TYPE_MASHUP, kshow::KSHOW_TYPE_MUSIC_VIDEO, kshow::KSHOW_TYPE_HOWTO, kshow::KSHOW_TYPE_CALL_FOR_ACTION, kshow::KSHOW_TYPE_CONTEST, kshow::KSHOW_TYPE_GROUP_GREETING, kshow::KSHOW_TYPE_SPORTS, kshow::KSHOW_TYPE_DIGITAL_STORY, kshow::KSHOW_TYPE_GROUP_TRAVELOGUE);
$id = 0;
if (in_array($kshow_type, $intros)) {
$id = $kshow_type;
}
$id = 120 + $id;
$entry = entryPeer::retrieveByPK($id);
if ($entry) {
$this->setIntroId($entry->getId());
$this->m_intro = $entry;
}
return $entry;
}
$kshow = $this;
$entry = new entry();
$entry->setKshowId($kshow->getId());
$entry->setKuserId($kuser_id);
$entry->setCreatorKuserId($kuser_id);
if ($this->getPartnerId() !== null) {
$entry->setPartnerId($this->getPartnerId());
}
// inherit partner_id from kshow
if ($this->getSubpId() !== null) {
$entry->setSubpId($this->getSubpId());
}
// inherit subp_id from kshow
$entry->setStatus(entryStatus::READY);
if ($entry_name) {
$type_text = $entry_name;
} else {
$type_text = "Kaltura Video";
}
//$entry->setData ( "&kal_show.flv");
$entry->setThumbnail($thumbnail ? $thumbnail : "&kal_show.jpg");
$entry->setCreateThumb(false);
$entry->setType(entryType::MIX);
$entry->setMediaType(entry::ENTRY_MEDIA_TYPE_SHOW);
$entry->setEditorType(myMetadataUtils::METADATA_EDITOR_SIMPLE);
$entry->setName($type_text);
$entry->setTags($type_text . "," . $kshow->getTags());
$entry->save();
$this->setShowEntryId($entry->getId());
$this->m_show_entry = $entry;
return $entry;
}
示例11: 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)) {
//.........这里部分代码省略.........
示例12: deleteReplacingEntry
public static function deleteReplacingEntry(entry $recordedEntry, entry $replacingEntry)
{
self::deleteEntry($replacingEntry);
$recordedEntry->setReplacingEntryId(null);
$recordedEntry->setReplacementStatus(entryReplacementStatus::NONE);
$recordedEntry->save();
}
示例13: executeImpl
protected function executeImpl(kshow $kshow, entry &$entry)
{
$this->res = "";
$likuser_id = $this->getLoggedInUserId();
// if we allow multiple rouchcuts - there is no reason for one suer to override someone else's thumbnail
if ($this->allowMultipleRoughcuts()) {
if ($likuser_id != $entry->getKuserId()) {
// ERROR - attempting to update an entry which doesnt belong to the user
return "<xml>!!</xml>";
//$this->securityViolation( $kshow->getId() );
}
}
$debug = @$_GET["debug"];
/*
$kshow_id = @$_GET["kshow_id"];
$debug = @$_GET["debug"];
$this->kshow_id = $kshow_id;
if ( $kshow_id == NULL || $kshow_id == 0 ) return;
$kshow = kshowPeer::retrieveByPK( $kshow_id );
if ( ! $kshow )
{
$this->res = "No kshow " . $kshow_id ;
return;
}
// is the logged-in-user is not an admin or the producer - check if show can be published
$likuser_id = $this->getLoggedInUserId();
$viewer_type = myKshowUtils::getViewerType($kshow, $likuser_id);
if ( $viewer_type != KshowKuser::KSHOWKUSER_VIEWER_PRODUCER && ( ! $kshow->getCanPublish() ) )
{
// ERROR - attempting to publish a non-publishable show
return "<xml>!</xml>";//$this->securityViolation( $kshow->getId() );
}
// ASSUME - the kshow & roughcut already exist
$show_entry_id = $kshow->getShowEntryId();
$roughcut = entryPeer::retrieveByPK( $show_entry_id );
$roughcut = entryPeer::retrieveByPK( $entry_id );
if ( ! $roughcut)
{
$this->res = "No roughcut for kshow " . $kshow->getId() ;
return;
}
*/
// echo "for entry: $show_entry_id current thumb path: " . $entry->getThumbnail() ;
$entry->setThumbnail(".jpg");
$entry->setCreateThumb(false);
$entry->save();
//$thumb_data = $_REQUEST["ThumbData"];
if (isset($HTTP_RAW_POST_DATA)) {
$thumb_data = $HTTP_RAW_POST_DATA;
} else {
$thumb_data = file_get_contents("php://input");
}
// $thumb_data = $GLOBALS["HTTP_RAW_POST_DATA"];
$thumb_data_size = strlen($thumb_data);
$bigThumbPath = myContentStorage::getFSContentRootPath() . $entry->getBigThumbnailPath();
kFile::fullMkdir($bigThumbPath);
kFile::setFileContent($bigThumbPath, $thumb_data);
$path = myContentStorage::getFSContentRootPath() . $entry->getThumbnailPath();
kFile::fullMkdir($path);
myFileConverter::createImageThumbnail($bigThumbPath, $path);
$roughcutPath = myContentStorage::getFSContentRootPath() . $entry->getDataPath();
$xml_doc = new KDOMDocument();
$xml_doc->load($roughcutPath);
if (myMetadataUtils::updateThumbUrl($xml_doc, $entry->getBigThumbnailUrl())) {
$xml_doc->save($roughcutPath);
}
$this->res = $entry->getBigThumbnailUrl();
}
示例14: replaceEntry
/**
* @param entry $entry
* @param entry $tempEntry
*/
public static function replaceEntry(entry $entry, entry $tempEntry = null)
{
KalturaLog::debug("in replaceEntry");
if (!$tempEntry) {
$tempEntry = entryPeer::retrieveByPK($entry->getReplacingEntryId());
}
if (!$tempEntry) {
KalturaLog::err("Temp entry id [" . $entry->getReplacingEntryId() . "] not found");
return;
}
//Extract all assets of the temp entry
$tempAssets = assetPeer::retrieveByEntryId($tempEntry->getId());
//Extract all assets of the existing entry
$oldAssets = assetPeer::retrieveByEntryId($entry->getId());
KalturaLog::debug("num of old assets: " . count($oldAssets));
$newAssets = array();
//Loop which creates a mapping between the new assets' paramsId and their type to the asset itself
foreach ($tempAssets as $newAsset) {
if ($newAsset->getStatus() != asset::FLAVOR_ASSET_STATUS_READY) {
KalturaLog::debug("Do not add new asset [" . $newAsset->getId() . "] to flavor [" . $newAsset->getFlavorParamsId() . "] status [" . $newAsset->getStatus() . "]");
continue;
}
//If doesn't exist - create a new array for the current asset's type.
if (!isset($newAssets[$newAsset->getType()])) {
$newAssets[$newAsset->getType()] = array();
}
if ($newAsset->getFlavorParamsId() || $newAsset instanceof flavorAsset) {
$newAssets[$newAsset->getType()][$newAsset->getFlavorParamsId()] = $newAsset;
KalturaLog::debug("Added new asset [" . $newAsset->getId() . "] for asset params [" . $newAsset->getFlavorParamsId() . "]");
} else {
$newAssets[$newAsset->getType()]['asset_' . count($newAssets[$newAsset->getType()])] = $newAsset;
KalturaLog::debug("Added new asset [" . $newAsset->getId() . "] with no asset params");
}
}
$saveEntry = false;
$defaultThumbAssetNew = null;
foreach ($oldAssets as $oldAsset) {
/* @var $oldAsset asset */
kFileSyncUtils::clearWAMSDataForKey($oldAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET));
//If the newAssets map contains an asset of the same type and paramsId as the current old asset,
// re-link the old asset to the new asset.
if (isset($newAssets[$oldAsset->getType()]) && isset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()])) {
$newAsset = $newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()];
/* @var $newAsset asset */
KalturaLog::debug("Create link from new asset [" . $newAsset->getId() . "] to old asset [" . $oldAsset->getId() . "] for flavor [" . $oldAsset->getFlavorParamsId() . "]");
if ($oldAsset instanceof flavorAsset) {
$oldAsset->setBitrate($newAsset->getBitrate());
$oldAsset->setFrameRate($newAsset->getFrameRate());
$oldAsset->setVideoCodecId($newAsset->getVideoCodecId());
}
$oldAsset->setWidth($newAsset->getWidth());
$oldAsset->setHeight($newAsset->getHeight());
$oldAsset->setContainerFormat($newAsset->getContainerFormat());
$oldAsset->setSize($newAsset->getSize());
$oldAsset->setFileExt($newAsset->getFileExt());
$oldAsset->setTags($newAsset->getTags());
$oldAsset->setDescription($newAsset->getDescription());
$oldAsset->incrementVersion();
$oldAsset->setStatusLocalReady();
$oldAsset->save();
$oldFileSync = $oldAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$newFileSync = $newAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::createSyncFileLinkForKey($oldFileSync, $newFileSync);
$newFlavorMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($newAsset->getId());
if ($newFlavorMediaInfo) {
$oldFlavorNewMediaInfo = $newFlavorMediaInfo->copy();
$oldFlavorNewMediaInfo->setFlavorAssetId($oldAsset->getId());
$oldFlavorNewMediaInfo->setFlavorAssetVersion($oldAsset->getVersion());
$oldFlavorNewMediaInfo->save();
}
unset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()]);
if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $oldAsset;
KalturaLog::debug("Nominating ThumbAsset [" . $oldAsset->getId() . "] as the default ThumbAsset after replacent");
}
} elseif ($oldAsset instanceof flavorAsset || $oldAsset instanceof thumbAsset) {
KalturaLog::debug("Delete old asset [" . $oldAsset->getId() . "] for paramsId [" . $oldAsset->getFlavorParamsId() . "]");
$oldAsset->setStatus(flavorAsset::ASSET_STATUS_DELETED);
$oldAsset->setDeletedAt(time());
$oldAsset->save();
$entry->removeFlavorParamsId($oldAsset->getFlavorParamsId());
$saveEntry = true;
}
}
foreach ($newAssets as $newAssetsByTypes) {
foreach ($newAssetsByTypes as $newAsset) {
$createdAsset = $newAsset->copyToEntry($entry->getId(), $entry->getPartnerId());
KalturaLog::debug("Copied from new asset [" . $newAsset->getId() . "] to copied asset [" . $createdAsset->getId() . "] for flavor [" . $newAsset->getFlavorParamsId() . "]");
if ($createdAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $newAsset;
KalturaLog::debug("Nominating ThumbAsset [" . $newAsset->getId() . "] as the default ThumbAsset after replacent");
}
}
}
if ($defaultThumbAssetNew) {
kBusinessConvertDL::setAsDefaultThumbAsset($defaultThumbAssetNew);
//.........这里部分代码省略.........
示例15: replaceResource
/**
* @param KalturaResource $resource
* @param entry $dbEntry
* @param int $conversionProfileId
*/
protected function replaceResource(KalturaResource $resource, entry $dbEntry, $conversionProfileId = null, $advancedOptions = null)
{
if ($advancedOptions) {
$dbEntry->setReplacementOptions($advancedOptions->toObject());
$dbEntry->save();
}
if ($dbEntry->getStatus() == KalturaEntryStatus::NO_CONTENT || $dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$resource->validateEntry($dbEntry);
if ($conversionProfileId) {
$dbEntry->setConversionQuality($conversionProfileId);
$dbEntry->save();
}
$kResource = $resource->toObject();
$this->attachResource($kResource, $dbEntry);
} else {
$kResource = $resource->toObject();
if ($kResource instanceof kOperationResource && $this->isResourceKClip($kResource)) {
$internalResource = $kResource->getResource();
if ($dbEntry->getIsTrimDisabled() && $internalResource instanceof kFileSyncResource && $dbEntry->getId() == $internalResource->getOriginEntryId()) {
throw new KalturaAPIException(KalturaErrors::ENTRY_CANNOT_BE_TRIMMED);
}
}
$tempMediaEntry = new KalturaMediaEntry();
$tempMediaEntry->type = $dbEntry->getType();
$tempMediaEntry->mediaType = $dbEntry->getMediaType();
if (!$conversionProfileId) {
$originalConversionProfileId = $dbEntry->getConversionQuality();
$conversionProfile = conversionProfile2Peer::retrieveByPK($originalConversionProfileId);
if (is_null($conversionProfile) || $conversionProfile->getType() != ConversionProfileType::MEDIA) {
$defaultConversionProfile = myPartnerUtils::getConversionProfile2ForPartner($this->getPartnerId());
if (!is_null($defaultConversionProfile)) {
$conversionProfileId = $defaultConversionProfile->getId();
}
} else {
$conversionProfileId = $originalConversionProfileId;
}
}
if ($conversionProfileId) {
$tempMediaEntry->conversionProfileId = $conversionProfileId;
}
$this->replaceResourceByEntry($dbEntry, $resource, $tempMediaEntry);
}
$resource->entryHandled($dbEntry);
}