コード例 #1
0
 /**
  * Add flavor asset
  *
  * @action add
  * @param string $entryId
  * @param KalturaFlavorAsset $flavorAsset
  * @return KalturaFlavorAsset
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  * @throws KalturaErrors::FLAVOR_ASSET_ALREADY_EXISTS
  * @validateUser entry entryId edit
  */
 function addAction($entryId, KalturaFlavorAsset $flavorAsset)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::MEDIA_CLIP || !in_array($dbEntry->getMediaType(), array(KalturaMediaType::VIDEO, KalturaMediaType::AUDIO))) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     if (!is_null($flavorAsset->flavorParamsId)) {
         $dbFlavorAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $flavorAsset->flavorParamsId);
         if ($dbFlavorAsset) {
             throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ALREADY_EXISTS, $dbFlavorAsset->getId(), $flavorAsset->flavorParamsId);
         }
     }
     if (!is_null($flavorAsset->flavorParamsId)) {
         $flavorParams = assetParamsPeer::retrieveByPK($flavorAsset->flavorParamsId);
     }
     $type = null;
     if ($flavorParams) {
         $type = $flavorParams->getType();
     }
     $dbFlavorAsset = flavorAsset::getInstance($type);
     $dbFlavorAsset = $flavorAsset->toInsertableObject($dbFlavorAsset);
     /* @var $dbFlavorAsset flavorAsset */
     if ($flavorParams && $flavorParams->hasTag(flavorParams::TAG_SOURCE)) {
         $dbFlavorAsset->setIsOriginal(true);
     }
     $dbFlavorAsset->setEntryId($entryId);
     $dbFlavorAsset->setPartnerId($dbEntry->getPartnerId());
     $dbFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_QUEUED);
     $dbFlavorAsset->save();
     $flavorAsset = KalturaFlavorAsset::getInstance($dbFlavorAsset, $this->getResponseProfile());
     return $flavorAsset;
 }
コード例 #2
0
ファイル: kFlowHelper.php プロジェクト: GElkayam/server
 /**
  * @param int $partnerId
  * @param string $entryId
  * @param string $msg
  * @return flavorAsset
  */
 public static function createOriginalFlavorAsset($partnerId, $entryId, &$msg = null)
 {
     $flavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
     if ($flavorAsset) {
         return $flavorAsset;
     }
     $entry = entryPeer::retrieveByPK($entryId);
     if (!$entry) {
         KalturaLog::err("Entry [{$entryId}] not found");
         return null;
     }
     // creates the flavor asset
     $flavorAsset = flavorAsset::getInstance();
     $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_QUEUED);
     $flavorAsset->incrementVersion();
     $flavorAsset->addTags(array(flavorParams::TAG_SOURCE));
     $flavorAsset->setIsOriginal(true);
     $flavorAsset->setFlavorParamsId(flavorParams::SOURCE_FLAVOR_ID);
     $flavorAsset->setPartnerId($partnerId);
     $flavorAsset->setEntryId($entryId);
     $flavorAsset->save();
     return $flavorAsset;
 }
コード例 #3
0
ファイル: kBatchManager.php プロジェクト: DBezemer/server
 /**
  * batch createFlavorAsset orgenize a convert job data 
  * 
  * @param flavorParamsOutputWrap $flavor
  * @param int $partnerId
  * @param int $entryId
  * @param string $description
  * @return flavorAsset
  */
 public static function createErrorFlavorAsset(flavorParamsOutputWrap $flavor, $partnerId, $entryId, $description)
 {
     $flavorAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $flavor->getFlavorParamsId());
     if ($flavorAsset) {
         $description = $flavorAsset->getDescription() . "\n" . $description;
         $flavorAsset->setDescription($description);
         //			$flavorAsset->incrementVersion();
     } else {
         // creates the flavor asset
         $flavorAsset = flavorAsset::getInstance($flavor->getType());
         $flavorAsset->setPartnerId($partnerId);
         $flavorAsset->setEntryId($entryId);
         $flavorAsset->setDescription($description);
     }
     $flavorAsset->setTags($flavor->getTags());
     $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
     $flavorAsset->setFlavorParamsId($flavor->getFlavorParamsId());
     $flavorAsset->setFileExt($flavor->getFileExt());
     $flavorAsset->save();
     // save flavor params
     $flavor->setPartnerId($partnerId);
     $flavor->setEntryId($entryId);
     $flavor->setFlavorAssetId($flavorAsset->getId());
     $flavor->setFlavorAssetVersion($flavorAsset->getVersion());
     $flavor->save();
     return $flavorAsset;
 }