本文整理汇总了PHP中assetParamsPeer类的典型用法代码示例。如果您正苦于以下问题:PHP assetParamsPeer类的具体用法?PHP assetParamsPeer怎么用?PHP assetParamsPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了assetParamsPeer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getFlavorParamsFromFileFormat
/**
* return the flavor params the best fits the fileFormat for a given partner_id
*
* @param int $partnerId
* @param string $fileFormat
* @return FlavorParams
*/
public static function getFlavorParamsFromFileFormat($partnerId, $fileFormat, $ignoreSourceTag = true)
{
$defaultCriteria = assetParamsPeer::getCriteriaFilter()->getFilter();
$defaultCriteria->remove(assetParamsPeer::PARTNER_ID);
// assetParamsPeer::allowAccessToPartner0AndPartnerX($partnerId); // the flavor params can be from partner 0 too
$c = new Criteria();
$c->addAnd(assetParamsPeer::PARTNER_ID, array($partnerId, 0), Criteria::IN);
// $c->add ( assetParamsPeer::FORMAT , $fileFormat );
$possible_flavor_params = assetParamsPeer::doSelect($c);
myPartnerUtils::resetPartnerFilter('assetParams');
$best_fp = null;
foreach ($possible_flavor_params as $fp) {
if ($fileFormat != $fp->getFormat()) {
continue;
}
if ($ignoreSourceTag && $fp->hasTag(flavorParams::TAG_SOURCE)) {
continue;
}
if (!$best_fp) {
$best_fp = $fp;
}
if ($fp->getPartnerId() != $partnerId) {
continue;
}
// same format for the partner
$best_fp = $fp;
break;
}
// if not fount any - choose the first flavor params from the list
if (!$best_fp) {
$best_fp = $possible_flavor_params[0];
}
return $best_fp;
}
开发者ID:DBezemer,项目名称:server,代码行数:41,代码来源:myConversionProfileUtils.class.php
示例2: toInsertableObject
public function toInsertableObject($object_to_fill = null, $props_to_skip = array())
{
if (!is_null($this->thumbParamsId)) {
$dbAssetParams = assetParamsPeer::retrieveByPK($this->thumbParamsId);
if ($dbAssetParams) {
$object_to_fill->setFromAssetParams($dbAssetParams);
}
}
return parent::toInsertableObject($object_to_fill, $props_to_skip);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:10,代码来源:KalturaThumbAsset.php
示例3: xAddBulkDownloadAction
/**
* Creates new download job for multiple entry ids (comma separated), an email will be sent when the job is done
* This sevice support the following entries:
* - MediaEntry
* - Video will be converted using the flavor params id
* - Audio will be downloaded as MP3
* - Image will be downloaded as Jpeg
* - MixEntry will be flattened using the flavor params id
* - Other entry types are not supported
*
* Returns the admin email that the email message will be sent to
*
* @action xAddBulkDownload
* @param string $entryIds Comma separated list of entry ids
* @param string $flavorParamsId
* @return string
*/
public function xAddBulkDownloadAction($entryIds, $flavorParamsId = "")
{
$flavorParamsDb = null;
if ($flavorParamsId !== null && $flavorParamsId != "") {
$flavorParamsDb = assetParamsPeer::retrieveByPK($flavorParamsId);
if (!$flavorParamsDb) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND, $flavorParamsId);
}
}
kJobsManager::addBulkDownloadJob($this->getPartnerId(), $this->getKuser()->getPuserId(), $entryIds, $flavorParamsId);
return $this->getKuser()->getEmail();
}
开发者ID:DBezemer,项目名称:server,代码行数:29,代码来源:XInternalService.php
示例4: toInsertableObject
public function toInsertableObject($object_to_fill = null, $props_to_skip = array())
{
if (!is_null($this->captionParamsId)) {
$dbAssetParams = assetParamsPeer::retrieveByPK($this->captionParamsId);
if ($dbAssetParams) {
$object_to_fill->setFromAssetParams($dbAssetParams);
}
}
if ($this->format === null && $object_to_fill->getContainerFormat() === null) {
$this->format = KalturaCaptionType::SRT;
}
return parent::toInsertableObject($object_to_fill, $props_to_skip);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:13,代码来源:KalturaCaptionAsset.php
示例5: getFlavorParams
/**
* Get the associated assetParams object
*
* @param PropelPDO Optional Connection object.
* @return assetParams The associated assetParams object.
* @throws PropelException
*/
public function getFlavorParams(PropelPDO $con = null)
{
if ($this->aassetParams === null && $this->flavor_params_id !== null) {
$this->aassetParams = assetParamsPeer::retrieveByPk($this->flavor_params_id);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aassetParams->addassets($this);
*/
}
return $this->aassetParams;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:21,代码来源:flavorAsset.php
示例6: doGetListResponse
protected function doGetListResponse(KalturaFilterPager $pager, array $types = null)
{
$flavorParamsFilter = $this->toObject();
$c = new Criteria();
$flavorParamsFilter->attachToCriteria($c);
$pager->attachToCriteria($c);
if ($types) {
$c->add(assetParamsPeer::TYPE, $types, Criteria::IN);
}
$list = assetParamsPeer::doSelect($c);
$c->setLimit(null);
$totalCount = assetParamsPeer::doCount($c);
return array($list, $totalCount);
}
开发者ID:DBezemer,项目名称:server,代码行数:14,代码来源:KalturaAssetParamsFilter.php
示例7: toObject
public function toObject($object_to_fill = null, $props_to_skip = array())
{
if (!$object_to_fill) {
$object_to_fill = new assetParamsConversionProfileFilter();
}
$conversionProfileCriteria = new Criteria();
if ($this->conversionProfileIdEqual) {
$conversionProfileCriteria->add(conversionProfile2Peer::ID, $this->conversionProfileIdEqual);
}
if ($this->conversionProfileIdIn) {
$conversionProfileCriteria->add(conversionProfile2Peer::ID, explode(',', $this->conversionProfileIdIn), Criteria::IN);
}
if ($this->conversionProfileIdFilter) {
$conversionProfileIdFilter = new conversionProfile2Filter();
$this->conversionProfileIdFilter->toObject($conversionProfileIdFilter);
$conversionProfileIdFilter->attachToCriteria($conversionProfileCriteria);
}
$this->conversionProfileIdEqual = null;
$this->conversionProfileIdFilter = null;
$conversionProfileIdIn = conversionProfile2Peer::getIds($conversionProfileCriteria);
if (count($conversionProfileIdIn)) {
$this->conversionProfileIdIn = implode(',', $conversionProfileIdIn);
} else {
$this->conversionProfileIdIn = -1;
}
// none existing conversion profile
$assetParamsCriteria = new Criteria();
if ($this->assetParamsIdEqual) {
$assetParamsCriteria->add(assetParamsPeer::ID, $this->assetParamsIdEqual);
}
if ($this->assetParamsIdIn) {
$assetParamsCriteria->add(assetParamsPeer::ID, explode(',', $this->assetParamsIdIn), Criteria::IN);
}
if ($this->assetParamsIdFilter) {
$assetParamsIdFilter = new assetParamsFilter();
$this->assetParamsIdFilter->toObject($assetParamsIdFilter);
$assetParamsIdFilter->attachToCriteria($assetParamsCriteria);
}
$this->assetParamsIdEqual = null;
$this->assetParamsIdFilter = null;
$assetParamsIdIn = assetParamsPeer::getIds($assetParamsCriteria);
if (count($assetParamsIdIn)) {
$this->assetParamsIdIn = implode(',', $assetParamsIdIn);
} else {
$this->assetParamsIdIn = -1;
}
// none existing flavor
return parent::toObject($object_to_fill, $props_to_skip);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:49,代码来源:KalturaConversionProfileAssetParamsFilter.php
示例8: addAction
/**
* Add new Syndication Feed
*
* @action add
* @param KalturaBaseSyndicationFeed $syndicationFeed
* @return KalturaBaseSyndicationFeed
*/
public function addAction(KalturaBaseSyndicationFeed $syndicationFeed)
{
$syndicationFeed->validatePlaylistId();
$syndicationFeed->validateStorageId($this->getPartnerId());
if ($syndicationFeed instanceof KalturaGenericXsltSyndicationFeed) {
$syndicationFeed->validatePropertyNotNull('xslt');
$syndicationFeedDB = new genericSyndicationFeed();
$syndicationFeedDB->incrementVersion();
} else {
$syndicationFeedDB = new syndicationFeed();
}
$syndicationFeed->toInsertableObject($syndicationFeedDB);
$syndicationFeedDB->setPartnerId($this->getPartnerId());
$syndicationFeedDB->setStatus(KalturaSyndicationFeedStatus::ACTIVE);
$syndicationFeedDB->save();
if ($syndicationFeed->addToDefaultConversionProfile) {
$partner = PartnerPeer::retrieveByPK($this->getPartnerId());
$c = new Criteria();
$c->addAnd(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $partner->getDefaultConversionProfileId());
$c->addAnd(flavorParamsConversionProfilePeer::FLAVOR_PARAMS_ID, $syndicationFeed->flavorParamId);
$is_exist = flavorParamsConversionProfilePeer::doCount($c);
if (!$is_exist || $is_exist === 0) {
$assetParams = assetParamsPeer::retrieveByPK($syndicationFeed->flavorParamId);
$fpc = new flavorParamsConversionProfile();
$fpc->setConversionProfileId($partner->getDefaultConversionProfileId());
$fpc->setFlavorParamsId($syndicationFeed->flavorParamId);
if ($assetParams) {
$fpc->setReadyBehavior($assetParams->getReadyBehavior());
$fpc->setSystemName($assetParams->getSystemName());
if ($assetParams->hasTag(assetParams::TAG_SOURCE) || $assetParams->hasTag(assetParams::TAG_INGEST)) {
$fpc->setOrigin(assetParamsOrigin::INGEST);
} else {
$fpc->setOrigin(assetParamsOrigin::CONVERT);
}
}
$fpc->save();
}
}
if ($syndicationFeed instanceof KalturaGenericXsltSyndicationFeed) {
$key = $syndicationFeedDB->getSyncKey(genericSyndicationFeed::FILE_SYNC_SYNDICATION_FEED_XSLT);
kFileSyncUtils::file_put_contents($key, $syndicationFeed->xslt);
}
$syndicationFeed->fromObject($syndicationFeedDB, $this->getResponseProfile());
return $syndicationFeed;
}
开发者ID:DBezemer,项目名称:server,代码行数:52,代码来源:SyndicationFeedService.php
示例9: buildRtmpLiveStreamFlavorsArray
/**
* @param string $baseUrl
* @return array
*/
protected function buildRtmpLiveStreamFlavorsArray()
{
$entry = entryPeer::retrieveByPK($this->params->getEntryId());
if (in_array($entry->getSource(), LiveEntry::$kalturaLiveSourceTypes)) {
/* @var $entry LiveEntry */
$flavors = array(0 => $this->getFlavorAssetInfo($entry->getStreamName()));
$conversionProfileId = $entry->getConversionProfileId();
if ($conversionProfileId) {
$liveParams = assetParamsPeer::retrieveByProfile($conversionProfileId);
if (count($liveParams)) {
$flavors = array();
foreach ($liveParams as $index => $liveParamsItem) {
/* @var $liveParamsItem liveParams */
if ($entry->getLiveStreamConfigurationByProtocol(PlaybackProtocol::RTMP, 'rtmp')) {
$configuration = $entry->getLiveStreamConfigurationByProtocol(PlaybackProtocol::RTMP, 'rtmp');
$flavors[$index] = $this->getFlavorAssetInfo(str_replace("%i", $liveParamsItem->getId(), $configuration->getStreamName()), '', $liveParamsItem);
continue;
}
$flavors[$index] = $this->getFlavorAssetInfo($entry->getStreamName() . '_' . $liveParamsItem->getId(), '', $liveParamsItem);
}
}
}
return $flavors;
}
$tmpFlavors = $entry->getStreamBitrates();
if (count($tmpFlavors)) {
$flavors = array();
foreach ($tmpFlavors as $index => $flavor) {
$brIndex = $index + 1;
$flavors[$index] = $this->getFlavorAssetInfo(str_replace('%i', $brIndex, $entry->getStreamName()));
$flavors[$index] = array_merge($flavors[$index], $flavor);
}
} else {
$flavors[0] = $this->getFlavorAssetInfo(str_replace('%i', '1', $entry->getStreamName()));
}
return $flavors;
}
开发者ID:AdiTal,项目名称:server,代码行数:41,代码来源:DeliveryProfileLiveRtmp.php
示例10: convert
/**
* Convert entry
*
* @param string $entryId Media entry id
* @param int $conversionProfileId
* @param KalturaConversionAttributeArray $dynamicConversionAttributes
* @return bigint job id
* @throws KalturaErrors::ENTRY_ID_NOT_FOUND
* @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND
* @throws KalturaErrors::FLAVOR_PARAMS_NOT_FOUND
*/
protected function convert($entryId, $conversionProfileId = null, KalturaConversionAttributeArray $dynamicConversionAttributes = null)
{
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (!$srcFlavorAsset) {
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
}
if (is_null($conversionProfileId) || $conversionProfileId <= 0) {
$conversionProfile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
if (!$conversionProfile) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
}
$conversionProfileId = $conversionProfile->getId();
} else {
//The search is with the entry's partnerId. so if conversion profile wasn't found it means that the
//conversionId is not exist or the conversion profileId does'nt belong to this partner.
$conversionProfile = conversionProfile2Peer::retrieveByPK($conversionProfileId);
if (is_null($conversionProfile)) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
}
}
$srcSyncKey = $srcFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
// if the file sync isn't local (wasn't synced yet) proxy request to other datacenter
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false);
if (!$fileSync) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
} else {
if (!$local) {
kFileUtils::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrl($fileSync));
}
}
// even if it null
$entry->setConversionQuality($conversionProfileId);
$entry->save();
if ($dynamicConversionAttributes) {
$flavors = assetParamsPeer::retrieveByProfile($conversionProfileId);
if (!count($flavors)) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_NOT_FOUND);
}
$srcFlavorParamsId = null;
$flavorParams = $entry->getDynamicFlavorAttributes();
foreach ($flavors as $flavor) {
if ($flavor->hasTag(flavorParams::TAG_SOURCE)) {
$srcFlavorParamsId = $flavor->getId();
}
$flavorParams[$flavor->getId()] = $flavor;
}
$dynamicAttributes = array();
foreach ($dynamicConversionAttributes as $dynamicConversionAttribute) {
if (is_null($dynamicConversionAttribute->flavorParamsId)) {
$dynamicConversionAttribute->flavorParamsId = $srcFlavorParamsId;
}
if (is_null($dynamicConversionAttribute->flavorParamsId)) {
continue;
}
$dynamicAttributes[$dynamicConversionAttribute->flavorParamsId][trim($dynamicConversionAttribute->name)] = trim($dynamicConversionAttribute->value);
}
if (count($dynamicAttributes)) {
$entry->setDynamicFlavorAttributes($dynamicAttributes);
$entry->save();
}
}
$srcFilePath = kFileSyncUtils::getLocalFilePathForKey($srcSyncKey);
$job = kJobsManager::addConvertProfileJob(null, $entry, $srcFlavorAsset->getId(), $srcFilePath);
if (!$job) {
return null;
}
return $job->getId();
}
开发者ID:DBezemer,项目名称:server,代码行数:83,代码来源:KalturaEntryService.php
示例11: copyConversionProfiles
public static function copyConversionProfiles(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
{
$copiedList = array();
KalturaLog::log("Copying conversion profiles from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "]");
$c = new Criteria();
$c->add(conversionProfile2Peer::PARTNER_ID, $fromPartner->getId());
$conversionProfiles = conversionProfile2Peer::doSelect($c);
foreach ($conversionProfiles as $conversionProfile) {
/* @var $conversionProfile conversionProfile2 */
if ($permissionRequiredOnly && !count($conversionProfile->getRequiredCopyTemplatePermissions())) {
continue;
}
if (!self::isPartnerPermittedForCopy($toPartner, $conversionProfile->getRequiredCopyTemplatePermissions())) {
continue;
}
$newConversionProfile = $conversionProfile->copy();
$newConversionProfile->setPartnerId($toPartner->getId());
try {
$newConversionProfile->save();
} catch (Exception $e) {
KalturaLog::info("Exception occured, conversion profile was not copied. Message: [" . $e->getMessage() . "]");
continue;
}
KalturaLog::log("Copied [" . $conversionProfile->getId() . "], new id is [" . $newConversionProfile->getId() . "]");
$copiedList[$conversionProfile->getId()] = $newConversionProfile->getId();
$c = new Criteria();
$c->add(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $conversionProfile->getId());
$fpcpList = flavorParamsConversionProfilePeer::doSelect($c);
foreach ($fpcpList as $fpcp) {
$flavorParamsId = $fpcp->getFlavorParamsId();
$flavorParams = assetParamsPeer::retrieveByPK($flavorParamsId);
if ($flavorParams && $flavorParams->getPartnerId() === 0) {
$newFpcp = $fpcp->copy();
$newFpcp->setConversionProfileId($newConversionProfile->getId());
$newFpcp->save();
}
}
}
// make sure conversion profile is set on the new partner in case it was missed/skiped in the conversionProfile2::copy method
if (!$toPartner->getDefaultConversionProfileId()) {
$fromPartnerDefaultProfile = $fromPartner->getDefaultConversionProfileId();
if ($fromPartnerDefaultProfile && key_exists($fromPartnerDefaultProfile, $copiedList)) {
$toPartner->setDefaultConversionProfileId($copiedList[$fromPartnerDefaultProfile]);
}
}
if (!$toPartner->getDefaultLiveConversionProfileId()) {
$fromPartnerDefaultLiveProfile = $fromPartner->getDefaultLiveConversionProfileId();
if ($fromPartnerDefaultLiveProfile && key_exists($fromPartnerDefaultLiveProfile, $copiedList)) {
$toPartner->setDefaultLiveConversionProfileId($copiedList[$fromPartnerDefaultLiveProfile]);
}
}
$toPartner->save();
}
开发者ID:dozernz,项目名称:server,代码行数:53,代码来源:myPartnerUtils.class.php
示例12: continueProfileConvert
public static function continueProfileConvert(BatchJob $parentJob)
{
$convertProfileJob = $parentJob->getRootJob();
if ($convertProfileJob->getJobType() != BatchJobType::CONVERT_PROFILE) {
throw new Exception("Root job [" . $convertProfileJob->getId() . "] is not profile conversion");
}
KalturaLog::log("Conversion decision layer continued for entry [" . $parentJob->getEntryId() . "]");
$convertProfileData = $convertProfileJob->getData();
$entryId = $convertProfileJob->getEntryId();
$entry = $convertProfileJob->getEntry();
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $convertProfileJob, $entryId);
}
$profile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
if (!$profile) {
$errDescription = "Conversion profile for entryId [{$entryId}] not found";
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription, BatchJobType::CONVERT_PROFILE);
kBatchManager::updateEntry($convertProfileJob->getEntryId(), entryStatus::ERROR_CONVERTING);
KalturaLog::err("No flavors created: {$errDescription}");
throw new Exception($errDescription);
}
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (is_null($originalFlavorAsset)) {
$errDescription = 'Original flavor asset not found';
KalturaLog::err($errDescription);
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription, BatchJobType::CONVERT_PROFILE);
kBatchManager::updateEntry($convertProfileJob->getEntryId(), entryStatus::ERROR_CONVERTING);
throw new Exception($errDescription);
}
// gets the list of flavor params of the conversion profile
$list = flavorParamsConversionProfilePeer::retrieveByConversionProfile($profile->getId());
if (!count($list)) {
$errDescription = "No flavors match the profile id [{$profile->getId()}]";
KalturaLog::err($errDescription);
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription, BatchJobType::CONVERT_PROFILE);
kBatchManager::updateEntry($convertProfileJob->getEntryId(), entryStatus::ERROR_CONVERTING);
$originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
$originalFlavorAsset->setDeletedAt(time());
$originalFlavorAsset->save();
throw new Exception($errDescription);
}
// gets the ids of the flavor params
$flavorsIds = array();
$conversionProfileFlavorParams = array();
foreach ($list as $flavorParamsConversionProfile) {
$flavorsId = $flavorParamsConversionProfile->getFlavorParamsId();
$flavorsIds[] = $flavorsId;
$conversionProfileFlavorParams[$flavorsId] = $flavorParamsConversionProfile;
}
$dynamicFlavorAttributes = $entry->getDynamicFlavorAttributes();
// gets the flavor params by the id
$flavors = assetParamsPeer::retrieveFlavorsByPKs($flavorsIds);
$entryIngestedFlavors = explode(',', $entry->getFlavorParamsIds());
foreach ($flavors as $index => $flavor) {
if (!isset($conversionProfileFlavorParams[$flavor->getId()])) {
continue;
}
$conversionProfileFlavorParamsItem = $conversionProfileFlavorParams[$flavor->getId()];
if ($flavor->hasTag(flavorParams::TAG_SOURCE)) {
unset($flavors[$index]);
continue;
}
if ($conversionProfileFlavorParamsItem->getOrigin() == assetParamsOrigin::INGEST) {
unset($flavors[$index]);
continue;
}
if (in_array($flavor->getId(), $entryIngestedFlavors) && $conversionProfileFlavorParamsItem->getOrigin() == assetParamsOrigin::CONVERT_WHEN_MISSING) {
unset($flavors[$index]);
continue;
}
// if flavor is not source (checked above), apply dynamic attributes defined for id -2 (all flavors)
if (isset($dynamicFlavorAttributes[flavorParams::DYNAMIC_ATTRIBUTES_ALL_FLAVORS_INDEX])) {
foreach ($dynamicFlavorAttributes[flavorParams::DYNAMIC_ATTRIBUTES_ALL_FLAVORS_INDEX] as $attributeName => $attributeValue) {
$flavor->setDynamicAttribute($attributeName, $attributeValue);
}
}
// overwrite dynamic attributes if defined for this specific flavor
if (isset($dynamicFlavorAttributes[$flavor->getId()])) {
foreach ($dynamicFlavorAttributes[$flavor->getId()] as $attributeName => $attributeValue) {
$flavor->setDynamicAttribute($attributeName, $attributeValue);
}
}
}
KalturaLog::log(count($flavors) . " destination flavors found for this profile[" . $profile->getId() . "]");
if (!count($flavors)) {
return false;
}
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($originalFlavorAsset->getId());
return self::decideProfileFlavorsConvert($parentJob, $convertProfileJob, $flavors, $conversionProfileFlavorParams, $mediaInfo);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:90,代码来源:kBusinessPreConvertDL.php
示例13: buildPkeyCriteria
/**
* Builds a Criteria object containing the primary key for this object.
*
* Unlike buildCriteria() this method includes the primary key values regardless
* of whether or not they have been modified.
*
* @return Criteria The Criteria object containing value(s) for primary key(s).
*/
public function buildPkeyCriteria()
{
$criteria = new Criteria(assetParamsPeer::DATABASE_NAME);
$criteria->add(assetParamsPeer::ID, $this->id);
if ($this->alreadyInSave) {
if ($this->isColumnModified(assetParamsPeer::CUSTOM_DATA)) {
if (!is_null($this->custom_data_md5)) {
$criteria->add(assetParamsPeer::CUSTOM_DATA, "MD5(cast(" . assetParamsPeer::CUSTOM_DATA . " as char character set latin1)) = '{$this->custom_data_md5}'", Criteria::CUSTOM);
} else {
$criteria->add(assetParamsPeer::CUSTOM_DATA, NULL, Criteria::ISNULL);
}
}
if (count($this->modifiedColumns) == 2 && $this->isColumnModified(assetParamsPeer::UPDATED_AT)) {
$theModifiedColumn = null;
foreach ($this->modifiedColumns as $modifiedColumn) {
if ($modifiedColumn != assetParamsPeer::UPDATED_AT) {
$theModifiedColumn = $modifiedColumn;
}
}
$atomicColumns = assetParamsPeer::getAtomicColumns();
if (in_array($theModifiedColumn, $atomicColumns)) {
$criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
}
}
}
return $criteria;
}
开发者ID:dozernz,项目名称:server,代码行数:35,代码来源:BaseassetParams.php
示例14: addFlavorParamsRelation
/**
* Adds the relation of flavorParams <> conversionProfile2
*
* @param conversionProfile2 $conversionProfileDb
* @param $flavorParamsIds
*/
protected function addFlavorParamsRelation(conversionProfile2 $conversionProfileDb, $flavorParamsIds)
{
$existingIds = flavorParamsConversionProfilePeer::getFlavorIdsByProfileId($conversionProfileDb->getId());
$assetParamsObjects = assetParamsPeer::retrieveByPKs($flavorParamsIds);
foreach ($assetParamsObjects as $assetParams) {
/* @var $assetParams assetParams */
if (in_array($assetParams->getId(), $existingIds)) {
continue;
}
$fpc = new flavorParamsConversionProfile();
$fpc->setConversionProfileId($conversionProfileDb->getId());
$fpc->setFlavorParamsId($assetParams->getId());
$fpc->setReadyBehavior($assetParams->getReadyBehavior());
$fpc->setSystemName($assetParams->getSystemName());
$fpc->setForceNoneComplied(false);
if ($assetParams->hasTag(assetParams::TAG_SOURCE)) {
$fpc->setOrigin(assetParamsOrigin::INGEST);
} else {
$fpc->setOrigin(assetParamsOrigin::CONVERT);
}
$fpc->save();
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:29,代码来源:ConversionProfileService.php
示例15: getStreamBitrates
public function getStreamBitrates()
{
$streamBitrates = $this->getFromCustomData("streamBitrates");
if (is_array($streamBitrates) && count($streamBitrates)) {
return $streamBitrates;
}
if (in_array($this->getSource(), array(EntrySourceType::LIVE_STREAM, EntrySourceType::LIVE_STREAM_ONTEXTDATA_CAPTIONS))) {
$liveParams = assetParamsPeer::retrieveByProfile($this->getConversionProfileId());
$streamBitrates = array();
foreach ($liveParams as $liveParamsItem) {
/* @var $liveParamsItem liveParams */
$streamBitrate = array('bitrate' => $liveParamsItem->getVideoBitrate(), 'width' => $liveParamsItem->getWidth(), 'height' => $liveParamsItem->getHeight(), 'tags' => $liveParamsItem->getTags());
$streamBitrates[] = $streamBitrate;
}
return $streamBitrates;
}
return array(array('bitrate' => 300, 'width' => 320, 'height' => 240));
}
开发者ID:DBezemer,项目名称:server,代码行数:18,代码来源:LiveEntry.php
示例16: chdir
$readyBehavior = 2;
$isDefault = false;
$width = 0;
$height = 0;
$resolution = null;
$paperWidth = null;
$paperHeight = null;
$isReadonly = true;
/**************************************************
* DON'T TOUCH THE FOLLOWING CODE
***************************************************/
chdir(dirname(__FILE__));
require_once __DIR__ . '/../../bootstrap.php';
$flavorParams = null;
if ($flavorParamsId) {
$flavorParams = assetParamsPeer::retrieveByPK($flavorParamsId);
if (!$flavorParams instanceof PdfFlavorParams) {
echo "Flavor params id [{$flavorParamsId}] is not PDF flavor params\n";
exit;
}
$flavorParams->setVersion($flavorParams->getVersion() + 1);
} else {
$flavorParams = new PdfFlavorParams();
$flavorParams->setVersion(1);
$flavorParams->setFormat(flavorParams::CONTAINER_FORMAT_PDF);
$flavorParams->setVideoBitrate(1);
}
$pdfOperator = new kOperator();
$pdfOperator->id = conversionEngineType::PDF_CREATOR;
$operators = new kOperatorSets();
$operators->addSet(array($pdfOperator));
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:setPdfReadOnly.php
示例17: handleConvertFinished
/**
* @param BatchJob $dbBatchJob
* @param flavorAsset $currentFlavorAsset
* @return BatchJob
*/
public static function handleConvertFinished(BatchJob $dbBatchJob = null, flavorAsset $currentFlavorAsset)
{
KalturaLog::debug("entry id [" . $currentFlavorAsset->getEntryId() . "] flavor asset id [" . $currentFlavorAsset->getId() . "]");
$profile = null;
try {
$profile = myPartnerUtils::getConversionProfile2ForEntry($currentFlavorAsset->getEntryId());
KalturaLog::debug("profile [" . $profile->getId() . "]");
} catch (Exception $e) {
KalturaLog::err($e->getMessage());
}
$currentReadyBehavior = self::getReadyBehavior($currentFlavorAsset, $profile);
KalturaLog::debug("Current ready behavior [{$currentReadyBehavior}]");
if ($currentReadyBehavior == flavorParamsConversionProfile::READY_BEHAVIOR_IGNORE) {
return $dbBatchJob;
}
$rootBatchJob = null;
if ($dbBatchJob) {
$rootBatchJob = $dbBatchJob->getRootJob();
}
if ($rootBatchJob) {
KalturaLog::debug("root batch job id [" . $rootBatchJob->getId() . "] type [" . $rootBatchJob->getJobType() . "]");
}
// update the root job end exit
if ($rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::BULKDOWNLOAD) {
$siblingJobs = $rootBatchJob->getChildJobs();
foreach ($siblingJobs as $siblingJob) {
// checking only conversion child jobs
if ($siblingJob->getJobType() != BatchJobType::CONVERT && $siblingJob->getJobType() != BatchJobType::CONVERT_COLLECTION && $siblingJob->getJobType() != BatchJobType::POSTCONVERT) {
continue;
}
// if not complete leave function
if (!in_array($siblingJob->getStatus(), BatchJobPeer::getClosedStatusList())) {
KalturaLog::debug("job id [" . $siblingJob->getId() . "] status [" . $siblingJob->getStatus() . "]");
return $dbBatchJob;
}
}
KalturaLog::debug("finish bulk download root job");
// all child jobs completed
kJobsManager::updateBatchJob($rootBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
return $dbBatchJob;
}
$inheritedFlavorParamsIds = array();
$requiredFlavorParamsIds = array();
$flavorParamsConversionProfileItems = array();
if ($profile) {
$flavorParamsConversionProfileItems = flavorParamsConversionProfilePeer::retrieveByConversionProfile($profile->getId());
}
foreach ($flavorParamsConversionProfileItems as $flavorParamsConversionProfile) {
if ($flavorParamsConversionProfile->getReadyBehavior() == flavorParamsConversionProfile::READY_BEHAVIOR_REQUIRED) {
$requiredFlavorParamsIds[$flavorParamsConversionProfile->getFlavorParamsId()] = true;
}
if ($flavorParamsConversionProfile->getReadyBehavior() == flavorParamsConversionProfile::READY_BEHAVIOR_NO_IMPACT) {
$inheritedFlavorParamsIds[] = $flavorParamsConversionProfile->getFlavorParamsId();
}
}
$flavorParamsItems = assetParamsPeer::retrieveByPKs($inheritedFlavorParamsIds);
foreach ($flavorParamsItems as $flavorParams) {
if ($flavorParams->getReadyBehavior() == flavorParamsConversionProfile::READY_BEHAVIOR_REQUIRED) {
$requiredFlavorParamsIds[$flavorParamsConversionProfile->getFlavorParamsId()] = true;
}
}
KalturaLog::debug("required flavor params ids [" . print_r($requiredFlavorParamsIds, true) . "]");
// go over all the flavor assets of the entry
$inCompleteFlavorIds = array();
$origianlAssetFlavorId = null;
$siblingFlavorAssets = assetPeer::retrieveFlavorsByEntryId($currentFlavorAsset->getEntryId());
foreach ($siblingFlavorAssets as $siblingFlavorAsset) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] flavor params id [" . $siblingFlavorAsset->getFlavorParamsId() . "]");
// don't mark any incomplete flag
if ($siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is ready");
if (isset($requiredFlavorParamsIds[$siblingFlavorAsset->getFlavorParamsId()])) {
unset($requiredFlavorParamsIds[$siblingFlavorAsset->getFlavorParamsId()]);
}
continue;
}
$readyBehavior = self::getReadyBehavior($siblingFlavorAsset, $profile);
if ($siblingFlavorAsset->getStatus() == flavorAsset::ASSET_STATUS_EXPORTING) {
if ($siblingFlavorAsset->getIsOriginal()) {
$origianlAssetFlavorId = $siblingFlavorAsset->getFlavorParamsId();
} else {
if ($readyBehavior != flavorParamsConversionProfile::READY_BEHAVIOR_IGNORE) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is incomplete");
$inCompleteFlavorIds[] = $siblingFlavorAsset->getFlavorParamsId();
}
}
}
if ($readyBehavior == flavorParamsConversionProfile::READY_BEHAVIOR_IGNORE) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is ignored");
continue;
}
if ($siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_QUEUED || $siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_CONVERTING || $siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_IMPORTING || $siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_VALIDATING) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is incomplete");
$inCompleteFlavorIds[] = $siblingFlavorAsset->getFlavorParamsId();
}
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:kBusinessPostConvertDL.php
示例18: decideSourceFlavorConvert
private static function decideSourceFlavorConvert($entryId, assetParams $sourceFlavor = null, flavorAsset $originalFlavorAsset, $conversionProfileId, $flavors, mediaInfo $mediaInfo = null, BatchJob $parentJob, BatchJob $convertProfileJob)
{
if ($sourceFlavor && ($sourceFlavor->getOperators() || $sourceFlavor->getConversionEngines()) && $originalFlavorAsset->getInterFlowCount() == null) {
KalturaLog::log("Source flavor asset requires conversion");
self::adjustAssetParams($entryId, array($sourceFlavor));
$srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$errDescription = null;
$sourceFlavorOutput = self::validateFlavorAndMediaInfo($sourceFlavor, $mediaInfo, $errDescription);
if (!$sourceFlavorOutput) {
if (!$errDescription) {
$errDescription = "Failed to create flavor params output from source flavor";
}
$originalFlavorAsset->setDescription($originalFlavorAsset->getDescription() . "\n{$errDescription}");
$originalFlavorAsset->setStatus(flavorAsset::ASSET_STATUS_ERROR);
$originalFlavorAsset->save();
kBatchManager::updateEntry($entryId, entryStatus::ERROR_CONVERTING);
kJobsManager::updateBatchJob($convertProfileJob, BatchJob::BATCHJOB_STATUS_FAILED);
return false;
}
} elseif ($mediaInfo) {
/*
* Check whether there is a need for an intermediate source pre-processing
*/
$sourceFlavorOutput = KDLWrap::GenerateIntermediateSource($mediaInfo, $flavors);
if (!$sourceFlavorOutput) {
return true;
}
$srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$errDescription = null;
/*
* Save the original source asset in another asset, in order
* to prevent its liquidated by the inter-source asset.
* But, do it only if the conversion profile contains source flavor
*/
if ($sourceFlavor) {
$sourceAsset = assetPeer::retrieveById($mediaInfo->getFlavorAssetId());
$copyFlavorParams = assetParamsPeer::retrieveBySystemName(self::SAVE_ORIGINAL_SOURCE_FLAVOR_PARAM_SYS_NAME);
if (!$copyFlavorParams) {
throw new APIException(APIErrors::OBJECT_NOT_FOUND);
}
$asset = $sourceAsset->copy();
$asset->setFlavorParamsId($copyFlavorParams->getId());
$asset->setFromAssetParams($copyFlavorParams);
$asset->setStatus(flavorAsset::ASSET_STATUS_READY);
$asset->setIsOriginal(0);
$asset-
|
请发表评论