예제 #1
0
 /**
  * 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 flattend 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 = flavorParamsPeer::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();
 }
예제 #2
0
파일: setSwf.php 프로젝트: richhl/kalturaCE
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
define('ROOT_DIR', realpath(dirname(__FILE__) . '/../../../'));
require_once ROOT_DIR . '/infra/bootstrap_base.php';
require_once ROOT_DIR . '/infra/KAutoloader.php';
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "document", "*"));
KAutoloader::setClassMapFilePath('../../cache/classMap.cache');
KAutoloader::register();
date_default_timezone_set(kConf::get("date_default_timezone"));
// America/New_York
KalturaLog::setLogger(new KalturaStdoutLogger());
DbManager::setConfig(kConf::getDB());
DbManager::initialize();
$flavorParams = null;
if ($flavorParamsId) {
    $flavorParams = flavorParamsPeer::retrieveByPK($flavorParamsId);
    if (!$flavorParams instanceof SwfFlavorParams) {
        echo "Flavor params id [{$flavorParamsId}] is not SWF flavor params\n";
        exit;
    }
    $flavorParams->setVersion($flavorParams->getVersion() + 1);
} else {
    $flavorParams = new SwfFlavorParams();
    $flavorParams->setVersion(1);
    $flavorParams->setFormat(flavorParams::CONTAINER_FORMAT_SWF);
}
$swfOperator = new kOperator();
$swfOperator->id = kConvertJobData::CONVERSION_ENGINE_PDF2SWF;
$pdfOperator = new kOperator();
$pdfOperator->id = kConvertJobData::CONVERSION_ENGINE_PDF_CREATOR;
$operators = new kOperatorSets();
예제 #3
0
 /**
  * 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
  * @return BatchJob 
  */
 public static function decideAddEntryFlavor(BatchJob $parentJob = null, $entryId, $flavorParamsId, &$errDescription)
 {
     KalturaLog::log("entryId [{$entryId}], flavorParamsId [{$flavorParamsId}]");
     $originalFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entryId);
     if (is_null($originalFlavorAsset)) {
         $errDescription = 'Original flavor asset not found';
         KalturaLog::log(__METHOD__ . " - " . $errDescription);
         return null;
     }
     if ($originalFlavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_READY) {
         $errDescription = 'Original flavor asset not ready';
         KalturaLog::log(__METHOD__ . " - " . $errDescription);
         return null;
     }
     $mediaInfoId = null;
     $mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($originalFlavorAsset->getId());
     if ($mediaInfo) {
         $mediaInfoId = $mediaInfo->getId();
     }
     $flavorParams = flavorParamsPeer::retrieveByPK($flavorParamsId);
     $flavor = self::validateFlavorAndMediaInfo($flavorParams, $mediaInfo, $errDescription);
     if (is_null($flavor)) {
         KalturaLog::log(__METHOD__ . " - 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();
     }
     $flavorAssetId = null;
     $flavorAsset = flavorAssetPeer::retrieveByEntryIdAndFlavorParams($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
     $flavorAsset = kBatchManager::createFlavorAsset($flavor, $partnerId, $entryId, $flavorAssetId);
     if (!$flavorAsset) {
         KalturaLog::err(__METHOD__ . " - 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 = flavorAssetPeer::retrieveByEntryId($entryId);
         $flavorAssets = flavorAssetPeer::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 = flavorParamsOutputPeer::retrieveByFlavorAssetId($tagedFlavorAsset->getId());
             if (is_null($flavorParamsOutput)) {
                 KalturaLog::log("Creating flavor params output for asset [" . $tagedFlavorAsset->getId() . "]");
                 $flavorParams = flavorParamsPeer::retrieveByPK($tagedFlavorAsset->getId());
                 $flavorParamsOutput = self::validateFlavorAndMediaInfo($flavorParams, $mediaInfo, $errDescription);
                 if (is_null($flavorParamsOutput)) {
                     KalturaLog::log(__METHOD__ . " - Failed to validate media info [{$errDescription}]");
                     continue;
                 }
             }
             if ($flavorParamsOutput) {
                 KalturaLog::log("Adding Collection flavor [" . $flavorParamsOutput->getId() . "] for asset [" . $tagedFlavorAsset->getId() . "]");
                 $flavors[$tagedFlavorAsset->getId()] = flavorParamsOutputPeer::retrieveByFlavorAssetId($tagedFlavorAsset->getId());
             }
         }
         if ($flavorAssetId) {
             KalturaLog::log("Updating Collection flavor [" . $flavor->getId() . "] for asset [" . $tagedFlavorAsset->getId() . "]");
             $flavors[$flavorAssetId] = $flavor;
         }
         switch ($collectionTag) {
             case flavorParams::TAG_ISM:
                 KalturaLog::log("Calling addConvertIsmCollectionJob with [" . count($flavors) . "] flavor params");
                 return kJobsManager::addConvertIsmCollectionJob($collectionTag, $srcSyncKey, $entry, $parentJob, $flavors, $dbConvertCollectionJob);
             default:
                 KalturaLog::log("Error: Invalid collection tag [{$collectionTag}]");
                 return null;
         }
     }
     $dbConvertFlavorJob = null;
     if ($parentJob) {
         $dbConvertFlavorJob = $parentJob->createChild(false);
         $dbConvertFlavorJob->setEntryId($entryId);
         $dbConvertFlavorJob->save();
     }
     return kJobsManager::addFlavorConvertJob($srcSyncKey, $flavor, $flavorAsset->getId(), $mediaInfoId, $parentJob, null, $dbConvertFlavorJob);
 }
예제 #4
0
 /**
  * Add and convert new Flavor Asset for Entry with specific Flavor Params
  * 
  * @action convert
  * @param string $entryId
  * @param int $flavorParamsId
  */
 public function convertAction($entryId, $flavorParamsId)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $flavorParamsDb = flavorParamsPeer::retrieveByPK($flavorParamsId);
     flavorParamsPeer::setDefaultCriteriaFilter();
     if (!$flavorParamsDb) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND, $flavorParamsId);
     }
     $validStatuses = array(entryStatus::ERROR_CONVERTING, entryStatus::PRECONVERT, entryStatus::READY);
     if (!in_array($dbEntry->getStatus(), $validStatuses)) {
         throw new KalturaAPIException(KalturaErrors::INVALID_ENTRY_STATUS);
     }
     $originalFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entryId);
     if (is_null($originalFlavorAsset) || $originalFlavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_READY) {
         throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
     }
     $err = "";
     kBusinessPreConvertDL::decideAddEntryFlavor(null, $dbEntry->getId(), $flavorParamsId, $err);
 }
 private function renderITunesFeed()
 {
     if (is_null($this->mimeType)) {
         $flavor = flavorParamsPeer::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);
     }
     while ($entry = $this->getNextEntry()) {
         $e = new KalturaMediaEntry();
         $e->fromObject($entry);
         $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);
     }
     $this->writeClosingXmlNode('channel', 1);
     $this->writeClosingXmlNode('rss');
 }
예제 #6
0
 /**
  * @param entry $entry
  * @param SimpleXMLElement $mrss
  * @param string $link
  * @param string $filterFlavors
  * @return SimpleXMLElement
  */
 public static function getEntryMrssXml(entry $entry, SimpleXMLElement $mrss = null, $link = null, $fitlerByFlovorParams = null)
 {
     if (!$mrss) {
         $mrss = new SimpleXMLElement('<item/>');
     }
     $mrss->addChild('entryId', $entry->getId());
     $mrss->addChild('createdAt', $entry->getCreatedAt(null));
     $mrss->addChild('title', self::stringToSafeXml($entry->getName()));
     $mrss->addChild('link', $link . $entry->getId());
     $mrss->addChild('type', $entry->getType());
     $mrss->addChild('licenseType', $entry->getLicenseType());
     $mrss->addChild('userId', $entry->getPuserId(true));
     $mrss->addChild('name', self::stringToSafeXml($entry->getName()));
     $mrss->addChild('description', self::stringToSafeXml($entry->getDescription()));
     $thumbnailUrl = $mrss->addChild('thumbnailUrl');
     $thumbnailUrl->addAttribute('url', $entry->getThumbnailUrl());
     $tags = $mrss->addChild('tags');
     foreach (explode(',', $entry->getTags()) as $tag) {
         $tags->addChild('tag', self::stringToSafeXml($tag));
     }
     $mrss->addChild('partnerData', self::stringToSafeXml($entry->getPartnerData()));
     $mrss->addChild('accessControlId', $entry->getAccessControlId());
     $categories = explode(',', $entry->getCategories());
     foreach ($categories as $category) {
         if ($category) {
             $mrss->addChild('category', self::stringToSafeXml($category));
         }
     }
     if ($entry->getStartDate(null)) {
         $mrss->addChild('startDate', $entry->getStartDate(null));
     }
     if ($entry->getEndDate(null)) {
         $mrss->addChild('endDate', $entry->getEndDate(null));
     }
     switch ($entry->getType()) {
         case entryType::MEDIA_CLIP:
             self::appendMediaEntryMrss($entry, $mrss);
             break;
         case entryType::MIX:
             self::appendMixEntryMrss($entry, $mrss);
             break;
         case entryType::PLAYLIST:
             self::appendPlaylistEntryMrss($entry, $mrss);
             break;
         case entryType::DATA:
             self::appendDataEntryMrss($entry, $mrss);
             break;
         case entryType::LIVE_STREAM:
             self::appendLiveStreamEntryMrss($entry, $mrss);
             break;
         default:
             break;
     }
     $flavorAssets = flavorAssetPeer::retreiveReadyByEntryId($entry->getId());
     foreach ($flavorAssets as $flavorAsset) {
         if (!is_null($fitlerByFlovorParams) && $flavorAsset->getFlavorParamsId() != $fitlerByFlovorParams) {
             continue;
         }
         $content = $mrss->addChild('content');
         $content->addAttribute('url', self::getAssetUrl($flavorAsset));
         $content->addAttribute('flavorAssetId', $flavorAsset->getId());
         $content->addAttribute('isSource', $flavorAsset->getIsOriginal() ? 'true' : 'false');
         $content->addAttribute('containerFormat', $flavorAsset->getContainerFormat());
         $content->addAttribute('extension', $flavorAsset->getFileExt());
         if (!is_null($flavorAsset->getFlavorParamsId())) {
             $content->addAttribute('flavorParamsId', $flavorAsset->getFlavorParamsId());
             $flavorParams = flavorParamsPeer::retrieveByPK($flavorAsset->getFlavorParamsId());
             if ($flavorParams) {
                 $content->addAttribute('flavorParamsName', $flavorParams->getName());
                 $content->addAttribute('format', $flavorParams->getFormat());
                 $content->addAttribute('videoBitrate', $flavorParams->getVideoBitrate());
                 $content->addAttribute('videoCodec', $flavorParams->getVideoCodec());
                 $content->addAttribute('audioBitrate', $flavorParams->getAudioBitrate());
                 $content->addAttribute('audioCodec', $flavorParams->getAudioCodec());
                 $content->addAttribute('frameRate', $flavorParams->getFrameRate());
                 $content->addAttribute('height', $flavorParams->getHeight());
                 $content->addAttribute('width', $flavorParams->getWidth());
             }
         }
         $tags = $content->addChild('tags');
         foreach (explode(',', $flavorAsset->getTags()) as $tag) {
             $tags->addChild('tag', self::stringToSafeXml($tag));
         }
     }
     $thumbAssets = thumbAssetPeer::retreiveReadyByEntryId($entry->getId());
     foreach ($thumbAssets as $thumbAsset) {
         $thumbnail = $mrss->addChild('thumbnail');
         $thumbnail->addAttribute('url', self::getAssetUrl($thumbAsset));
         $thumbnail->addAttribute('thumbAssetId', $thumbAsset->getId());
         $thumbnail->addAttribute('isDefault', $thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB) ? 'true' : 'false');
         $thumbnail->addAttribute('format', $thumbAsset->getContainerFormat());
         if ($thumbAsset->getFlavorParamsId()) {
             $thumbnail->addAttribute('thumbParamsId', $thumbAsset->getFlavorParamsId());
         }
         $tags = $thumbnail->addChild('tags');
         foreach (explode(',', $thumbAsset->getTags()) as $tag) {
             $tags->addChild('tag', self::stringToSafeXml($tag));
         }
     }
     $mrssContributors = self::getMrssContributors();
     if (count($mrssContributors)) {
         foreach ($mrssContributors as $mrssContributor) {
             $mrssContributor->contribute($entry, $mrss);
         }
     }
     return $mrss;
 }
예제 #7
0
 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;
     if ($this->getRequestParameter("id")) {
         $this->editFlavorParam = flavorParamsPeer::retrieveByPK($this->getRequestParameter("id"));
         if ($this->getRequestParameter("clone")) {
             $newFalvorParams = $this->editFlavorParam->copy();
             $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->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->setFormat($this->getRequestParameter("format"));
                     $this->editFlavorParam->setTwoPass($this->getRequestParameter("two-pass", false));
                     $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->setFrameRate($this->getRequestParameter("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->save();
             }
             $this->redirect("system/flavorParams?pid=" . $this->editFlavorParam->getPartnerId());
         }
     }
     $c = new Criteria();
     $c->add(flavorParamsPeer::PARTNER_ID, array(0, $this->pid), Criteria::IN);
     $this->flavorParams = flavorParamsPeer::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");
 }
예제 #8
0
파일: entry.php 프로젝트: richhl/kalturaCE
 /**
  * @param BatchJob $parentJob
  * @param int $flavorParamsId
  * @param string $puserId
  * @return int job id
  */
 public function createDownloadAsset(BatchJob $parentJob = null, $flavorParamsId, $puserId = null)
 {
     $job = null;
     if ($this->getType() == entryType::MIX) {
         // if flavor params == SOURCE, or no format defined for flavor params, default to 'flv'
         $flattenFormat = null;
         if ($flavorParamsId != 0) {
             $flattenFormat = flavorParamsPeer::retrieveByPK($flavorParamsId)->getFormat();
         }
         if (!$flattenFormat) {
             $flattenFormat = 'flv';
         }
         $job = myBatchFlattenClient::addJob($puserId, $this, $this->getVersion(), $flattenFormat);
     } else {
         $err = '';
         $job = kBusinessPreConvertDL::decideAddEntryFlavor($parentJob, $this->getId(), $flavorParamsId, $err);
     }
     if ($job) {
         return $job->getId();
     }
     return null;
 }
예제 #9
0
 /**
  * Delete Flavor Params by ID
  * 
  * @action delete
  * @param int $id
  */
 public function deleteAction($id)
 {
     $flavorParamsDb = flavorParamsPeer::retrieveByPK($id);
     if (!$flavorParamsDb) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND, $id);
     }
     $flavorParamsDb->setDeletedAt(time());
     $flavorParamsDb->save();
 }