本文整理汇总了PHP中kFileSyncUtils::createReadyExternalSyncFileForKey方法的典型用法代码示例。如果您正苦于以下问题:PHP kFileSyncUtils::createReadyExternalSyncFileForKey方法的具体用法?PHP kFileSyncUtils::createReadyExternalSyncFileForKey怎么用?PHP kFileSyncUtils::createReadyExternalSyncFileForKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFileSyncUtils
的用法示例。
在下文中一共展示了kFileSyncUtils::createReadyExternalSyncFileForKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attachRemoteStorageResource
/**
* @param AttachmentAsset $attachmentAsset
* @param IRemoteStorageResource $contentResource
* @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
*/
protected function attachRemoteStorageResource(AttachmentAsset $attachmentAsset, IRemoteStorageResource $contentResource)
{
$resources = $contentResource->getResources();
$attachmentAsset->setFileExt($contentResource->getFileExt());
$attachmentAsset->incrementVersion();
$attachmentAsset->setStatus(AttachmentAsset::ASSET_STATUS_READY);
$attachmentAsset->save();
$syncKey = $attachmentAsset->getSyncKey(AttachmentAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
foreach ($resources as $currentResource) {
$storageProfile = StorageProfilePeer::retrieveByPK($currentResource->getStorageProfileId());
$fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $currentResource->getUrl(), $storageProfile);
}
}
示例2: 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;
}
示例3: handleAdditionalFilesConvertFinished
/**
*
* 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: attachRemoteStorageResource
/**
* @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);
}
示例5: attachRemoteAssetResource
protected function attachRemoteAssetResource(entry $entry, kDistributionSubmitJobData $data)
{
$distributionProfile = DistributionProfilePeer::retrieveByPK($data->getDistributionProfileId());
/* @var $distributionProfile UnicornDistributionProfile */
$domainGuid = $distributionProfile->getDomainGuid();
$applicationGuid = $distributionProfile->getAdFreeApplicationGuid();
$assetParamsId = $distributionProfile->getRemoteAssetParamsId();
$mediaItemGuid = $data->getRemoteId();
$url = "{$domainGuid}/{$applicationGuid}/{$mediaItemGuid}/content.m3u8";
$entry->setSource(KalturaSourceType::URL);
$entry->save();
$isNewAsset = false;
$asset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $assetParamsId);
if (!$asset) {
$isNewAsset = true;
$assetParams = assetParamsPeer::retrieveByPK($assetParamsId);
$asset = assetPeer::getNewAsset($assetParams->getType());
$asset->setPartnerId($entry->getPartnerId());
$asset->setEntryId($entry->getId());
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
$asset->setFlavorParamsId($assetParamsId);
$asset->setFromAssetParams($assetParams);
if ($assetParams->hasTag(assetParams::TAG_SOURCE)) {
$asset->setIsOriginal(true);
}
}
$asset->incrementVersion();
$asset->setFileExt('m3u8');
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
$asset->save();
$syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$storageProfile = StorageProfilePeer::retrieveByPK($distributionProfile->getStorageProfileId());
$fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $url, $storageProfile);
if ($isNewAsset) {
kEventsManager::raiseEvent(new kObjectAddedEvent($asset));
}
kEventsManager::raiseEvent(new kObjectDataChangedEvent($asset));
kBusinessPostConvertDL::handleConvertFinished(null, $asset);
}
示例6: handleConvertFinished
/**
* @param BatchJob $dbBatchJob
* @param kConvertJobData $data
* @param BatchJob $twinJob
* @return BatchJob
*/
public static function handleConvertFinished(BatchJob $dbBatchJob, kConvertJobData $data, BatchJob $twinJob = null)
{
KalturaLog::debug("Convert finished with destination file: " . $data->getDestFileSyncLocalPath());
if ($dbBatchJob->getAbort()) {
kWAMS::getInstance($dbBatchJob->getPartnerId())->deleteAssetById($data->getDestFileSyncWamsAssetId());
return $dbBatchJob;
}
// verifies that flavor asset created
if (!$data->getFlavorAssetId()) {
throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $data->getFlavorAssetId());
}
$flavorAsset = assetPeer::retrieveById($data->getFlavorAssetId());
// verifies that flavor asset exists
if (!$flavorAsset) {
throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $data->getFlavorAssetId());
}
$flavorAsset->incrementVersion();
$flavorAsset->save();
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$flavorParamsOutput = $data->getFlavorParamsOutput();
$storageProfileId = $flavorParamsOutput->getSourceRemoteStorageProfileId();
if ($storageProfileId == StorageProfile::STORAGE_KALTURA_DC) {
$destFileSyncWamsAssetId = $data->getDestFileSyncWamsAssetId();
if (!empty($destFileSyncWamsAssetId)) {
kFileSyncUtils::addFromWAMS($destFileSyncWamsAssetId, $syncKey);
} else {
kFileSyncUtils::moveFromFile($data->getDestFileSyncLocalPath(), $syncKey);
}
} elseif ($flavorParamsOutput->getRemoteStorageProfileIds()) {
$remoteStorageProfileIds = explode(',', $flavorParamsOutput->getRemoteStorageProfileIds());
foreach ($remoteStorageProfileIds as $remoteStorageProfileId) {
$storageProfile = StorageProfilePeer::retrieveByPK($remoteStorageProfileId);
kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $data->getDestFileSyncLocalPath(), $storageProfile);
}
}
// creats the file sync
if (file_exists($data->getLogFileSyncLocalPath())) {
$logSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
try {
kFileSyncUtils::moveFromFile($data->getLogFileSyncLocalPath(), $logSyncKey);
} catch (Exception $e) {
$err = 'Saving conversion log: ' . $e->getMessage();
KalturaLog::err($err);
$desc = $dbBatchJob->getDescription() . "\n" . $err;
$dbBatchJob->getDescription($desc);
}
}
if ($storageProfileId == StorageProfile::STORAGE_KALTURA_DC) {
$data->setDestFileSyncLocalPath(kFileSyncUtils::getLocalFilePathForKey($syncKey));
KalturaLog::debug("Convert archived file to: " . $data->getDestFileSyncLocalPath());
// save the data changes to the db
$dbBatchJob->setData($data);
$dbBatchJob->save();
}
$entry = $dbBatchJob->getEntry();
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $dbBatchJob, $dbBatchJob->getEntryId());
}
$offset = $entry->getThumbOffset();
// entry getThumbOffset now takes the partner DefThumbOffset into consideration
$createThumb = $entry->getCreateThumb();
$extractMedia = true;
if ($entry->getType() != entryType::MEDIA_CLIP) {
// e.g. document
$extractMedia = false;
}
$rootBatchJob = $dbBatchJob->getRootJob();
if ($extractMedia && $rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
$rootBatchJobData = $rootBatchJob->getData();
if ($rootBatchJobData instanceof kConvertProfileJobData) {
$extractMedia = $rootBatchJobData->getExtractMedia();
}
}
// For apple http flavors do not attempt to get thumbs and media info,
// It is up to the operator to provide that kind of data, rather than hardcoded check
// To-fix
if ($flavorParamsOutput->getFormat() == assetParams::CONTAINER_FORMAT_APPLEHTTP) {
$createThumb = false;
$extractMedia = false;
}
if ($createThumb && in_array($flavorParamsOutput->getVideoCodec(), self::$thumbUnSupportVideoCodecs)) {
$createThumb = false;
}
$operatorSet = new kOperatorSets();
$operatorSet->setSerialized(stripslashes($flavorParamsOutput->getOperators()));
// KalturaLog::debug("Operators: ".$flavorParamsOutput->getOperators()
// ."\ngetCurrentOperationSet:".$data->getCurrentOperationSet()
// ."\ngetCurrentOperationIndex:".$data->getCurrentOperationIndex());
// KalturaLog::debug("Operators set: " . print_r($operatorSet, true));
$nextOperator = $operatorSet->getOperator($data->getCurrentOperationSet(), $data->getCurrentOperationIndex() + 1);
$nextJob = null;
if ($nextOperator) {
// KalturaLog::debug("Found next operator");
$nextJob = kJobsManager::addFlavorConvertJob($syncKey, $flavorParamsOutput, $data->getFlavorAssetId(), $data->getMediaInfoId(), $dbBatchJob, $dbBatchJob->getJobSubType());
//.........这里部分代码省略.........