当前位置: 首页>>代码示例>>PHP>>正文


PHP assetParamsPeer::retrieveByPK方法代码示例

本文整理汇总了PHP中assetParamsPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP assetParamsPeer::retrieveByPK方法的具体用法?PHP assetParamsPeer::retrieveByPK怎么用?PHP assetParamsPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在assetParamsPeer的用法示例。


在下文中一共展示了assetParamsPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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}]");
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:kBusinessPreConvertDL.php

示例6: appendFlavorAssetMrss

 /**
  * @param flavorAsset $flavorAsset
  * @param SimpleXMLElement $mrss
  * @return SimpleXMLElement
  */
 protected static function appendFlavorAssetMrss(flavorAsset $flavorAsset, SimpleXMLElement $mrss = null, kMrssParameters $mrssParams = null)
 {
     if (!$mrss) {
         $mrss = new SimpleXMLElement('<item/>');
     }
     $servePlayManifest = false;
     $playManifestClientTag = null;
     $storageId = null;
     if ($mrssParams) {
         $servePlayManifest = $mrssParams->getServePlayManifest();
         $playManifestClientTag = $mrssParams->getPlayManifestClientTag();
         $storageId = $mrssParams->getStorageId();
     }
     $content = $mrss->addChild('content');
     $content->addAttribute('url', kAssetUtils::getAssetUrl($flavorAsset, $servePlayManifest, $playManifestClientTag, $storageId));
     $content->addAttribute('flavorAssetId', $flavorAsset->getId());
     $content->addAttribute('isSource', $flavorAsset->getIsOriginal() ? 'true' : 'false');
     $content->addAttribute('containerFormat', $flavorAsset->getContainerFormat());
     $content->addAttribute('extension', $flavorAsset->getFileExt());
     $content->addAttribute('createdAt', $flavorAsset->getCreatedAt());
     // get the file size
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
     $fileSize = $fileSync && $fileSync->getFileSize() > 0 ? $fileSync->getFileSize() : $flavorAsset->getSize() * 1024;
     $mediaParams = array('format' => $flavorAsset->getContainerFormat(), 'videoBitrate' => $flavorAsset->getBitrate(), 'fileSize' => $fileSize, 'videoCodec' => $flavorAsset->getVideoCodecId(), 'audioBitrate' => 0, 'audioCodec' => '', 'frameRate' => $flavorAsset->getFrameRate(), 'height' => $flavorAsset->getHeight(), 'width' => $flavorAsset->getWidth());
     if (!is_null($flavorAsset->getFlavorParamsId())) {
         $content->addAttribute('flavorParamsId', $flavorAsset->getFlavorParamsId());
         $flavorParams = assetParamsPeer::retrieveByPK($flavorAsset->getFlavorParamsId());
         if ($flavorParams) {
             $content->addAttribute('flavorParamsName', $flavorParams->getName());
             $flavorParamsDetails = array('format' => $flavorParams->getFormat(), 'videoBitrate' => $flavorParams->getVideoBitrate(), 'videoCodec' => $flavorParams->getVideoCodec(), 'audioBitrate' => $flavorParams->getAudioBitrate(), 'audioCodec' => $flavorParams->getAudioCodec(), 'frameRate' => $flavorParams->getFrameRate(), 'height' => $flavorParams->getHeight(), 'width' => $flavorParams->getWidth());
             // merge the flavar param details with the flavor asset details
             // the flavor asset details take precedence whenever they exist
             $mediaParams = array_merge($flavorParamsDetails, array_filter($mediaParams));
         }
     }
     foreach ($mediaParams as $key => $value) {
         $content->addAttribute($key, $value);
     }
     $tags = $content->addChild('tags');
     foreach (explode(',', $flavorAsset->getTags()) as $tag) {
         $tags->addChild('tag', self::stringToSafeXml($tag));
     }
     if ($flavorAsset->hasTag(assetParams::TAG_SLWEB)) {
         self::addIsmLink($flavorAsset->getentry(), $mrss);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:52,代码来源:kMrssManager.php

示例7: deleteAction

 /**
  * Delete Thumb Params by ID
  * 
  * @action delete
  * @param int $id
  */
 public function deleteAction($id)
 {
     $thumbParamsDb = assetParamsPeer::retrieveByPK($id);
     if (!$thumbParamsDb) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND, $id);
     }
     $thumbParamsDb->setDeletedAt(time());
     $thumbParamsDb->save();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:15,代码来源:ThumbParamsService.php

示例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)
 {
     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);
//.........这里部分代码省略.........
开发者ID:ace3535,项目名称:server,代码行数:101,代码来源:kJobsManager.php

示例9: retrieveByPK

 /**
  * Retrieve a single object by pkey.
  *
  * @param      int $pk the primary key.
  * @param      PropelPDO $con the connection to use
  * @return     thumbParams
  */
 public static function retrieveByPK($pk, PropelPDO $con = null)
 {
     self::getInstance();
     return parent::retrieveByPK($pk, $con);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:12,代码来源:flavorParamsPeer.php

示例10: copyConversionProfiles

 public static function copyConversionProfiles(Partner $fromPartner, Partner $toPartner)
 {
     $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) {
         $newConversionProfile = $conversionProfile->copy();
         $newConversionProfile->setPartnerId($toPartner->getId());
         $newConversionProfile->save();
         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();
             }
         }
     }
     $toPartner->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]);
             $toPartner->save();
         }
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:36,代码来源:myPartnerUtils.class.php

示例11: execute

 public function execute()
 {
     $this->forceSystemAuthentication();
     $this->pid = $this->getRequestParameter("pid", 0);
     if (!is_null($this->getRequestParameter("advanced"))) {
         $this->getResponse()->setCookie('flavor-params-advanced', $this->getRequestParameter("advanced"));
         $this->advanced = (int) $this->getRequestParameter("advanced");
     } else {
         $this->advanced = (int) $this->getRequest()->getCookie('flavor-params-advanced');
     }
     myDbHelper::$use_alternative_con = null;
     $this->editFlavorParam = null;
     $this->editFlavorParam = assetParamsPeer::retrieveByPK($this->getRequestParameter("id"));
     if ($this->getRequestParameter("clone")) {
         $newFalvorParams = $this->editFlavorParam->copy();
         $newFalvorParams->setSourceAssetParamsIds($this->editFlavorParam->getSourceAssetParamsIds());
         $newFalvorParams->setAspectRatioProcessingMode($this->editFlavorParam->getAspectRatioProcessingMode());
         $newFalvorParams->setForceFrameToMultiplication16($this->editFlavorParam->getForceFrameToMultiplication16());
         $newFalvorParams->setIsGopInSec($this->editFlavorParam->getIsGopInSec());
         $newFalvorParams->setIsAvoidVideoShrinkFramesizeToSource($this->editFlavorParam->getIsAvoidVideoShrinkFramesizeToSource());
         $newFalvorParams->setIsAvoidVideoShrinkBitrateToSource($this->editFlavorParam->getIsAvoidVideoShrinkBitrateToSource());
         $newFalvorParams->setIsVideoFrameRateForLowBrAppleHls($this->editFlavorParam->getIsVideoFrameRateForLowBrAppleHls());
         $newFalvorParams->setIsAvoidForcedKeyFrames($this->editFlavorParam->getIsAvoidForcedKeyFrames());
         $newFalvorParams->setMultiStream($this->editFlavorParam->getMultiStream());
         $newFalvorParams->setAnamorphicPixels($this->editFlavorParam->getAnamorphicPixels());
         $newFalvorParams->setMaxFrameRate($this->editFlavorParam->getMaxFrameRate());
         $newFalvorParams->setWatermarkData($this->editFlavorParam->getWatermarkData());
         $newFalvorParams->setIsDefault(false);
         $newFalvorParams->setPartnerId(-1);
         $newFalvorParams->save();
         $this->redirect("system/flavorParams?pid=" . $this->pid . "&id=" . $newFalvorParams->getId());
     }
     if ($this->getRequestParameter("delete")) {
         if ($this->advanced || $this->editFlavorParam->getPartnerId() != 0) {
             $this->editFlavorParam->setDeletedAt(time());
             $this->editFlavorParam->save();
         }
         $this->redirect("system/flavorParams?pid=" . $this->pid);
     }
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         if ($this->advanced || $this->editFlavorParam->getPartnerId() != 0) {
             $partnerId = $this->getRequestParameter("partner-id");
             if ($this->advanced) {
                 $this->editFlavorParam->setPartnerId($partnerId);
             } else {
                 if ($partnerId != 0) {
                     $this->editFlavorParam->setPartnerId($partnerId);
                 }
             }
             if ($this->advanced >= 1) {
                 $this->editFlavorParam->setName($this->getRequestParameter("name"));
                 $this->editFlavorParam->setSystemName($this->getRequestParameter("systemName"));
                 $this->editFlavorParam->setDescription($this->getRequestParameter("description"));
                 $this->editFlavorParam->setIsDefault($this->getRequestParameter("is-default", false));
                 $this->editFlavorParam->setReadyBehavior($this->getRequestParameter("ready-behavior"));
                 $this->editFlavorParam->setTags($this->getRequestParameter("tags"));
                 $this->editFlavorParam->setSourceAssetParamsIds($this->getRequestParameter("sourceAssetParamsIds"));
                 $this->editFlavorParam->setFormat($this->getRequestParameter("format"));
                 $this->editFlavorParam->setTwoPass($this->getRequestParameter("two-pass", false));
                 $this->editFlavorParam->setRotate($this->getRequestParameter("rotate", false));
                 $this->editFlavorParam->setAspectRatioProcessingMode($this->getRequestParameter("aspectRatioProcessingMode", 0));
                 $this->editFlavorParam->setIsGopInSec($this->getRequestParameter("isGopInSec", 0));
                 $this->editFlavorParam->setForceFrameToMultiplication16($this->getRequestParameter("forceFrameToMultiplication16") ? "1" : "0");
                 $this->editFlavorParam->setIsAvoidVideoShrinkFramesizeToSource($this->getRequestParameter("isAvoidVideoShrinkFramesizeToSource", 0));
                 $this->editFlavorParam->setIsAvoidVideoShrinkBitrateToSource($this->getRequestParameter("isAvoidVideoShrinkBitrateToSource", 0));
                 $this->editFlavorParam->setIsVideoFrameRateForLowBrAppleHls($this->getRequestParameter("isVideoFrameRateForLowBrAppleHls", 0));
                 $this->editFlavorParam->setIsAvoidForcedKeyFrames($this->getRequestParameter("isAvoidForcedKeyFrames", 0));
                 $this->editFlavorParam->setMultiStream($this->getRequestParameter("multiStream", 0));
                 $this->editFlavorParam->setAnamorphicPixels($this->getRequestParameter("anamorphicPixels", 0));
                 $this->editFlavorParam->setWidth($this->getRequestParameter("width"));
                 $this->editFlavorParam->setHeight($this->getRequestParameter("height"));
                 $this->editFlavorParam->setVideoCodec($this->getRequestParameter("video-codec"));
                 $this->editFlavorParam->setVideoBitrate($this->getRequestParameter("video-bitrate"));
                 $this->editFlavorParam->setWatermarkData($this->getRequestParameter("watermarkData", 0));
                 $this->editFlavorParam->setFrameRate($this->getRequestParameter("frame-rate"));
                 $this->editFlavorParam->setMaxFrameRate($this->getRequestParameter("max-frame-rate"));
                 $this->editFlavorParam->setGopSize($this->getRequestParameter("gop-size"));
                 $this->editFlavorParam->setAudioCodec($this->getRequestParameter("audio-codec"));
                 $this->editFlavorParam->setAudioBitrate($this->getRequestParameter("audio-bitrate"));
                 $this->editFlavorParam->setAudioChannels($this->getRequestParameter("audio-channels"));
                 $this->editFlavorParam->setAudioSampleRate($this->getRequestParameter("audio-sample-rate"));
                 $this->editFlavorParam->setAudioResolution($this->getRequestParameter("audio-resolution"));
                 $this->editFlavorParam->setConversionEngines($this->getRequestParameter("conversion-engines"));
                 $this->editFlavorParam->setConversionEnginesExtraParams($this->getRequestParameter("conversion-engines-extra-params"));
                 $this->editFlavorParam->setOperators($this->getRequestParameter("operators"));
                 $this->editFlavorParam->setEngineVersion($this->getRequestParameter("engine-version"));
                 $this->editFlavorParam->setType($this->getRequestParameter("type"));
             }
             $this->editFlavorParam->save();
         }
         $this->redirect("system/flavorParams?pid=" . $this->editFlavorParam->getPartnerId());
     }
     $c = new Criteria();
     $c->add(assetParamsPeer::PARTNER_ID, array(0, $this->pid), Criteria::IN);
     $this->flavorParams = assetParamsPeer::doSelect($c);
     $this->formats = self::getEnumValues("flavorParams", "CONTAINER_FORMAT");
     $this->videoCodecs = self::getEnumValues("flavorParams", "VIDEO_CODEC");
     $this->audioCodecs = self::getEnumValues("flavorParams", "AUDIO_CODEC");
     $this->readyBehaviors = self::getEnumValues("flavorParamsConversionProfile", "READY_BEHAVIOR");
     $this->creationModes = self::getEnumValues("flavorParams", "CREATION_MODE");
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:flavorParamsAction.class.php

示例12: 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);
 }
开发者ID:DBezemer,项目名称:server,代码行数:39,代码来源:UnicornService.php

示例13: 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;
                 }
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:kBusinessPreConvertDL.php

示例14: attachAssetParamsResourceContainer

 /**
  * @param kAssetParamsResourceContainer $resource
  * @param entry $dbEntry
  * @param asset $dbAsset
  * @return asset
  * @throws KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND
  */
 protected function attachAssetParamsResourceContainer(kAssetParamsResourceContainer $resource, entry $dbEntry, asset $dbAsset = null)
 {
     $assetParams = assetParamsPeer::retrieveByPK($resource->getAssetParamsId());
     if (!$assetParams) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND, $resource->getAssetParamsId());
     }
     if (!$dbAsset) {
         $dbAsset = assetPeer::retrieveByEntryIdAndParams($dbEntry->getId(), $resource->getAssetParamsId());
     }
     $isNewAsset = false;
     if (!$dbAsset) {
         $isNewAsset = true;
         $dbAsset = assetPeer::getNewAsset($assetParams->getType());
         $dbAsset->setPartnerId($dbEntry->getPartnerId());
         $dbAsset->setEntryId($dbEntry->getId());
         $dbAsset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
         $dbAsset->setFlavorParamsId($resource->getAssetParamsId());
         $dbAsset->setFromAssetParams($assetParams);
         if ($assetParams->hasTag(assetParams::TAG_SOURCE)) {
             $dbAsset->setIsOriginal(true);
         }
     }
     $dbAsset->incrementVersion();
     $dbAsset->save();
     $dbAsset = $this->attachResource($resource->getResource(), $dbEntry, $dbAsset);
     if ($dbAsset && $isNewAsset && $dbAsset->getStatus() != asset::FLAVOR_ASSET_STATUS_IMPORTING) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
     }
     return $dbAsset;
 }
开发者ID:DBezemer,项目名称:server,代码行数:37,代码来源:KalturaEntryService.php

示例15: renderITunesFeed

 private function renderITunesFeed($state, $entry = null, $e = null, $moreItems = false)
 {
     switch ($state) {
         case self::STATE_HEADER:
             if (is_null($this->mimeType)) {
                 $flavor = assetParamsPeer::retrieveByPK($this->syndicationFeed->flavorParamId);
                 if (!$flavor) {
                     throw new Exception("flavor not found for id " . $this->syndicationFeed->flavorParamId);
                 }
                 switch ($flavor->getFormat()) {
                     case 'mp4':
                         $this->mimeType = 'video/mp4';
                         break;
                     case 'm4v':
                         $this->mimeType = 'video/x-m4v';
                         break;
                     case 'mov':
                         $this->mimeType = 'video/quicktime';
                         break;
                     default:
                         $this->mimeType = 'video/mp4';
                 }
             }
             $partner = PartnerPeer::retrieveByPK($this->syndicationFeed->partnerId);
             header("content-type: text/xml; charset=utf-8");
             '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL;
             $this->writeOpenXmlNode('rss', 0, array('xmlns:itunes' => "http://www.itunes.com/dtds/podcast-1.0.dtd", 'version' => "2.0"));
             $this->writeOpenXmlNode('channel', 1);
             $this->writeFullXmlNode('title', $this->stringToSafeXml($this->syndicationFeed->name), 2);
             $this->writeFullXmlNode('link', $this->syndicationFeed->feedLandingPage, 2);
             $this->writeFullXmlNode('language', $this->syndicationFeed->language, 2);
             $this->writeFullXmlNode('copyright', $partner->getName(), 2);
             $this->writeFullXmlNode('itunes:subtitle', $this->syndicationFeed->name, 2);
             $this->writeFullXmlNode('itunes:author', $this->syndicationFeed->feedAuthor, 2);
             $this->writeFullXmlNode('itunes:summary', $this->syndicationFeed->feedDescription, 2);
             $this->writeFullXmlNode('description', $this->syndicationFeed->feedDescription, 2);
             $this->writeOpenXmlNode('itunes:owner', 2);
             $this->writeFullXmlNode('itunes:name', $this->syndicationFeed->ownerName, 3);
             $this->writeFullXmlNode('itunes:email', $this->syndicationFeed->ownerEmail, 3);
             $this->writeClosingXmlNode('itunes:owner', 2);
             if ($this->syndicationFeed->feedImageUrl) {
                 $this->writeOpenXmlNode('image', 2);
                 $this->writeFullXmlNode('link', $this->syndicationFeed->feedLandingPage, 3);
                 $this->writeFullXmlNode('url', $this->syndicationFeed->feedLandingPage, 3);
                 $this->writeFullXmlNode('title', $this->syndicationFeed->name, 3);
                 $this->writeClosingXmlNode('image', 2);
                 $this->writeFullXmlNode('itunes:image', '', 2, array('href' => $this->syndicationFeed->feedImageUrl));
             }
             $categories = explode(',', $this->syndicationFeed->categories);
             $catTree = array();
             foreach ($categories as $category) {
                 if (!$category) {
                     continue;
                 }
                 if (strpos($category, '/')) {
                     $category_parts = explode('/', $category);
                     $catTree[$category_parts[0]][] = $category_parts[1];
                 } else {
                     $this->writeFullXmlNode('itunes:category', '', 2, array('text' => $category));
                 }
             }
             foreach ($catTree as $topCat => $subCats) {
                 if (!$topCat) {
                     continue;
                 }
                 $this->writeOpenXmlNode('itunes:category', 2, array('text' => $topCat));
                 foreach ($subCats as $cat) {
                     if (!$cat) {
                         continue;
                     }
                     $this->writeFullXmlNode('itunes:category', '', 3, array('text' => $cat));
                 }
                 $this->writeClosingXmlNode('itunes:category', 2);
             }
             break;
         case self::STATE_BODY:
             $url = $this->getFlavorAssetUrl($e);
             $this->writeOpenXmlNode('item', 2);
             $this->writeFullXmlNode('title', $this->stringToSafeXml($e->name), 3);
             $this->writeFullXmlNode('link', $this->syndicationFeed->landingPage . $e->id, 3);
             $this->writeFullXmlNode('guid', $url, 3);
             $this->writeFullXmlNode('pubDate', date('r', $e->createdAt), 3);
             $this->writeFullXmlNode('description', $this->stringToSafeXml($e->description), 3);
             $enclosure_attr = array('url' => $url, 'type' => $this->mimeType);
             $this->writeFullXmlNode('enclosure', '', 3, $enclosure_attr);
             $kuser = $entry->getkuser();
             if ($kuser && $kuser->getScreenName()) {
                 $this->writeFullXmlNode('itunes:author', $this->stringToSafeXml($kuser->getScreenName()), 3);
             }
             if ($e->description) {
                 $this->writeFullXmlNode('itunes:subtitle', $this->stringToSafeXml($e->description), 3);
                 $this->writeFullXmlNode('itunes:summary', $this->stringToSafeXml($e->description), 3);
             }
             $this->writeFullXmlNode('itunes:duration', $this->secondsToWords($e->duration), 3);
             $this->writeFullXmlNode('itunes:explicit', $this->syndicationFeed->adultContent, 3);
             $this->writeFullXmlNode('itunes:image', '', 3, array('href' => $e->thumbnailUrl . '/width/600/height/600/ext.jpg'));
             if ($e->tags) {
                 $this->writeFullXmlNode('itunes:keywords', $this->stringToSafeXml($e->tags), 3);
             }
             $this->writeClosingXmlNode('item', 2);
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:KalturaSyndicationFeedRenderer.php


注:本文中的assetParamsPeer::retrieveByPK方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。