Example #1
0
 /**
  * @param entry $entry
  * @return array<FileSyncKey>
  */
 protected function getEntrySyncKeys(entry $entry, StorageProfile $externalStorage)
 {
     $exportFileSyncsKeys = array();
     $exportFileSyncsKeys[] = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     $exportFileSyncsKeys[] = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
     $exportFileSyncsKeys[] = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
     $flavorAssets = array();
     $flavorParamsIds = $externalStorage->getFlavorParamsIds();
     KalturaLog::log(__METHOD__ . " flavorParamsIds [{$flavorParamsIds}]");
     if (is_null($flavorParamsIds) || !strlen(trim($flavorParamsIds))) {
         $flavorAssets = flavorAssetPeer::retreiveReadyByEntryId($entry->getId());
     } else {
         $flavorParamsArr = explode(',', $flavorParamsIds);
         KalturaLog::log(__METHOD__ . " flavorParamsIds count [" . count($flavorParamsArr) . "]");
         $flavorAssets = flavorAssetPeer::retreiveReadyByEntryIdAndFlavorParams($entry->getId(), $flavorParamsArr);
     }
     foreach ($flavorAssets as $flavorAsset) {
         $exportFileSyncsKeys[] = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     }
     return $exportFileSyncsKeys;
 }
Example #2
0
 /**
  * Copy entry into new entry
  * 
  * @action addFromEntry
  * @param string $sourceEntryId Media entry id to copy from
  * @param KalturaMediaEntry $mediaEntry Media entry metadata
  * @param int $sourceFlavorParamsId The flavor to be used as the new entry source, source flavor will be used if not specified
  * @return KalturaMediaEntry The new media entry
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  * @throws KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING
  * @throws KalturaErrors::FLAVOR_PARAMS_NOT_FOUND
  * @throws KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED
  */
 function addFromEntryAction($sourceEntryId, KalturaMediaEntry $mediaEntry = null, $sourceFlavorParamsId = null)
 {
     $srcEntry = entryPeer::retrieveByPK($sourceEntryId);
     if (!$srcEntry || $srcEntry->getType() != entryType::MEDIA_CLIP) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $sourceEntryId);
     }
     $srcFlavorAsset = null;
     if (is_null($sourceFlavorParamsId)) {
         $srcFlavorAsset = flavorAssetPeer::retreiveOriginalByEntryId($sourceEntryId);
         if (!$srcFlavorAsset) {
             throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
         }
     } else {
         $srcFlavorAssets = flavorAssetPeer::retreiveReadyByEntryIdAndFlavorParams($sourceEntryId, array($sourceFlavorParamsId));
         if (count($srcFlavorAssets)) {
             $srcFlavorAsset = reset($srcFlavorAssets);
         } else {
             throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_NOT_FOUND);
         }
     }
     if ($mediaEntry === null) {
         $mediaEntry = new KalturaMediaEntry();
     }
     $mediaEntry->mediaType = $srcEntry->getMediaType();
     return $this->addEntryFromFlavorAsset($mediaEntry, $srcEntry, $srcFlavorAsset);
 }