本文整理汇总了PHP中assetPeer::retrieveFlavorsByEntryId方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveFlavorsByEntryId方法的具体用法?PHP assetPeer::retrieveFlavorsByEntryId怎么用?PHP assetPeer::retrieveFlavorsByEntryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveFlavorsByEntryId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reconvertEntry
private function reconvertEntry($entry_id, $conversion_profile_id, $job_priority)
{
$entry = entryPeer::retrieveByPK($entry_id);
$this->error = "";
if (!$entry) {
$error = "Cannot reconvert entry [{$entry_id}]. Might be a deleted entry";
return array($entry_id, null, null, $error);
}
$flavorAsset = assetPeer::retrieveOriginalByEntryId($entry_id);
if (!$flavorAsset) {
$flavorAsset = assetPeer::retrieveReadyWebByEntryId($entry_id);
if (!$flavorAsset) {
$flavorAssets = assetPeer::retrieveFlavorsByEntryId($entry_id);
if (!$flavorAssets) {
$error = "Cannot find good enough flavor asset to re-convert from";
return array($entry_id, $entry, null, $error);
}
$flavorAsset = $flavorAssets[0];
// choose the first one
}
}
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$filePath = kFileSyncUtils::getReadyLocalFilePathForKey($syncKey);
if (!$filePath) {
$error = "Cannot find a fileSync for the flavorAsset [" . $flavorAsset->getId() . "]";
return array($entry_id, $entry, null, $error);
}
$dbBatchJob = new BatchJob();
$dbBatchJob->setEntryId($entry_id);
$dbBatchJob->setPartnerId($entry->getPartnerId());
$dbBatchJob->setStatus(BatchJob::BATCHJOB_STATUS_PENDING);
$dbBatchJob->setDc(kDataCenterMgr::getCurrentDcId());
//$dbBatchJob->setPriority ( $job_priority ); Not supported anymore
$dbBatchJob->setObjectId($entry_id);
$dbBatchJob->setObjectType(BatchJobObjectType::ENTRY);
$dbBatchJob->setJobType(BatchJobType::CONVERT_PROFILE);
$dbBatchJob->save();
// creates a convert profile job
$convertProfileData = new kConvertProfileJobData();
$convertProfileData->setFlavorAssetId($flavorAsset->getId());
$convertProfileData->setInputFileSyncLocalPath($filePath);
kJobsManager::addJob($dbBatchJob, $convertProfileData, BatchJobType::CONVERT_PROFILE);
// save again afget the addJob
$dbBatchJob->save();
return array($entry_id, $entry, $dbBatchJob, $error);
}
示例2: decideAddEntryFlavor
/**
* batch decideAddEntryFlavor is the decision layer for adding a single flavor conversion to an entry
*
* @param BatchJob $parentJob
* @param int $entryId
* @param int $flavorParamsId
* @param string $errDescription
* @param string $flavorAssetId
* @param array<kOperationAttributes> $dynamicAttributes
* @return BatchJob
*/
public static function decideAddEntryFlavor(BatchJob $parentJob = null, $entryId, $flavorParamsId, &$errDescription, $flavorAssetId = null, array $dynamicAttributes = array())
{
KalturaLog::log("entryId [{$entryId}], flavorParamsId [{$flavorParamsId}]");
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (is_null($originalFlavorAsset)) {
$errDescription = 'Original flavor asset not found';
KalturaLog::err($errDescription);
return null;
}
if ($originalFlavorAsset->getId() != $flavorAssetId && !$originalFlavorAsset->isLocalReadyStatus()) {
$errDescription = 'Original flavor asset not ready';
KalturaLog::err($errDescription);
return null;
}
// TODO - if source flavor is remote storage, create import job and mark the flavor as FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT
$mediaInfoId = null;
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($originalFlavorAsset->getId());
if ($mediaInfo) {
$mediaInfoId = $mediaInfo->getId();
}
$flavorParams = assetParamsPeer::retrieveByPK($flavorParamsId);
if (!$flavorParams) {
KalturaLog::err("Flavor Params Id [{$flavorParamsId}] not found");
return null;
}
$flavorParams->setDynamicAttributes($dynamicAttributes);
$flavor = self::validateFlavorAndMediaInfo($flavorParams, $mediaInfo, $errDescription);
if (is_null($flavor)) {
KalturaLog::err("Failed to validate media info [{$errDescription}]");
return null;
}
if ($parentJob) {
// prefer the partner id from the parent job, although it should be the same
$partnerId = $parentJob->getPartnerId();
} else {
$partnerId = $originalFlavorAsset->getPartnerId();
}
if (is_null($flavorAssetId)) {
$flavorAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $flavorParamsId);
if ($flavorAsset) {
$flavorAssetId = $flavorAsset->getId();
}
}
$srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$flavor->_force = true;
// force to convert the flavor, even if none complied
$flavor->setReadyBehavior(flavorParamsConversionProfile::READY_BEHAVIOR_IGNORE);
// should not be taken in completion rules check
$conversionProfile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
if ($conversionProfile) {
$flavorParamsConversionProfile = flavorParamsConversionProfilePeer::retrieveByFlavorParamsAndConversionProfile($flavor->getFlavorParamsId(), $conversionProfile->getId());
if ($flavorParamsConversionProfile) {
$flavor->setReadyBehavior($flavorParamsConversionProfile->getReadyBehavior());
}
}
$flavorAsset = kBatchManager::createFlavorAsset($flavor, $partnerId, $entryId, $flavorAssetId);
if (!$flavorAsset) {
KalturaLog::err("Failed to create flavor asset");
return null;
}
$flavorAssetId = $flavorAsset->getId();
$collectionTag = $flavor->getCollectionTag();
if ($collectionTag) {
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $parentJob, $entryId);
}
$dbConvertCollectionJob = null;
if ($parentJob) {
$dbConvertCollectionJob = $parentJob->createChild(false);
$dbConvertCollectionJob->setEntryId($entryId);
$dbConvertCollectionJob->save();
}
$flavorAssets = assetPeer::retrieveFlavorsByEntryId($entryId);
$flavorAssets = assetPeer::filterByTag($flavorAssets, $collectionTag);
$flavors = array();
foreach ($flavorAssets as $tagedFlavorAsset) {
if ($tagedFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_NOT_APPLICABLE || $tagedFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_DELETED) {
continue;
}
$flavorParamsOutput = assetParamsOutputPeer::retrieveByAssetId($tagedFlavorAsset->getId());
if (is_null($flavorParamsOutput)) {
KalturaLog::log("Creating flavor params output for asset [" . $tagedFlavorAsset->getId() . "]");
$flavorParams = assetParamsPeer::retrieveByPK($tagedFlavorAsset->getId());
$flavorParamsOutput = self::validateFlavorAndMediaInfo($flavorParams, $mediaInfo, $errDescription);
if (is_null($flavorParamsOutput)) {
KalturaLog::err("Failed to validate media info [{$errDescription}]");
continue;
}
//.........这里部分代码省略.........
示例3: handleConvertCollectionFailed
/**
* @param BatchJob $dbBatchJob
* @param kConvertCollectionJobData $data
* @param int $engineType
* @return boolean
*/
public static function handleConvertCollectionFailed(BatchJob $dbBatchJob, kConvertCollectionJobData $data, $engineType)
{
$collectionFlavors = array();
foreach ($data->getFlavors() as $flavor) {
$collectionFlavors[$flavor->getFlavorAssetId()] = $flavor;
}
// find the root job
$rootBatchJob = $dbBatchJob->getRootJob();
$hasIncomplete = false;
$shouldFailProfile = false;
$flavorAssets = assetPeer::retrieveFlavorsByEntryId($dbBatchJob->getEntryId());
foreach ($flavorAssets as $flavorAsset) {
if (isset($collectionFlavors[$flavorAsset->getId()])) {
$flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
$flavorAsset->save();
if (!$rootBatchJob) {
continue;
}
$flavorData = $collectionFlavors[$flavorAsset->getId()];
if ($flavorData->getReadyBehavior() == flavorParamsConversionProfile::READY_BEHAVIOR_REQUIRED) {
$shouldFailProfile = true;
}
continue;
}
if ($flavorAsset->getIsOriginal()) {
continue;
}
if ($flavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_QUEUED || $flavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_CONVERTING || $flavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_IMPORTING || $flavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_VALIDATING) {
$hasIncomplete = true;
}
}
if (!$rootBatchJob) {
return false;
}
if ($rootBatchJob->getJobType() != BatchJobType::CONVERT_PROFILE) {
return false;
}
if ($shouldFailProfile || !$hasIncomplete) {
kJobsManager::failBatchJob($rootBatchJob, "Job " . $dbBatchJob->getId() . " failed");
}
return false;
}
示例4: decideAddEntryFlavor
/**
* batch decideAddEntryFlavor is the decision layer for adding a single flavor conversion to an entry
*
* @param BatchJob $parentJob
* @param int $entryId
* @param int $flavorParamsId
* @param string $errDescription
* @param string $flavorAssetId
* @param array<kOperationAttributes> $dynamicAttributes
* @return BatchJob
*/
public static function decideAddEntryFlavor(BatchJob $parentJob = null, $entryId, $flavorParamsId, &$errDescription, $flavorAssetId = null, array $dynamicAttributes = array(), $priority = 0)
{
KalturaLog::log("entryId [{$entryId}], flavorParamsId [{$flavorParamsId}]");
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (is_null($originalFlavorAsset)) {
$errDescription = 'Original flavor asset not found';
KalturaLog::err($errDescription);
return null;
}
if ($originalFlavorAsset->getId() != $flavorAssetId && !$originalFlavorAsset->isLocalReadyStatus()) {
$errDescription = 'Original flavor asset not ready';
KalturaLog::err($errDescription);
return null;
}
// TODO - if source flavor is remote storage, create import job and mark the flavor as FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT
$mediaInfoId = null;
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($originalFlavorAsset->getId());
if ($mediaInfo) {
$mediaInfoId = $mediaInfo->getId();
}
$flavorParams = assetParamsPeer::retrieveByPK($flavorParamsId);
if (!$flavorParams) {
KalturaLog::err("Flavor Params Id [{$flavorParamsId}] not found");
return null;
}
$flavorParams->setDynamicAttributes($dynamicAttributes);
self::adjustAssetParams($entryId, array($flavorParams));
$flavor = self::validateFlavorAndMediaInfo($flavorParams, $mediaInfo, $errDescription);
if (is_null($flavor)) {
KalturaLog::err("Failed to validate media info [{$errDescription}]");
return null;
}
if ($parentJob) {
// prefer the partner id from the parent job, although it should be the same
$partnerId = $parentJob->getPartnerId();
} else {
$partnerId = $originalFlavorAsset->getPartnerId();
}
if (is_null($flavorAssetId)) {
$flavorAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $flavorParamsId);
if ($flavorAsset) {
$flavorAssetId = $flavorAsset->getId();
}
}
$flavor->_force = true;
// force to convert the flavor, even if none complied
$conversionProfile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
if ($conversionProfile) {
$flavorParamsConversionProfile = flavorParamsConversionProfilePeer::retrieveByFlavorParamsAndConversionProfile($flavor->getFlavorParamsId(), $conversionProfile->getId());
if ($flavorParamsConversionProfile) {
$flavor->setReadyBehavior($flavorParamsConversionProfile->getReadyBehavior());
}
}
$flavorAsset = kBatchManager::createFlavorAsset($flavor, $partnerId, $entryId, $flavorAssetId);
if (!$flavorAsset) {
return null;
}
if (!$flavorAsset->getIsOriginal()) {
$flavor->setReadyBehavior(flavorParamsConversionProfile::READY_BEHAVIOR_IGNORE);
}
// should not be taken in completion rules check
$flavorAssetId = $flavorAsset->getId();
$collectionTag = $flavor->getCollectionTag();
/*
* CHANGE: collection porcessing only for ExpressionEncoder jobs
* to allow FFmpeg/ISMV processing
*/
KalturaLog::log("Check for collection case - asset(" . $flavorAssetId . "),engines(" . $flavor->getConversionEngines() . ")");
if ($collectionTag && $flavor->getConversionEngines() == conversionEngineType::EXPRESSION_ENCODER3) {
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $parentJob, $entryId);
}
$flavorAssets = assetPeer::retrieveFlavorsByEntryId($entryId);
$flavorAssets = assetPeer::filterByTag($flavorAssets, $collectionTag);
$flavors = array();
foreach ($flavorAssets as $tagedFlavorAsset) {
$errDescription = null;
if ($tagedFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_NOT_APPLICABLE || $tagedFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_DELETED) {
continue;
}
$flavorParamsOutput = assetParamsOutputPeer::retrieveByAssetId($tagedFlavorAsset->getId());
if (is_null($flavorParamsOutput)) {
KalturaLog::log("Creating flavor params output for asset [" . $tagedFlavorAsset->getId() . "]");
$flavorParams = assetParamsPeer::retrieveByPK($tagedFlavorAsset->getId());
self::adjustAssetParams($entryId, array($flavorParams));
$flavorParamsOutput = self::validateFlavorAndMediaInfo($flavorParams, $mediaInfo, $errDescription);
if (is_null($flavorParamsOutput)) {
KalturaLog::err("Failed to validate media info [{$errDescription}]");
//.........这里部分代码省略.........
示例5: execute
/**
* Will investigate a single entry
*/
public function execute()
{
$this->forceSystemAuthentication();
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
entryPeer::setUseCriteriaFilter(false);
$this->result = NULL;
$fast = $this->getRequestParameter("fast", "") != "";
$this->fast = $fast;
$kshow_id = $this->getRequestParameter("kshow_id");
$this->kshow_id = $kshow_id;
$this->kshow = NULL;
$entry_id = $this->getRequestParameter("entry_id");
$this->entry_id = $entry_id;
$this->entry = NULL;
$this->error = $this->getRequestParameter("error");
$this->bg_entry = NULL;
if (!empty($kshow_id)) {
$c = new Criteria();
$c->add(kshowPeer::ID, $kshow_id);
$kshows = kshowPeer::doSelect($c);
$kshow = new kshow();
if (!$kshows) {
$this->result = "No kshow [{$kshow_id}] in DB";
return;
}
$kshow_original = $kshows[0];
$kshow_original->getShowEntry();
// pre fetch
$kshow_original->getIntro();
// pre fetch
$this->kshow_original = $kshows[0];
$this->kshow = new genericObjectWrapper($this->kshow_original, true);
$alredy_exist_entries = array();
$alredy_exist_entries[] = $kshow_original->getShowEntryId();
if ($kshow_original->getIntroId()) {
$alredy_exist_entries[] = $kshow_original->getIntroId();
}
$skin_obj = $this->kshow_original->getSkinObj();
$bg_entry_id = $skin_obj->get("bg_entry_id");
if ($bg_entry_id) {
$alredy_exist_entries[] = $bg_entry_id;
$this->bg_entry = new genericObjectWrapper(entryPeer::retrieveByPK($bg_entry_id), true);
}
$c = new Criteria();
$c->add(entryPeer::ID, $alredy_exist_entries, Criteria::NOT_IN);
$c->setLimit(100);
$this->kshow_entries = $this->kshow_original->getEntrysJoinKuser($c);
return;
//return "KshowSuccess";
}
if (empty($entry_id)) {
return;
}
entryPeer::setUseCriteriaFilter(false);
// from entry table
$c = new Criteria();
$c->add(entryPeer::ID, $entry_id);
//$entries = entryPeer::doSelectJoinAll ( $c );
$entries = entryPeer::doSelect($c);
if (!$entries) {
$this->result = "No entry [{$entry_id}] in DB";
return;
}
$this->entry = new genericObjectWrapper($entries[0], true);
// from conversion table
$c = new Criteria();
$c->add(conversionPeer::ENTRY_ID, $entry_id);
$original_conversions = conversionPeer::doSelect($c);
//$this->conversions = array() ; //
$this->conversions = $original_conversions;
//new genericObjectWrapper( $original_conversions );
// find all relevant batches in DB
// from batch_job table
$c = new Criteria();
//$c->add ( BatchJobPeer::DATA , "%\"entryId\";i:" . $entry_id . ";%" , Criteria::LIKE );
$c->add(BatchJobPeer::ENTRY_ID, $entry_id);
$original_batch_jobs = BatchJobPeer::doSelect($c);
$this->batch_jobs = $original_batch_jobs;
// new genericObjectWrapper( $original_batch_jobs );
// use this as a refernece of all the directories
// myBatchFileConverterServer::init( true );
$entry_patttern = "/" . $entry_id . "\\..*/";
$getFileData_method = array('kFile', 'getFileData');
$getFileDataWithContent_method = array('kFile', 'getFileDataWithContent');
// find all relevant files on disk
$c = new Criteria();
$c->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ENTRY);
$c->add(FileSyncPeer::OBJECT_ID, $entry_id);
// order by OBJECT SUB TYPE
$c->addAscendingOrderByColumn(FileSyncPeer::OBJECT_SUB_TYPE);
$this->file_syncs = FileSyncPeer::doSelect($c);
$file_sync_links = array();
$flavors = assetPeer::retrieveFlavorsByEntryId($entry_id);
$flavor_ids = array();
$this->flavors = array();
foreach ($flavors as $f) {
$flavor_ids[] = $f->getId();
//.........这里部分代码省略.........
示例6: handleUploadCanceled
/**
* @param UploadToken $uploadToken
*/
public static function handleUploadCanceled(UploadToken $uploadToken)
{
$dbEntry = null;
if ($uploadToken->getObjectType() == entryPeer::OM_CLASS) {
$dbEntry = entryPeer::retrieveByPK($uploadToken->getObjectId());
}
if ($uploadToken->getObjectType() == FileAssetPeer::OM_CLASS) {
$dbFileAsset = FileAssetPeer::retrieveByPK($uploadToken->getObjectId());
if (!$dbFileAsset) {
KalturaLog::err("File asset id [" . $uploadToken->getObjectId() . "] not found");
return;
}
if ($dbFileAsset->getStatus() == FileAssetStatus::UPLOADING) {
$dbFileAsset->setStatus(FileAssetStatus::PENDING);
$dbFileAsset->save();
}
return;
}
if (is_subclass_of($uploadToken->getObjectType(), assetPeer::OM_CLASS)) {
$dbAsset = assetPeer::retrieveById($uploadToken->getObjectId());
if (!$dbAsset) {
KalturaLog::err("Asset id [" . $uploadToken->getObjectId() . "] not found");
return;
}
if ($dbAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_IMPORTING) {
$dbAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_QUEUED);
$dbAsset->save();
}
$dbEntry = $dbAsset->getentry();
}
if ($dbEntry && $dbEntry->getStatus() == entryStatus::IMPORT) {
$status = entryStatus::NO_CONTENT;
$entryFlavorAssets = assetPeer::retrieveFlavorsByEntryId($dbEntry->getId());
foreach ($entryFlavorAssets as $entryFlavorAsset) {
/* @var $entryFlavorAsset flavorAsset */
if ($entryFlavorAsset->getStatus() == asset::FLAVOR_ASSET_STATUS_READY && $status == entryStatus::NO_CONTENT) {
$status = entryStatus::PENDING;
}
if ($entryFlavorAsset->getStatus() == asset::FLAVOR_ASSET_STATUS_IMPORTING && $status != entryStatus::PRECONVERT) {
$status = entryStatus::IMPORT;
}
if ($entryFlavorAsset->getStatus() == asset::FLAVOR_ASSET_STATUS_CONVERTING) {
$status = entryStatus::PRECONVERT;
}
}
$dbEntry->setStatus($status);
$dbEntry->save();
}
}
示例7: getByEntryIdAction
/**
* Get Flavor Assets for Entry
*
* @action getByEntryId
* @param string $entryId
* @return KalturaFlavorAssetArray
* @deprecated Use thumbAsset.list instead
*/
public function getByEntryIdAction($entryId)
{
// entry could be "display_in_search = 2" - in that case we want to pull it although KN is off in services.ct for this action
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->addAnd(entryPeer::ID, $entryId);
$criterionPartnerOrKn = $c->getNewCriterion(entryPeer::PARTNER_ID, $this->getPartnerId());
$criterionPartnerOrKn->addOr($c->getNewCriterion(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK));
$c->addAnd($criterionPartnerOrKn);
// there could only be one entry because the query is by primary key.
// so using doSelectOne is safe.
$dbEntry = entryPeer::doSelectOne($c);
if (!$dbEntry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$flavorAssetsDb = assetPeer::retrieveFlavorsByEntryId($entryId);
$flavorAssets = KalturaFlavorAssetArray::fromDbArray($flavorAssetsDb, $this->getResponseProfile());
return $flavorAssets;
}
示例8: deleteAction
/**
* Delete Flavor Asset by ID
*
* @action delete
* @param string $id
* @validateUser asset::entry id edit
*/
public function deleteAction($id)
{
$flavorAssetDb = assetPeer::retrieveById($id);
if (!$flavorAssetDb || !$flavorAssetDb instanceof flavorAsset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $id);
}
$entry = $flavorAssetDb->getEntry();
if (!$entry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $flavorAssetDb->getEntryId());
}
$flavorAssetDb->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
$flavorAssetDb->setDeletedAt(time());
$flavorAssetDb->save();
$entry->removeFlavorParamsId($flavorAssetDb->getFlavorParamsId());
$entryFlavors = assetPeer::retrieveFlavorsByEntryId($entry->getId());
if (!$entryFlavors) {
$entry->setStatus(entryStatus::NO_CONTENT);
}
$entry->save();
}