本文整理汇总了PHP中kFileSyncUtils::getLocalFilePathForKey方法的典型用法代码示例。如果您正苦于以下问题:PHP kFileSyncUtils::getLocalFilePathForKey方法的具体用法?PHP kFileSyncUtils::getLocalFilePathForKey怎么用?PHP kFileSyncUtils::getLocalFilePathForKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFileSyncUtils
的用法示例。
在下文中一共展示了kFileSyncUtils::getLocalFilePathForKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doGetFlavorAssetUrl
/**
* @param flavorAsset $flavorAsset
* @return string
*/
protected function doGetFlavorAssetUrl(flavorAsset $flavorAsset)
{
$entry = $flavorAsset->getentry();
$partnerId = $entry->getPartnerId();
$subpId = $entry->getSubpId();
$flavorAssetId = $flavorAsset->getId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
$this->setFileExtension($flavorAsset->getFileExt());
$versionString = $this->getFlavorVersionString($flavorAsset);
$url = "/s{$partnerPath}/serveFlavor/entryId/" . $flavorAsset->getEntryId() . "{$versionString}/flavorId/{$flavorAssetId}";
if ($this->clipTo) {
$url .= "/clipTo/{$this->clipTo}";
}
if ($this->extention) {
$url .= "/name/a.{$this->extention}";
}
$url = str_replace('\\', '/', $url);
if ($this->protocol != StorageProfile::PLAY_FORMAT_RTMP) {
$url .= '?novar=0';
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$seekFromBytes = $this->getSeekFromBytes(kFileSyncUtils::getLocalFilePathForKey($syncKey));
if ($seekFromBytes) {
$url .= '&fs=' . $seekFromBytes;
}
} else {
if ($this->extention && strtolower($this->extention) != 'flv' || $this->containerFormat && strtolower($this->containerFormat) != 'flash video') {
$url = "mp4:{$url}";
}
}
return $url;
}
示例2: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaYoutubeApiDistributionProfile) {
return;
}
$flavorAssets = flavorAssetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
// if we have specific flavor assets for this distribution, grab the first one
$flavorAsset = reset($flavorAssets);
} else {
// take the source asset
$flavorAsset = flavorAssetPeer::retrieveOriginalReadyByEntryId($distributionJobData->entryDistribution->entryId);
}
if ($flavorAsset) {
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, true);
}
$thumbAssets = thumbAssetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$syncKey = reset($thumbAssets)->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, true);
}
$this->loadPlaylistsFromMetadata($distributionJobData->entryDistribution->entryId, $distributionJobData->distributionProfile);
$entryDistributionDb = EntryDistributionPeer::retrieveByPK($distributionJobData->entryDistributionId);
// if ($entryDistributionDb)
// $this->currentPlaylists = $entryDistributionDb->getFromCustomData('currentPlaylists');
// else
// KalturaLog::err('Entry distribution ['.$distributionJobData->entryDistributionId.'] not found');
}
示例3: addEcSeek
private function addEcSeek($url, $syncKey)
{
$seekTime = $this->params->getSeekFromTime();
if (!empty($seekTime)) {
// remove default seekFrom parameter
$url = preg_replace('/seekFrom\\/-?[0-9]*\\/?/', '', $url);
$url = rtrim($url, '/');
// check if seekFromTime is set to something significant
if ($seekTime > 0) {
// check if flv or not
$extension = $this->params->getFileExtension();
$containerFormat = $this->params->getContainerFormat();
$notFlvFormat = $extension && strtolower($extension) != 'flv' || $containerFormat && strtolower($containerFormat) != 'flash video';
if ($notFlvFormat) {
// not flv - add ec_seek value in seconds
$url .= '?ec_seek=' . $seekTime / 1000;
// convert milliseconds to seconds
} else {
// flv - add ec_seek value in bytes
$url .= '?ec_seek=' . $this->getSeekFromBytes(kFileSyncUtils::getLocalFilePathForKey($syncKey));
}
}
}
return $url;
}
示例4: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaUverseDistributionProfile) {
return;
}
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
// if we have specific flavor assets for this distribution, grab the first one
$flavorAsset = reset($flavorAssets);
} else {
// take the source asset
$flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($distributionJobData->entryDistribution->entryId);
}
if ($flavorAsset) {
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->localAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
$entryDistributionDb = EntryDistributionPeer::retrieveByPK($distributionJobData->entryDistributionId);
if ($entryDistributionDb) {
$this->remoteAssetUrl = $entryDistributionDb->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_URL);
$this->remoteAssetFileName = $entryDistributionDb->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_FILE_NAME);
} else {
KalturaLog::err('Entry distribution [' . $distributionJobData->entryDistributionId . '] not found');
}
}
示例5: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaDailymotionDistributionProfile) {
return;
}
$flavorAssets = flavorAssetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
// if we have specific flavor assets for this distribution, grab the first one
$flavorAsset = reset($flavorAssets);
} else {
// take the source asset
$flavorAsset = flavorAssetPeer::retrieveOriginalReadyByEntryId($distributionJobData->entryDistribution->entryId);
}
if ($flavorAsset) {
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, true);
}
$thumbAssets = thumbAssetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$syncKey = reset($thumbAssets)->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, true);
}
}
示例6: entryHandled
public function entryHandled(entry $dbEntry)
{
parent::entryHandled($dbEntry);
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($dbEntry->getId());
$syncKey = $originalFlavorAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$sourceFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
// call mediaInfo for file
$dbMediaInfo = new mediaInfo();
try {
$mediaInfoParser = new KMediaInfoMediaParser($sourceFilePath, kConf::get('bin_path_mediainfo'));
$mediaInfo = $mediaInfoParser->getMediaInfo();
$dbMediaInfo = $mediaInfo->toInsertableObject($dbMediaInfo);
$dbMediaInfo->setFlavorAssetId($originalFlavorAsset->getId());
$dbMediaInfo->save();
} catch (Exception $e) {
KalturaLog::err("Getting media info: " . $e->getMessage());
$dbMediaInfo = null;
}
// fix flavor asset according to mediainfo
if ($dbMediaInfo) {
KDLWrap::ConvertMediainfoCdl2FlavorAsset($dbMediaInfo, $originalFlavorAsset);
$flavorTags = KDLWrap::CDLMediaInfo2Tags($dbMediaInfo, array(flavorParams::TAG_WEB, flavorParams::TAG_MBR));
$originalFlavorAsset->setTags(implode(',', array_unique($flavorTags)));
}
$originalFlavorAsset->setStatusLocalReady();
$originalFlavorAsset->save();
$dbEntry->setStatus(entryStatus::READY);
$dbEntry->save();
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:29,代码来源:KalturaWebcamTokenResource.php
示例7: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaFreewheelGenericDistributionProfile) {
return;
}
$this->videoAssetFilePaths = new KalturaStringArray();
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
foreach ($flavorAssets as $flavorAsset) {
$videoAssetFilePath = new KalturaString();
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$videoAssetFilePath->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->videoAssetFilePaths[] = $videoAssetFilePath;
}
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$thumbAsset = reset($thumbAssets);
$syncKey = $thumbAssets->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
// entry cue points
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->add(CuePointPeer::PARTNER_ID, $distributionJobData->entryDistribution->partnerId);
$c->add(CuePointPeer::ENTRY_ID, $distributionJobData->entryDistribution->entryId);
$c->add(CuePointPeer::TYPE, AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD));
$c->addAscendingOrderByColumn(CuePointPeer::START_TIME);
$cuePointsDb = CuePointPeer::doSelect($c);
$this->cuePoints = KalturaCuePointArray::fromDbArray($cuePointsDb);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:38,代码来源:KalturaFreewheelGenericDistributionJobProviderData.php
示例8: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaQuickPlayDistributionProfile) {
return;
}
$this->videoFilePaths = new KalturaStringArray();
$this->thumbnailFilePaths = new KalturaStringArray();
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
$entry = entryPeer::retrieveByPK($distributionJobData->entryDistribution->entryId);
foreach ($flavorAssets as $asset) {
$syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$str = new KalturaString();
$str->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->videoFilePaths[] = $str;
}
}
foreach ($thumbAssets as $asset) {
$syncKey = $asset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$str = new KalturaString();
$str->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->thumbnailFilePaths[] = $str;
}
}
$feed = new QuickPlayFeed($distributionJobData, $this, $flavorAssets, $thumbAssets, $entry);
$this->xml = $feed->getXml();
}
示例9: getLocalThumbFilePath
public function getLocalThumbFilePath($version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $density = 0, $stripProfiles = false, $flavorId = null, $fileName = null)
{
if ($this->getStatus() == entryStatus::DELETED || $this->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK) {
KalturaLog::log("rejected live stream entry - not serving thumbnail");
KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
}
$contentPath = myContentStorage::getFSContentRootPath();
$liveEntryExist = false;
$liveThumbEntry = null;
$liveThumbEntryId = null;
$partner = $this->getPartner();
if ($partner) {
$liveThumbEntryId = $partner->getLiveThumbEntryId();
}
if ($liveThumbEntryId) {
$liveThumbEntry = entryPeer::retrieveByPK($liveThumbEntryId);
}
if ($liveThumbEntry && $liveThumbEntry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$fileSyncVersion = $partner->getLiveThumbEntryVersion();
$liveEntryKey = $liveThumbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $fileSyncVersion);
$contentPath = kFileSyncUtils::getLocalFilePathForKey($liveEntryKey);
if ($contentPath) {
$msgPath = $contentPath;
$liveEntryExist = true;
} else {
KalturaLog::err('no local file sync for audio entry id');
}
}
if (!$liveEntryExist) {
$msgPath = $contentPath . "content/templates/entry/thumbnail/live_thumb.jpg";
}
return myEntryUtils::resizeEntryImage($this, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $msgPath, $density, $stripProfiles);
}
示例10: getFlavorAssetUrl
/**
* @param flavorAsset $flavorAsset
* @return string
*/
public function getFlavorAssetUrl(flavorAsset $flavorAsset)
{
$entry = $flavorAsset->getentry();
$partnerId = $entry->getPartnerId();
$subpId = $entry->getSubpId();
$flavorAssetId = $flavorAsset->getId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
$this->setFileExtension($flavorAsset->getFileExt());
$url = "/s{$partnerPath}/serveFlavor/flavorId/{$flavorAssetId}";
if ($this->clipTo) {
$url .= "/clipTo/{$this->clipTo}";
}
if ($this->extention) {
$url .= "/name/{$flavorAssetId}.{$this->extention}";
}
$url = str_replace('\\', '/', $url);
if ($this->protocol != StorageProfile::PLAY_FORMAT_RTMP) {
$url .= '?novar=0';
$url .= '&e=' . (time() + 120);
$secret = $this->getMediaVault();
$fullUrl = $this->protocol . '://' . $this->domain . $url;
$url .= '&h=' . md5($secret . $fullUrl);
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$seekFromBytes = $this->getSeekFromBytes(kFileSyncUtils::getLocalFilePathForKey($syncKey));
if ($seekFromBytes) {
$url .= '&fs=' . $seekFromBytes;
}
} else {
$url .= '/forceproxy/true';
}
return $url;
}
示例11: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaHuluDistributionProfile) {
return;
}
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$flavorAsset = reset($flavorAssets);
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$thumbAsset = reset($thumbAssets);
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$additionalAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->assetIds));
$this->captionLocalPaths = new KalturaStringArray();
if (count($additionalAssets)) {
$captionAssetFilePathArray = array();
foreach ($additionalAssets as $additionalAsset) {
$assetType = $additionalAsset->getType();
$syncKey = $additionalAsset->getSyncKey(CaptionAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
if ($assetType == CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION) || $assetType == AttachmentPlugin::getAssetTypeCoreValue(AttachmentAssetType::ATTACHMENT)) {
$string = new KalturaString();
$string->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->captionLocalPaths[] = $string;
}
}
}
}
$tempFieldValues = unserialize($this->fieldValues);
$pattern = '/[^A-Za-z0-9_\\-]/';
$seriesTitle = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::SERIES_TITLE]);
$seasonNumber = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::SEASON_NUMBER]);
$videoEpisodeNumber = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::VIDEO_EPISODE_NUMBER]);
$videoTitle = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::VIDEO_TITLE]);
$this->fileBaseName = $seriesTitle . '-' . $seasonNumber . '-' . $videoEpisodeNumber . '-' . $videoTitle;
// entry cue points
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->add(CuePointPeer::PARTNER_ID, $distributionJobData->entryDistribution->partnerId);
$c->add(CuePointPeer::ENTRY_ID, $distributionJobData->entryDistribution->entryId);
$c->add(CuePointPeer::TYPE, AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD));
$c->addAscendingOrderByColumn(CuePointPeer::START_TIME);
$cuePointsDb = CuePointPeer::doSelect($c);
$this->cuePoints = KalturaCuePointArray::fromDbArray($cuePointsDb);
}
示例12: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaYahooDistributionProfile) {
return;
}
//Flavor Assets
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$videoAssetFilePathArray = array();
foreach ($flavorAssets as $flavorAsset) {
if ($flavorAsset) {
/* @var $flavorAsset flavorAsset */
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$id = $flavorAsset->getId();
//$this->videoAssetFilePath[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$videoAssetFilePathArray[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
}
$this->videoAssetFilePath = serialize($videoAssetFilePathArray);
}
//Thumbnails
$c = new Criteria();
$c->addAnd(assetPeer::ID, explode(',', $distributionJobData->entryDistribution->thumbAssetIds), Criteria::IN);
$c->addAscendingOrderByColumn(assetPeer::ID);
$thumbAssets = assetPeer::doSelect($c);
//$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets) >= 2) {
if ($thumbAssets[0]->getWidth() <= $thumbAssets[1]->getWidth()) {
$smallThumbAsset = $thumbAssets[0];
$largeThumbAsset = $thumbAssets[1];
} else {
$smallThumbAsset = $thumbAssets[1];
$largeThumbAsset = $thumbAssets[0];
}
$syncKey = $smallThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->smallThumbPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$syncKey = $largeThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->largeThumbPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
}
示例13: getDistributionFiles
protected function getDistributionFiles(FtpDistributionProfile $distributionProfileDb, EntryDistribution $entryDistributionDb)
{
$files = new KalturaFtpDistributionFileArray();
$sendMetadataAfterAssets = false;
if (!is_null($distributionProfileDb->getSendMetadataAfterAssets())) {
$sendMetadataAfterAssets = $distributionProfileDb->getSendMetadataAfterAssets();
}
if (!$distributionProfileDb->getDisableMetadata()) {
$metadataFile = new KalturaFtpDistributionFile();
$metadataXml = $distributionProfileDb->getMetadataXml($entryDistributionDb);
$metadataFile->filename = $distributionProfileDb->getMetadataFilename($entryDistributionDb);
$metadataFile->contents = $metadataXml;
$metadataFile->assetId = 'metadata';
$metadataFile->hash = md5($metadataXml);
if (!$sendMetadataAfterAssets) {
$files[] = $metadataFile;
}
}
$flavorAssetsIds = explode(',', $entryDistributionDb->getFlavorAssetIds());
$thumbnailAssetIds = explode(',', $entryDistributionDb->getThumbAssetIds());
$assetIds = explode(',', $entryDistributionDb->getAssetIds());
$assets = assetPeer::retrieveByIds(array_merge($flavorAssetsIds, $thumbnailAssetIds, $assetIds));
KalturaLog::log("Assets to distribute: " . print_r($assets, true));
foreach ($assets as $asset) {
/* @var $assets asset */
$syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$file = new KalturaFtpDistributionFile();
$file->assetId = $asset->getId();
$file->localFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$file->version = $syncKey->getVersion();
$defaultFilename = pathinfo($file->localFilePath, PATHINFO_BASENAME);
if ($asset instanceof thumbAsset) {
$file->filename = $distributionProfileDb->getThumbnailAssetFilename($entryDistributionDb, $defaultFilename, $asset->getId());
} else {
if ($asset instanceof flavorAsset) {
$file->filename = $distributionProfileDb->getFlavorAssetFilename($entryDistributionDb, $defaultFilename, $asset->getId());
} else {
$file->filename = $distributionProfileDb->getAssetFilename($entryDistributionDb, $defaultFilename, $asset->getId());
}
}
$files[] = $file;
}
//sending metadata after assets as configured in the connector profile
if ($metadataFile && $sendMetadataAfterAssets) {
$files[] = $metadataFile;
}
return $files;
}
示例14: updatedFileSyncImportFinished
/**
* Update relevant filesync as READY
*
* @param BatchJob $dbBatchJob
* @param kFileSyncImportJobData $data
* @param BatchJob $twinJob
* @throws KalturaAPIException
* @return BatchJob
*/
protected function updatedFileSyncImportFinished(BatchJob $dbBatchJob, kFileSyncImportJobData $data, BatchJob $twinJob = null)
{
$fileSyncId = $data->getFilesyncId();
if (!$fileSyncId) {
KalturaLog::err('File sync ID not found in job data.');
throw new KalturaAPIException(MultiCentersErrors::INVALID_FILESYNC_ID);
}
$fileSync = FileSyncPeer::retrieveByPK($fileSyncId);
if (!$fileSync) {
KalturaLog::err("Invalid filesync record with id [{$fileSyncId}]");
throw new KalturaAPIException(MultiCentersErrors::INVALID_FILESYNC_RECORD, $fileSyncId);
}
$fileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
$fileSync->setFileSizeFromPath(kFileSyncUtils::getLocalFilePathForKey(kFileSyncUtils::getKeyForFileSync($fileSync)));
$fileSync->save();
return $dbBatchJob;
}
示例15: addAction
/**
* Add new bulk upload batch job
* Conversion profile id can be specified in the API or in the CSV file, the one in the CSV file will be stronger.
* If no conversion profile was specified, partner's default will be used
*
* @action add
* @param int $conversionProfileId Convertion profile id to use for converting the current bulk (-1 to use partner's default)
* @param file $csvFileData CSV File
* @return KalturaBulkUpload
*/
function addAction($conversionProfileId, $csvFileData)
{
// first we copy the file to "content/batchfiles/[partner_id]/"
$origFilename = $csvFileData["name"];
$fileInfo = pathinfo($origFilename);
$extension = strtolower($fileInfo["extension"]);
if ($extension != "csv") {
throw new KalturaAPIException(KalturaErrors::INVALID_FILE_EXTENSION);
}
$job = new BatchJob();
$job->setPartnerId($this->getPartnerId());
$job->save();
$syncKey = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADCSV);
// kFileSyncUtils::file_put_contents($syncKey, file_get_contents($csvFileData["tmp_name"]));
try {
kFileSyncUtils::moveFromFile($csvFileData["tmp_name"], $syncKey, true);
} catch (Exception $e) {
throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_CREATE_CSV_FILE_SYNC_ERROR);
}
$csvPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
$data = new KalturaBulkUploadJobData();
$data->csvFilePath = $csvPath;
$data->userId = $this->getKuser()->getPuserId();
$data->uploadedBy = $this->getKuser()->getScreenName();
if ($conversionProfileId === -1) {
$conversionProfileId = $this->getPartner()->getDefaultConversionProfileId();
}
$kmcVersion = $this->getPartner()->getKmcVersion();
$check = null;
if ($kmcVersion < 2) {
$check = ConversionProfilePeer::retrieveByPK($conversionProfileId);
} else {
$check = conversionProfile2Peer::retrieveByPK($conversionProfileId);
}
if (!$check) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
}
$data->conversionProfileId = $conversionProfileId;
$dbJob = kJobsManager::addJob($job, $data->toObject(), KalturaBatchJobType::BULKUPLOAD);
$bulkUpload = new KalturaBulkUpload();
$bulkUpload->fromObject($dbJob);
return $bulkUpload;
}