本文整理汇总了PHP中entry::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::setStatus方法的具体用法?PHP entry::setStatus怎么用?PHP entry::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::setStatus方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: attachRemoteStorageResource
/**
* @param IRemoteStorageResource $resource
* @param entry $dbEntry
* @param asset $dbAsset
* @return asset
* @throws KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED
* @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
*/
protected function attachRemoteStorageResource(IRemoteStorageResource $resource, entry $dbEntry, asset $dbAsset = null)
{
$resources = $resource->getResources();
$fileExt = $resource->getFileExt();
$dbEntry->setSource(KalturaSourceType::URL);
// TODO - move image handling to media service
if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
foreach ($resources as $currentResource) {
$storageProfile = StorageProfilePeer::retrieveByPK($currentResource->getStorageProfileId());
$fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $currentResource->getUrl(), $storageProfile);
}
$dbEntry->setStatus(entryStatus::READY);
$dbEntry->save();
return null;
}
$dbEntry->save();
$isNewAsset = false;
if (!$dbAsset) {
$isNewAsset = true;
$dbAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId());
}
if (!$dbAsset) {
KalturaLog::err("Flavor asset not created for entry [" . $dbEntry->getId() . "]");
if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
$dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
$dbEntry->save();
}
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED);
}
$syncKey = $dbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
foreach ($resources as $currentResource) {
$storageProfile = StorageProfilePeer::retrieveByPK($currentResource->getStorageProfileId());
$fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $currentResource->getUrl(), $storageProfile);
}
$dbAsset->setFileExt($fileExt);
if ($dbAsset instanceof flavorAsset && !$dbAsset->getIsOriginal()) {
$dbAsset->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
}
$dbAsset->save();
if ($isNewAsset) {
kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
}
kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAsset));
if ($dbAsset instanceof flavorAsset && !$dbAsset->getIsOriginal()) {
kBusinessPostConvertDL::handleConvertFinished(null, $dbAsset);
}
return $dbAsset;
}
示例4: handleEntry
//.........这里部分代码省略.........
}
}
$thumbFullPath = $thumbTempPrefix . $entry_thumbNum . '.jpg';
// if we arrived here both entry and thumbnail are valid we can now update the db
// in order to have the final entry_id and move its data to its final destination
if ($onlyExtractThumb) {
return $thumbFullPath;
}
}
$entry->setkshowId($this->kshow_id);
$entry->setKuserId($kuser_id);
$entry->setCreatorKuserId($kuser_id);
if ($this->partner_id != null) {
$entry->setPartnerId($this->partner_id);
$entry->setSubpId($this->subp_id);
}
$entry->setName($name ? $name : $this->getParam('entry_name'));
// $entry->setDescription('');//$this->getParam('entry_description'));
$entry->setType($type);
$entry->setMediaType($media_type);
$entry->setTags($tags ? $tags : $this->getParam('entry_tags'));
$entry->setSource($media_source);
$entry->setSourceId($this->getParam('entry_media_id'));
if ($media_date) {
$entry->setMediaDate($media_date);
}
// if source_link wasnt given use the entry_url HOWEVER, use it only if id doesnt contain @ which suggests the use of a password
$entry->setSourceLink($entry_source_link ? $entry_source_link : (strstr($entry_url, '@') ? "" : $entry_url));
if ($media_source == entry::ENTRY_MEDIA_SOURCE_FILE) {
$entry->setSourceLink("file:{$entry_fullPath}");
}
$entry->setLicenseType($this->getParam('entry_license'));
$entry->setCredit($this->getParam('entry_credit'));
$entry->setStatus($entry_status);
if ($duration !== null) {
$entry->setLengthInMsecs($duration);
}
if ($this->entry_id == 0) {
$entry->save();
$this->entry_id = $entry->getId();
}
// move thumb to final destination and set db entry
if ($media_type != entry::ENTRY_MEDIA_TYPE_AUDIO && $entry_thumbNum && $need_thumb) {
KalturaLog::debug("handleEntry: saving none audio thumb [{$thumbBigFullPath}]");
$entry->setThumbnail('.jpg');
if ($thumbBigFullPath) {
if ($media_type != entry::ENTRY_MEDIA_TYPE_IMAGE) {
myFileConverter::convertImage($thumbBigFullPath, $thumbFullPath);
}
/*$thumbBigFinalPath = $content.$entry->getBigThumbnailPath();
myContentStorage::moveFile($thumbBigFullPath, $thumbBigFinalPath, true , $should_copy );
*/
$entryThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
try {
if (!$should_copy) {
kFileSyncUtils::moveFromFile($thumbBigFullPath, $entryThumbKey);
} else {
kFileSyncUtils::copyFromFile($thumbBigFullPath, $entryThumbKey);
}
} catch (Exception $e) {
$entry->setStatus(entryStatus::ERROR_CONVERTING);
$entry->save();
throw $e;
}
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:67,代码来源:myInsertEntryHelper.class.php
示例5: addConvertProfileJob
/**
* @param BatchJob $batchJob
* @param entry $entry
* @param string $flavorAssetId
* @param string $inputFileSyncLocalPath
* @return BatchJob
*/
public static function addConvertProfileJob(BatchJob $parentJob = null, entry $entry, $flavorAssetId, $inputFileSyncLocalPath)
{
KalturaLog::debug("Parent job [" . ($parentJob ? $parentJob->getId() : 'none') . "] entry [" . $entry->getId() . "] flavor asset [{$flavorAssetId}] input file [{$inputFileSyncLocalPath}]");
if ($entry->getConversionQuality() == conversionProfile2::CONVERSION_PROFILE_NONE) {
$entry->setStatus(entryStatus::PENDING);
$entry->save();
KalturaLog::notice('Entry should not be converted');
return null;
}
$importingSources = false;
// if file size is 0, do not create conversion profile and set entry status as error converting
if (!file_exists($inputFileSyncLocalPath) || kFile::fileSize($inputFileSyncLocalPath) == 0) {
KalturaLog::debug("Input file [{$inputFileSyncLocalPath}] does not exist");
$partner = $entry->getPartner();
$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);
//.........这里部分代码省略.........
示例6: 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);
}
示例7: 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);
//.........这里部分代码省略.........
示例8: addConvertProfileJob
/**
* @param BatchJob $batchJob
* @param entry $entry
* @param string $flavorAssetId
* @param string $inputFileSyncLocalPath
* @return BatchJob
*/
public static function addConvertProfileJob(BatchJob $parentJob = null, entry $entry, $flavorAssetId, $inputFileSyncLocalPath)
{
// if file size is 0, do not create conversion profile and set entry status as error converting
if (filesize($inputFileSyncLocalPath) == 0) {
$entry->setStatus(entryStatus::ERROR_CONVERTING);
$entry->save();
$flavorAsset = flavorAssetPeer::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;
}
if ($entry->getConversionQuality() == conversionProfile2::CONVERSION_PROFILE_NONE) {
$entry->setStatus(entryStatus::PENDING);
$entry->save();
KalturaLog::notice('Entry should not be converted');
return null;
}
if ($entry->getStatus() != entryStatus::READY) {
$entry->setStatus(entryStatus::PRECONVERT);
$entry->save();
}
$jobData = new kConvertProfileJobData();
$jobData->setFlavorAssetId($flavorAssetId);
$jobData->setInputFileSyncLocalPath($inputFileSyncLocalPath);
$jobData->setExtractMedia(true);
if ($entry->getType() != entryType::MEDIA_CLIP) {
$jobData->setExtractMedia(false);
$jobData->setCreateThumb(false);
}
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild();
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($entry->getId());
$batchJob->setPartnerId($entry->getPartnerId());
}
return self::addJob($batchJob, $jobData, BatchJobType::CONVERT_PROFILE);
}