コード例 #1
0
ファイル: kFlowHelper.php プロジェクト: richhl/kalturaCE
 /**
  * @param int $partnerId
  * @param string $entryId
  * @param string $msg
  * @return flavorAsset
  */
 public static function createOriginalFlavorAsset($partnerId, $entryId, &$msg = null)
 {
     $flavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entryId);
     if ($flavorAsset) {
         $flavorAsset->incrementVersion();
         $flavorAsset->save();
         return $flavorAsset;
     }
     $entry = entryPeer::retrieveByPK($entryId);
     if (!$entry) {
         KalturaLog::err("Entry [{$entryId}] not found");
         return null;
     }
     // creates the flavor asset
     $flavorAsset = new flavorAsset();
     $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_QUEUED);
     $flavorAsset->incrementVersion();
     $flavorAsset->setIsOriginal(true);
     $flavorAsset->setPartnerId($partnerId);
     $flavorAsset->setEntryId($entryId);
     //		// 2010-11-08 - Solved by Tan-Tan in DocumentCreatedHandler::objectAdded
     //		// 2010-10-17 - Hotfix by Dor - source document asset with no conversion profile should be in status READY
     //		if ($entry->getType() == entryType::DOCUMENT)
     //		{
     //			if (is_null($entry->conversionProfileId))
     //			{
     //				$flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_READY);
     //			}
     //		}
     //		// ----- hotfix end
     $flavorAsset->save();
     return $flavorAsset;
 }
コード例 #2
0
 /**
  * @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) {
         //			$flavorAsset->incrementVersion();
         $flavorAsset->save();
         return $flavorAsset;
     }
     $entry = entryPeer::retrieveByPK($entryId);
     if (!$entry) {
         KalturaLog::err("Entry [{$entryId}] not found");
         return null;
     }
     // creates the flavor asset
     $flavorAsset = new flavorAsset();
     $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_QUEUED);
     $flavorAsset->incrementVersion();
     $flavorAsset->setIsOriginal(true);
     $flavorAsset->setPartnerId($partnerId);
     $flavorAsset->setEntryId($entryId);
     $flavorAsset->save();
     return $flavorAsset;
 }
コード例 #3
0
ファイル: kFlowHelper.php プロジェクト: GElkayam/server
 /**
  * 
  * Allows to create additional files in the conversion process in addition to flavor asset 
  */
 private static function handleAdditionalFilesConvertFinished(flavorAsset $flavorAsset, BatchJob $dbBatchJob, kConvertJobData $data)
 {
     if (!$flavorAsset->getVersion() || !kFileSyncUtils::fileSync_exists($flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET))) {
         $flavorAsset->incrementVersion();
         $flavorAsset->save();
     }
     foreach ($data->getExtraDestFileSyncs() as $destFileSyncDesc) {
         $syncKey = $flavorAsset->getSyncKey($destFileSyncDesc->getFileSyncObjectSubType());
         $flavorParamsOutput = $data->getFlavorParamsOutput();
         $storageProfileId = $flavorParamsOutput->getSourceRemoteStorageProfileId();
         if ($storageProfileId == StorageProfile::STORAGE_KALTURA_DC) {
             kFileSyncUtils::moveFromFile($destFileSyncDesc->getFileSyncLocalPath(), $syncKey, false);
         } elseif ($flavorParamsOutput->getRemoteStorageProfileIds()) {
             $remoteStorageProfileIds = explode(',', $flavorParamsOutput->getRemoteStorageProfileIds());
             foreach ($remoteStorageProfileIds as $remoteStorageProfileId) {
                 $storageProfile = StorageProfilePeer::retrieveByPK($remoteStorageProfileId);
                 kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $destFileSyncDesc->getFileSyncLocalPath(), $storageProfile);
             }
         }
     }
 }
コード例 #4
0
 /**
  * @param flavorAsset $flavorAsset
  * @param IRemoteStorageResource $contentResource
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  */
 protected function attachRemoteStorageResource(flavorAsset $flavorAsset, IRemoteStorageResource $contentResource)
 {
     $resources = $contentResource->getResources();
     $flavorAsset->setFileExt($contentResource->getFileExt());
     $flavorAsset->incrementVersion();
     $flavorAsset->save();
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     foreach ($resources as $currentResource) {
         $storageProfile = StorageProfilePeer::retrieveByPK($currentResource->getStorageProfileId());
         $fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $currentResource->getUrl(), $storageProfile);
     }
     if ($flavorAsset->getIsOriginal()) {
         $flavorAsset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
     } else {
         $flavorAsset->setStatusLocalReady();
     }
     $flavorAsset->save();
     kBusinessPostConvertDL::handleConvertFinished(null, $flavorAsset);
 }