本文整理汇总了PHP中entry::getSyncKey方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::getSyncKey方法的具体用法?PHP entry::getSyncKey怎么用?PHP entry::getSyncKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::getSyncKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntrySyncKeys
/**
* @param entry $entry
* @return array<FileSyncKey>
*/
protected static 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}]");
$relevantStatuses = array(asset::ASSET_STATUS_READY, asset::ASSET_STATUS_EXPORTING);
if (is_null($flavorParamsIds) || !strlen(trim($flavorParamsIds))) {
$flavorAssets = assetPeer::retrieveFlavorsByEntryIdAndStatus($entry->getId(), null, $relevantStatuses);
} else {
$flavorParamsArr = explode(',', $flavorParamsIds);
KalturaLog::log(__METHOD__ . " flavorParamsIds count [" . count($flavorParamsArr) . "]");
$flavorAssets = assetPeer::retrieveFlavorsByEntryIdAndStatus($entry->getId(), $flavorParamsArr, $relevantStatuses);
}
foreach ($flavorAssets as $flavorAsset) {
if ($externalStorage->shouldExportFlavorAsset($flavorAsset)) {
$exportFileSyncsKeys[] = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
} else {
KalturaLog::log('Flavor asset id [' . $flavorAsset->getId() . '] should not be exported');
}
}
return $exportFileSyncsKeys;
}
示例2: initSilverLightManifest
protected function initSilverLightManifest($flavorAssets)
{
$key = $this->getFlavorKeyByTag($flavorAssets, assetParams::TAG_ISM_MANIFEST, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (!$key) {
$key = $this->entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
}
$localFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);
$remoteFileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key);
//To Remove - Until the migration process from asset sub type 3 to asset sub type 1 will be completed we need to support both formats
if (!$localFileSync && !$remoteFileSync) {
$key = $this->getFlavorKeyByTag($flavorAssets, assetParams::TAG_ISM_MANIFEST, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM);
$localFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);
$remoteFileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key);
}
if ($this->shouldUseLocalFlavors($localFileSync, $remoteFileSync)) {
$this->deliveryAttributes->setStorageId(null);
$this->deliveryAttributes->setManifestFileSync($localFileSync);
} else {
if ($remoteFileSync) {
$this->deliveryAttributes->setStorageId($remoteFileSync->getDc());
}
$this->deliveryAttributes->setManifestFileSync($remoteFileSync);
}
if (!$this->deliveryAttributes->getManifestFileSync()) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
}
示例3: serveSilverLight
/**
* @return kManifestRenderer
*/
private function serveSilverLight()
{
$duration = $this->entry->getDurationInt();
$syncKey = $this->entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
$manifestInfo = $this->getSmoothStreamUrl($syncKey);
$renderer = new kSilverLightManifestRenderer();
$renderer->entryId = $this->entryId;
$renderer->tokenizer = $this->tokenizer;
$renderer->flavor = $manifestInfo;
$renderer->duration = $duration;
return $renderer;
}
示例4: getEntrySyncKeys
/**
* @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;
}
示例5: getFileName
/**
* @param asset $asset
* @params entry $entry
* @return string
*/
public static function getFileName(entry $entry, flavorAsset $flavorAsset = null)
{
$fileExt = "";
$fileBaseName = $entry->getName();
if ($flavorAsset) {
$flavorParams = $flavorAsset->getFlavorParams();
if ($flavorParams) {
$fileBaseName = $fileBaseName . " (" . $flavorParams->getName() . ")";
}
$fileExt = $flavorAsset->getFileExt();
} else {
$syncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
if ($fileSync) {
$fileExt = $fileSync->getFileExt();
}
}
return array($fileBaseName, $fileExt);
}
示例6: serveSilverLight
private function serveSilverLight()
{
$duration = $this->entry->getDurationInt();
$flavors = $this->buildFlavorsArray($duration);
$streamType = self::PLAY_STREAM_TYPE_RECORDED;
$durationXml = $duration ? "<duration>{$duration}</duration>" : '';
$flvaorsXml = '';
foreach ($flavors as $flavor) {
$url = $flavor['url'];
$bitrate = isset($flavor['bitrate']) ? $flavor['bitrate'] : 0;
$width = isset($flavor['width']) ? $flavor['width'] : 0;
$height = isset($flavor['height']) ? $flavor['height'] : 0;
$url = htmlspecialchars($url);
$flvaorsXml .= "<media url=\"{$url}\" bitrate=\"{$bitrate}\" width=\"{$width}\" height=\"{$height}\"/>";
}
$url = '';
$syncKey = $this->entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
$url = $this->getSmoothStreamUrl($syncKey);
$url = htmlspecialchars($url);
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\t\t\t\t<manifest url=\"{$url}\">\n\t\t\t\t\t<id>{$this->entryId}</id>\n\t\t\t\t\t<streamType>{$streamType}</streamType>\n\t\t\t\t\t{$durationXml}\n\t\t\t\t\t{$flvaorsXml}\n\t\t\t\t</manifest>";
// header("Location: $url/manifest");
// die;
}
示例7: decideThumbGenerate
/**
* decideThumbGenerate is the decision layer for a single thumbnail generation
*
* @param entry $entry
* @param thumbParams $destThumbParams
* @param BatchJob $parentJob
* @return thumbAsset
*/
public static function decideThumbGenerate(entry $entry, thumbParams $destThumbParams, BatchJob $parentJob = null, $sourceAssetId = null, $runSync = false, $srcAsset = null)
{
if (is_null($srcAsset)) {
$srcAsset = self::getSourceAssetForGenerateThumbnail($sourceAssetId, $destThumbParams->getSourceParamsId(), $entry->getId());
if (is_null($srcAsset)) {
throw new APIException(APIErrors::FLAVOR_ASSET_IS_NOT_READY);
}
}
$errDescription = null;
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($srcAsset->getId());
$destThumbParamsOutput = self::validateThumbAndMediaInfo($destThumbParams, $mediaInfo, $errDescription);
if ($srcAsset->getType() == assetType::FLAVOR && is_null($destThumbParamsOutput->getVideoOffset())) {
$destThumbParamsOutput->setVideoOffset($entry->getThumbOffset());
}
$destThumbParamsOutput->setVideoOffset(min($destThumbParamsOutput->getVideoOffset(), $entry->getDuration()));
if (!$destThumbParamsOutput->getDensity()) {
$partner = $entry->getPartner();
if (!is_null($partner)) {
$destThumbParamsOutput->setDensity($partner->getDefThumbDensity());
}
}
$thumbAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $destThumbParams->getId());
if ($thumbAsset) {
$description = $thumbAsset->getDescription() . "\n" . $errDescription;
$thumbAsset->setDescription($description);
} else {
$thumbAsset = new thumbAsset();
$thumbAsset->setPartnerId($entry->getPartnerId());
$thumbAsset->setEntryId($entry->getId());
$thumbAsset->setDescription($errDescription);
$thumbAsset->setFlavorParamsId($destThumbParams->getId());
}
$thumbAsset->incrementVersion();
$thumbAsset->setTags($destThumbParamsOutput->getTags());
$thumbAsset->setFileExt($destThumbParamsOutput->getFileExt());
if ($thumbAsset->getStatus() != asset::ASSET_STATUS_READY) {
$thumbAsset->setStatus(asset::ASSET_STATUS_CONVERTING);
}
//Sets the default thumb if this the only default thumb
kBusinessPreConvertDL::setIsDefaultThumb($thumbAsset);
if (!$destThumbParamsOutput) {
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
$thumbAsset->save();
return null;
}
$thumbAsset->save();
// save flavor params
$destThumbParamsOutput->setPartnerId($entry->getPartnerId());
$destThumbParamsOutput->setEntryId($entry->getId());
$destThumbParamsOutput->setFlavorAssetId($thumbAsset->getId());
$destThumbParamsOutput->setFlavorAssetVersion($thumbAsset->getVersion());
$destThumbParamsOutput->save();
$srcSyncKey = $srcAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$srcAssetType = $srcAsset->getType();
if (!$runSync) {
$job = kJobsManager::addCapturaThumbJob($parentJob, $entry->getPartnerId(), $entry->getId(), $thumbAsset->getId(), $srcSyncKey, $srcAsset->getId(), $srcAssetType, $destThumbParamsOutput);
return $thumbAsset;
}
$errDescription = null;
// Since this method is called when trying to crop an existing thumbnail, need to add this check - thumbAssets have no mediaInfo.
$capturedPath = self::generateThumbnail($srcAsset, $destThumbParamsOutput, $errDescription, $mediaInfo ? $mediaInfo->getVideoRotation() : null);
// failed
if (!$capturedPath) {
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
$thumbAsset->setDescription($thumbAsset->getDescription() . "\n{$errDescription}");
$thumbAsset->save();
return $thumbAsset;
}
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_READY);
if (file_exists($capturedPath)) {
list($width, $height, $type, $attr) = getimagesize($capturedPath);
$thumbAsset->setWidth($width);
$thumbAsset->setHeight($height);
$thumbAsset->setSize(filesize($capturedPath));
}
$logPath = $capturedPath . '.log';
if (file_exists($logPath)) {
$thumbAsset->incLogFileVersion();
$thumbAsset->save();
// creats the file sync
$logSyncKey = $thumbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
kFileSyncUtils::moveFromFile($logPath, $logSyncKey);
KalturaLog::debug("Log archived file to: " . kFileSyncUtils::getLocalFilePathForKey($logSyncKey));
} else {
$thumbAsset->save();
}
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::moveFromFile($capturedPath, $syncKey);
KalturaLog::debug("Thumbnail archived file to: " . kFileSyncUtils::getLocalFilePathForKey($syncKey));
if ($thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
//.........这里部分代码省略.........
示例8: handleEntry
//.........这里部分代码省略.........
$entry->setMediaType($media_type);
$entry->setTags($tags ? $tags : $this->getParam('entry_tags'));
$entry->setSource($media_source);
$entry->setSourceId($this->getParam('entry_media_id'));
if ($media_date) {
$entry->setMediaDate($media_date);
}
// if source_link wasnt given use the entry_url HOWEVER, use it only if id doesnt contain @ which suggests the use of a password
$entry->setSourceLink($entry_source_link ? $entry_source_link : (strstr($entry_url, '@') ? "" : $entry_url));
if ($media_source == entry::ENTRY_MEDIA_SOURCE_FILE) {
$entry->setSourceLink("file:{$entry_fullPath}");
}
$entry->setLicenseType($this->getParam('entry_license'));
$entry->setCredit($this->getParam('entry_credit'));
$entry->setStatus($entry_status);
if ($duration !== null) {
$entry->setLengthInMsecs($duration);
}
if ($this->entry_id == 0) {
$entry->save();
$this->entry_id = $entry->getId();
}
// move thumb to final destination and set db entry
if ($media_type != entry::ENTRY_MEDIA_TYPE_AUDIO && $entry_thumbNum && $need_thumb) {
KalturaLog::debug("handleEntry: saving none audio thumb [{$thumbBigFullPath}]");
$entry->setThumbnail('.jpg');
if ($thumbBigFullPath) {
if ($media_type != entry::ENTRY_MEDIA_TYPE_IMAGE) {
myFileConverter::convertImage($thumbBigFullPath, $thumbFullPath);
}
/*$thumbBigFinalPath = $content.$entry->getBigThumbnailPath();
myContentStorage::moveFile($thumbBigFullPath, $thumbBigFinalPath, true , $should_copy );
*/
$entryThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
try {
if (!$should_copy) {
kFileSyncUtils::moveFromFile($thumbBigFullPath, $entryThumbKey);
} else {
kFileSyncUtils::copyFromFile($thumbBigFullPath, $entryThumbKey);
}
} catch (Exception $e) {
$entry->setStatus(entryStatus::ERROR_CONVERTING);
$entry->save();
throw $e;
}
}
}
// after extracting the thumb we can move the entry to its next destination
KalturaLog::debug("handleEntry: current status [" . $entry->getStatus() . "]");
// if needed a job will be submitted for importing external media sources
if ($entry->getStatus() == entryStatus::IMPORT) {
KalturaLog::debug("handleEntry: creating import job");
// changed by Tan-Tan, Nov 09 to support the new batch mechanism
kJobsManager::addImportJob(null, $this->entry_id, $this->partner_id, $entry_url);
// remarked by Tan-Tan
// $entry_fullPath = $content.'/content/imports/data/'.$this->entry_id.".".$ext;
// myContentStorage::fullMkdir($entry_fullPath);
//
// $batchClient = new myBatchUrlImportClient();
// $batchClient->addJob($this->entry_id, $entry_url, $entry_fullPath);
} else {
if ($entry->getStatus() == entryStatus::PRECONVERT) {
if (!$skip_conversion) {
// changed by Tan-Tan, Dec 09 to support the new batch mechanism
KalturaLog::debug("handleEntry: creating original flavor asset for pre convert");
$flavorAsset = kFlowHelper::createOriginalFlavorAsset($this->partner_id, $this->entry_id);
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:67,代码来源:myInsertEntryHelper.class.php
示例9: getBestSyncKeyForEntry
private function getBestSyncKeyForEntry(entry $entry)
{
$entryType = $entry->getType();
$entryMediaType = $entry->getMediaType();
$syncKey = null;
switch ($entryType) {
case entryType::MEDIA_CLIP:
switch ($entryMediaType) {
case entry::ENTRY_MEDIA_TYPE_IMAGE:
$syncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
break;
}
break;
}
return $syncKey;
}
示例10: copyEntry
public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
{
KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
$newEntry = $entry->copy();
$newEntry->setIntId(null);
if ($toPartner instanceof Partner) {
$newEntry->setPartnerId($toPartner->getId());
$newEntry->setSubpId($toPartner->getId() * 100);
$newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
$flavorParamsStr = $entry->getFlavorParamsIds();
$flavorParams = explode(',', $flavorParamsStr);
$newFlavorParams = array();
foreach ($flavorParams as $flavorParamsId) {
$newFlavorParamsId = kObjectCopyHandler::getMappedId('flavorParams', $flavorParamsId);
if (is_null($newFlavorParamsId)) {
$newFlavorParamsId = $flavorParamsId;
}
$newFlavorParams[] = $newFlavorParamsId;
}
$newEntry->setFlavorParamsIds(implode(',', $newFlavorParams));
}
$newKuser = null;
if (!$dontCopyUsers) {
// copy the kuser (if the same puser id exists its kuser will be used)
kuserPeer::setUseCriteriaFilter(false);
$kuser = $entry->getKuser();
$newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
$newEntry->setKuserId($newKuser->getId());
kuserPeer::setUseCriteriaFilter(true);
}
// copy the kshow
kshowPeer::setUseCriteriaFilter(false);
$kshow = $entry->getKshow();
if ($kshow) {
$newKshow = $kshow->copy();
$newKshow->setIntId(null);
$newKshow->setPartnerId($toPartner->getId());
$newKshow->setSubpId($toPartner->getId() * 100);
if ($newKuser) {
$newKshow->setProducerId($newKuser->getId());
}
$newKshow->save();
$newEntry->setKshowId($newKshow->getId());
}
kshowPeer::setUseCriteriaFilter(true);
// reset the statistics
myEntryUtils::resetEntryStatistics($newEntry);
// set the new partner id into the default category criteria filter
$defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
$oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
// save the entry
$newEntry->save();
// restore the original partner id in the default category criteria filter
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
// for any type that does not require assets:
$shouldCopyDataForNonClip = $entry->getType() != entryType::MEDIA_CLIP;
$shouldCopyDataForClip = false;
// only images get their data copied
if ($entry->getType() == entryType::MEDIA_CLIP) {
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
$shouldCopyDataForClip = true;
}
}
if ($shouldCopyDataForNonClip || $shouldCopyDataForClip) {
// copy the data
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
$to = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
KalturaLog::log("copyEntriesByType - copying entry data [" . $from . "] to [" . $to . "]");
kFileSyncUtils::softCopy($from, $to);
}
$ismFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
if (kFileSyncUtils::fileSync_exists($ismFrom)) {
$ismTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
KalturaLog::log("copying entry ism [" . $ismFrom . "] to [" . $ismTo . "]");
kFileSyncUtils::softCopy($ismFrom, $ismTo);
}
$ismcFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($ismcFrom)) {
$ismcTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
KalturaLog::log("copying entry ism [" . $ismcFrom . "] to [" . $ismcTo . "]");
kFileSyncUtils::softCopy($ismcFrom, $ismcTo);
}
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
// replaced__getThumbnailPath
$considerCopyThumb = true;
// if entry is image - data is thumbnail, and it was copied
if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$considerCopyThumb = false;
}
// if entry is not clip, and there is no file in both DCs - nothing to copy
if ($entry->getType() != entryType::MEDIA_CLIP && !kFileSyncUtils::file_exists($from, true)) {
$considerCopyThumb = false;
}
if ($considerCopyThumb) {
//.........这里部分代码省略.........
示例11: markFileSyncAsReady
private function markFileSyncAsReady(entry $entry)
{
// FileSync - mark file sync as ready for converted data file
$fileSyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
kFileSyncUtils::markLocalFileSyncAsReady($fileSyncKey);
// FileSync - mark file sync as ready for converted data file in edit flavor
$fileSyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT);
kFileSyncUtils::markLocalFileSyncAsReady($fileSyncKey, $strict = false);
// do not be strict, not all entries have EDIT file
}
示例12: copyEntryData
public static function copyEntryData(entry $entry, entry $targetEntry)
{
// for any type that does not require assets:
$shouldCopyDataForNonClip = true;
if ($entry->getType() == entryType::MEDIA_CLIP) {
$shouldCopyDataForNonClip = false;
}
if ($entry->getType() == entryType::PLAYLIST) {
$shouldCopyDataForNonClip = false;
}
$shouldCopyDataForClip = false;
// only images get their data copied
if ($entry->getType() == entryType::MEDIA_CLIP) {
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
$shouldCopyDataForClip = true;
}
}
if ($shouldCopyDataForNonClip || $shouldCopyDataForClip) {
// copy the data
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
$to = $targetEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
KalturaLog::log("copyEntriesByType - copying entry data [" . $from . "] to [" . $to . "]");
kFileSyncUtils::softCopy($from, $to);
}
$ismFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
if (kFileSyncUtils::fileSync_exists($ismFrom)) {
$ismTo = $targetEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
KalturaLog::log("copying entry ism [" . $ismFrom . "] to [" . $ismTo . "]");
kFileSyncUtils::softCopy($ismFrom, $ismTo);
}
$ismcFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($ismcFrom)) {
$ismcTo = $targetEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
KalturaLog::log("copying entry ism [" . $ismcFrom . "] to [" . $ismcTo . "]");
kFileSyncUtils::softCopy($ismcFrom, $ismcTo);
}
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
// replaced__getThumbnailPath
$considerCopyThumb = true;
// if entry is image - data is thumbnail, and it was copied
if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$considerCopyThumb = false;
}
// if entry is not clip, and there is no file in both DCs - nothing to copy
if ($entry->getType() != entryType::MEDIA_CLIP && !kFileSyncUtils::file_exists($from, true)) {
$considerCopyThumb = false;
}
if ($considerCopyThumb) {
$skipThumb = false;
// don't attempt to copy a thumbnail for images - it's the same as the data which was just created
if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_AUDIO) {
// check if audio entry has real thumb, if not - don't copy thumb.
$originalFileSync = kFileSyncUtils::getOriginFileSyncForKey($from, false);
if (!$originalFileSync) {
$skipThumb = true;
}
}
if (!$skipThumb) {
$to = $targetEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
// replaced__getThumbnailPath
KalturaLog::log("copyEntriesByType - copying entry thumbnail [" . $from . "] to [" . $to . "]");
kFileSyncUtils::softCopy($from, $to);
}
}
// added by Tan-Tan 12/01/2010 to support falvors copy
$sourceAssets = assetPeer::retrieveByEntryId($entry->getId());
foreach ($sourceAssets as $sourceAsset) {
$sourceAsset->copyToEntry($targetEntry->getId(), $targetEntry->getPartnerId());
}
}
示例13: attachRemoteStorageResource
/**
* @param IRemoteStorageResource $resource
* @param entry $dbEntry
* @param asset $dbAsset
* @return asset
* @throws KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED
* @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
*/
protected function attachRemoteStorageResource(IRemoteStorageResource $resource, entry $dbEntry, asset $dbAsset = null)
{
$resources = $resource->getResources();
$fileExt = $resource->getFileExt();
$dbEntry->setSource(KalturaSourceType::URL);
// TODO - move image handling to media service
if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
foreach ($resources as $currentResource) {
$storageProfile = StorageProfilePeer::retrieveByPK($currentResource->getStorageProfileId());
$fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $currentResource->getUrl(), $storageProfile);
}
$dbEntry->setStatus(entryStatus::READY);
$dbEntry->save();
return null;
}
$dbEntry->save();
$isNewAsset = false;
if (!$dbAsset) {
$isNewAsset = true;
$dbAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId());
}
if (!$dbAsset) {
KalturaLog::err("Flavor asset not created for entry [" . $dbEntry->getId() . "]");
if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
$dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
$dbEntry->save();
}
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED);
}
$syncKey = $dbAsset->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);
}
$dbAsset->setFileExt($fileExt);
if ($dbAsset instanceof flavorAsset && !$dbAsset->getIsOriginal()) {
$dbAsset->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
}
$dbAsset->save();
if ($isNewAsset) {
kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
}
kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAsset));
if ($dbAsset instanceof flavorAsset && !$dbAsset->getIsOriginal()) {
kBusinessPostConvertDL::handleConvertFinished(null, $dbAsset);
}
return $dbAsset;
}
示例14: addIsmLink
private static function addIsmLink(entry $entry, SimpleXMLElement $mrss)
{
if (self::$addedIsmUrl) {
return;
}
self::$addedIsmUrl = true;
$syncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
$kalturaFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
$urlManager = DeliveryProfilePeer::getDeliveryProfile($entry->getId(), PlaybackProtocol::SILVER_LIGHT);
if (!$urlManager) {
return;
}
$urlManager->initDeliveryDynamicAttributes($kalturaFileSync);
$partner = $entry->getPartner();
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
if ($kalturaFileSync) {
$urlPrefix = $urlManager->getUrl();
$url = $urlManager->getFileSyncUrl($kalturaFileSync, false);
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
}
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
return null;
}
$externalFileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if ($externalFileSync) {
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($externalFileSync->getDc(), $entry->getId(), PlaybackProtocol::SILVER_LIGHT));
if (is_null($urlManager)) {
return;
}
$url = $urlManager->getFileSyncUrl($externalFileSync, false);
$urlPrefix = $urlManager->getUrl();
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
if ($partner->getStorageServePriority() != StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) {
if ($kalturaFileSync) {
$url = $urlManager->getFileSyncUrl($kalturaFileSync, false);
$mrss->addChild('ismUrl', $urlPrefix . $url);
return;
}
}
}
示例15: copyEntry
//.........这里部分代码省略.........
if (isset($entryFilter->fields["_matchand_categories_ids"])) {
$categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
$entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
}
if (isset($entryFilter->fields["_matchor_categories_ids"])) {
$categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
$entryFilter->fields["_matchor_categories_ids"] = implode(",", $newCategoriesIds);
}
if (isset($entryFilter->fields["_in_category_ancestor_id"])) {
$categoriesIds = explode(",", $entryFilter->fields["_in_category_ancestor_id"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
$entryFilter->fields["_in_category_ancestor_id"] = implode(",", $newCategoriesIds);
}
$toEntryFilterXML = $toFiltersXml->addChild("filter");
$toEntryFilterXML = $entryFilter->toXml($toEntryFilterXML);
}
$newEntry->setDataContent($toPlaylistXml->asXML());
break;
}
}
if ($shouldCopyDataForNonClip || $shouldCopyDataForClip) {
// copy the data
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
$to = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
KalturaLog::log("copyEntriesByType - copying entry data [" . $from . "] to [" . $to . "]");
kFileSyncUtils::softCopy($from, $to);
}
$ismFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
if (kFileSyncUtils::fileSync_exists($ismFrom)) {
$ismTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
KalturaLog::log("copying entry ism [" . $ismFrom . "] to [" . $ismTo . "]");
kFileSyncUtils::softCopy($ismFrom, $ismTo);
}
$ismcFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($ismcFrom)) {
$ismcTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
KalturaLog::log("copying entry ism [" . $ismcFrom . "] to [" . $ismcTo . "]");
kFileSyncUtils::softCopy($ismcFrom, $ismcTo);
}
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
// replaced__getThumbnailPath
$considerCopyThumb = true;
// if entry is image - data is thumbnail, and it was copied
if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$considerCopyThumb = false;
}
// if entry is not clip, and there is no file in both DCs - nothing to copy
if ($entry->getType() != entryType::MEDIA_CLIP && !kFileSyncUtils::file_exists($from, true)) {
$considerCopyThumb = false;
}
if ($considerCopyThumb) {
$skipThumb = false;
// don't attempt to copy a thumbnail for images - it's the same as the data which was just created