本文整理汇总了PHP中BatchJob::getEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP BatchJob::getEntry方法的具体用法?PHP BatchJob::getEntry怎么用?PHP BatchJob::getEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BatchJob
的用法示例。
在下文中一共展示了BatchJob::getEntry方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleConvertLiveSegmentJobFinished
private function handleConvertLiveSegmentJobFinished(BatchJob $dbBatchJob, kConvertLiveSegmentJobData $data)
{
$files = self::getAssetDataFilesArray($data);
$amfArray = unserialize(file_get_contents($files[0]));
$recordedVODDurationInMS = $amfArray[0];
array_shift($amfArray);
if (!unlink($files[0])) {
KalturaLog::warning("failed to delete file " . $files[0]);
}
$amfArray = self::parseAmfArrayAndShift($amfArray, 0);
self::copyCuePointsFromLiveToVodEntry($dbBatchJob->getEntry()->getRecordedEntryId(), $recordedVODDurationInMS, $recordedVODDurationInMS, $amfArray);
}
示例2: updatedJob
public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null)
{
if ($dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_PENDING) {
return true;
}
if ($dbBatchJob->getJobType() == BatchJobType::PROVISION_PROVIDE) {
$entry = $dbBatchJob->getEntry(false, false);
$partner = $entry->getPartner();
$limeLightLiveParamsJSON = $partner->getLiveStreamProvisionParams();
$limeLightLiveParams = json_decode($limeLightLiveParamsJSON);
if (!isset($limeLightLiveParams->Limelight) || !isset($limeLightLiveParams->Limelight->limelightPrimaryPublishUrl) || !isset($limeLightLiveParams->Limelight->limelightSecondaryPublishUrl) || !isset($limeLightLiveParams->Limelight->limelightStreamUrl)) {
kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FAILED);
return true;
}
$data = $dbBatchJob->getData();
$data->setPrimaryBroadcastingUrl($limeLightLiveParams->Limelight->limelightPrimaryPublishUrl);
$data->setSecondaryBroadcastingUrl($limeLightLiveParams->Limelight->limelightSecondaryPublishUrl);
$data->setRtmp($limeLightLiveParams->Limelight->limelightStreamUrl);
$data->setStreamName($entry->getId() . '_%i');
$dbBatchJob->setData($data);
}
kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
return true;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:24,代码来源:kLimeLightLiveFlowManager.php
示例3: decideProfileConvert
/**
* batch decideProfileConvert is the decision layer for a conversion profile
*
* @param BatchJob $parentJob
* @param BatchJob $convertProfileJob
* @param int $mediaInfoId
* @return bool true if created all required conversions
*/
public static function decideProfileConvert(BatchJob $parentJob, BatchJob $convertProfileJob, $mediaInfoId = null)
{
KalturaLog::log("Conversion decision layer used for entry [" . $parentJob->getEntryId() . "]");
$convertProfileData = $convertProfileJob->getData();
$entryId = $convertProfileJob->getEntryId();
$entry = $convertProfileJob->getEntry();
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $convertProfileJob, $entryId);
}
$profile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
if (!$profile) {
$errDescription = "Conversion profile for entryId [{$entryId}] not found";
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription, BatchJobType::CONVERT_PROFILE);
kBatchManager::updateEntry($convertProfileJob, entryStatus::ERROR_CONVERTING);
KalturaLog::err("No flavors created: {$errDescription}");
return false;
}
$originalFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entryId);
if (is_null($originalFlavorAsset)) {
$errDescription = 'Original flavor asset not found';
KalturaLog::err($errDescription);
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription, BatchJobType::CONVERT_PROFILE);
kBatchManager::updateEntry($convertProfileJob, entryStatus::ERROR_CONVERTING);
return false;
}
$shouldConvert = true;
// gets the list of flavor params of the conversion profile
$list = flavorParamsConversionProfilePeer::retrieveByConversionProfile($profile->getId());
if (!count($list)) {
$errDescription = "No flavors match the profile id [{$profile->getId()}]";
KalturaLog::err($errDescription);
$convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription, BatchJobType::CONVERT_PROFILE);
kBatchManager::updateEntry($convertProfileJob, entryStatus::ERROR_CONVERTING);
$originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
$originalFlavorAsset->setDeletedAt(time());
$originalFlavorAsset->save();
return false;
}
$mediaInfo = null;
if ($mediaInfoId) {
$mediaInfo = mediaInfoPeer::retrieveByPK($mediaInfoId);
}
if ($profile->getCreationMode() == ConversionProfile2::CONVERSION_PROFILE_2_CREATION_MODE_AUTOMATIC_BYPASS_FLV) {
KalturaLog::log("The profile created from old conversion profile with bypass flv");
$isFlv = false;
if ($mediaInfo) {
$isFlv = KDLWrap::CDLIsFLV($mediaInfo);
}
if ($isFlv && $originalFlavorAsset->hasTag(flavorParams::TAG_MBR)) {
KalturaLog::log("The source is mbr and flv, conversion will be bypassed");
$shouldConvert = false;
} else {
KalturaLog::log("The source is NOT mbr or flv, conversion will NOT be bypassed");
}
}
// gets the ids of the flavor params
$flavorsIds = array();
$conversionProfileFlavorParams = array();
foreach ($list as $flavorParamsConversionProfile) {
$flavorsId = $flavorParamsConversionProfile->getFlavorParamsId();
$flavorsIds[] = $flavorsId;
$conversionProfileFlavorParams[$flavorsId] = $flavorParamsConversionProfile;
}
$dynamicFlavorAttributes = $entry->getDynamicFlavorAttributes();
$sourceFlavor = null;
$flavors = flavorParamsPeer::retrieveByPKs($flavorsIds);
foreach ($flavors as $index => $flavor) {
if (isset($dynamicFlavorAttributes[$flavor->getId()])) {
foreach ($dynamicFlavorAttributes[$flavor->getId()] as $attributeName => $attributeValue) {
$flavor->setDynamicAttribute($attributeName, $attributeValue);
}
}
if ($flavor->hasTag(flavorParams::TAG_SOURCE)) {
$sourceFlavor = $flavor;
unset($flavors[$index]);
}
}
KalturaLog::log(count($flavors) . " destination flavors found for this profile[" . $profile->getId() . "]");
if (!$sourceFlavor) {
KalturaLog::log("Source flavor params not found");
$originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_TEMP);
$originalFlavorAsset->save();
} elseif ($shouldConvert) {
KalturaLog::log("Source flavor params [" . $sourceFlavor->getId() . "] found");
$originalFlavorAsset->setFlavorParamsId($sourceFlavor->getId());
if ($sourceFlavor->getOperators() || $sourceFlavor->getConversionEngines()) {
KalturaLog::log("Source flavor asset requires conversion");
$srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$errDescription = null;
$sourceFlavorOutput = self::validateFlavorAndMediaInfo($sourceFlavor, $mediaInfo, $errDescription);
// save flavor params
$sourceFlavorOutput->setPartnerId($sourceFlavorOutput->getPartnerId());
//.........这里部分代码省略.........
示例4: handleProvisionProvideFinished
public static function handleProvisionProvideFinished(BatchJob $dbBatchJob, kProvisionJobData $data, BatchJob $twinJob = null)
{
$entry = $dbBatchJob->getEntry();
$entry->setStreamUsername($data->getEncoderUsername());
$entry->setStreamUrl($data->getRtmp());
$entry->setStreamRemoteId($data->getStreamID());
$entry->setStreamRemoteBackupId($data->getBackupStreamID());
$entry->setPrimaryBroadcastingUrl($data->getPrimaryBroadcastingUrl());
$entry->setSecondaryBroadcastingUrl($data->getSecondaryBroadcastingUrl());
$entry->setStreamName($data->getStreamName());
kBatchManager::updateEntry($dbBatchJob, entryStatus::READY);
return $dbBatchJob;
}
示例5: decideProfileConvert
/**
* batch decideProfileConvert is the decision layer for a conversion profile
*
* @param BatchJob $parentJob
* @param BatchJob $convertProfileJob
* @param int $mediaInfoId
* @return bool true if created all required conversions
*/
public static function decideProfileConvert(BatchJob $parentJob, BatchJob $convertProfileJob, $mediaInfoId = null)
{
KalturaLog::log("Conversion decision layer used for entry [" . $parentJob->getEntryId() . "]");
$convertProfileData = $convertProfileJob->getData();
$entryId = $convertProfileJob->getEntryId();
$entry = $convertProfileJob->getEntry();
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $convertProfileJob, $entryId);
}
$profile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
if (!$profile) {
$errDescription = "Conversion profile for entryId [{$entryId}] not found";
self::setError($errDescription, $convertProfileJob, BatchJobType::CONVERT_PROFILE, $convertProfileJob->getEntryId());
return false;
}
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (is_null($originalFlavorAsset)) {
$errDescription = 'Original flavor asset not found';
self::setError($errDescription, $convertProfileJob, BatchJobType::CONVERT_PROFILE, $convertProfileJob->getEntryId());
return false;
}
// gets the list of flavor params of the conversion profile
$list = flavorParamsConversionProfilePeer::retrieveByConversionProfile($profile->getId());
if (!count($list)) {
$errDescription = "No flavors match the profile id [{$profile->getId()}]";
self::setError($errDescription, $convertProfileJob, BatchJobType::CONVERT_PROFILE, $convertProfileJob->getEntryId());
$originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
$originalFlavorAsset->setDeletedAt(time());
$originalFlavorAsset->save();
return false;
}
$mediaInfo = null;
if ($mediaInfoId) {
$mediaInfo = mediaInfoPeer::retrieveByPK($mediaInfoId);
}
$shouldConvert = self::shouldConvertProfileFlavors($profile, $mediaInfo, $originalFlavorAsset);
// gets the ids of the flavor params
$flavorsIds = array();
$conversionProfileFlavorParams = array();
foreach ($list as $flavorParamsConversionProfile) {
$flavorsId = $flavorParamsConversionProfile->getFlavorParamsId();
$flavorsIds[] = $flavorsId;
$conversionProfileFlavorParams[$flavorsId] = $flavorParamsConversionProfile;
}
KalturaLog::info("Flavors in conversion profile [" . implode(',', $flavorsIds) . "]");
$sourceFlavor = null;
$flavors = assetParamsPeer::retrieveFlavorsByPKs($flavorsIds);
$ingestedNeeded = self::checkConvertProfileParams($flavors, $conversionProfileFlavorParams, $entry, $sourceFlavor);
KalturaLog::log(count($flavors) . " destination flavors found for this profile[" . $profile->getId() . "]");
if (!$sourceFlavor) {
KalturaLog::log("Source flavor params not found");
$originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_TEMP);
$originalFlavorAsset->save();
/*
* Check for 'auto-intermediate-source
*/
$res = self::decideSourceFlavorConvert($entryId, null, $originalFlavorAsset, $profile->getId(), $flavors, $mediaInfo, $parentJob, $convertProfileJob);
if (!$res) {
$originalFlavorAsset->incrementInterFlowCount();
$originalFlavorAsset->save();
return false;
}
$originalFlavorAsset->removeInterFlowCount();
$originalFlavorAsset->save();
} elseif ($shouldConvert) {
KalturaLog::log("Source flavor params [" . $sourceFlavor->getId() . "] found");
$originalFlavorAsset->setFlavorParamsId($sourceFlavor->getId());
$res = self::decideSourceFlavorConvert($entryId, $sourceFlavor, $originalFlavorAsset, $profile->getId(), $flavors, $mediaInfo, $parentJob, $convertProfileJob);
if (!$res) {
$originalFlavorAsset->incrementInterFlowCount();
$originalFlavorAsset->save();
return false;
}
$originalFlavorAsset->removeInterFlowCount();
$originalFlavorAsset->setStatusLocalReady();
$originalFlavorAsset->save();
$entry->save();
kFlowHelper::generateThumbnailsFromFlavor($parentJob->getEntryId(), $parentJob);
}
if (!count($flavors)) {
$shouldConvert = false;
}
if (!$shouldConvert) {
if ($ingestedNeeded) {
kJobsManager::updateBatchJob($convertProfileJob, BatchJob::BATCHJOB_STATUS_FINISHED);
return false;
} else {
self::bypassConversion($originalFlavorAsset, $entry, $convertProfileJob);
return true;
}
}
try {
//.........这里部分代码省略.........
示例6: handleFlavorReady
public static function handleFlavorReady(BatchJob $dbBatchJob, $flavorAssetId)
{
// verifies that flavor asset created
if (!$flavorAssetId) {
throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $flavorAssetId);
}
$currentFlavorAsset = assetPeer::retrieveById($flavorAssetId);
// verifies that flavor asset exists
if (!$currentFlavorAsset) {
throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $flavorAssetId);
}
// if the flavor deleted then it shouldn't be taken into ready calculations
if ($currentFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_DELETED) {
return $currentFlavorAsset;
}
// Remarked because we want the original flavor ready behavior to work the same as other flavors
//
// $rootBatchJob = $dbBatchJob->getRootJob();
//
// // happens in case of post convert on the original (in case of bypass)
// if($rootBatchJob && $currentFlavorAsset->getIsOriginal())
// {
// kJobsManager::updateBatchJob($rootBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
// return $dbBatchJob;
// }
$sourceMediaInfo = mediaInfoPeer::retrieveOriginalByEntryId($dbBatchJob->getEntryId());
/*
* For intermediate source generation, both the source and the asset have the same asset id.
* In this case sourceMediaInfo should be retrieved as the first version of source asset mediaInfo
*/
if (isset($sourceMediaInfo) && $sourceMediaInfo->getFlavorAssetId() == $flavorAssetId) {
$productMediaInfo = $sourceMediaInfo;
$entry = $dbBatchJob->getEntry();
$operationAttributes = $entry->getOperationAttributes();
// if in clipping operation - take the latest created mediainfo object
$ascending = empty($operationAttributes) ? 1 : 0;
$sourceMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($flavorAssetId, $ascending);
KalturaLog::log("Intermediate source generation - assetId(" . $flavorAssetId . "),src MdInf id(" . $sourceMediaInfo->getId() . "),product MdInf id(" . $productMediaInfo->getId()) . ")";
} else {
$productMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($currentFlavorAsset->getId());
}
$targetFlavor = assetParamsOutputPeer::retrieveByAssetId($currentFlavorAsset->getId());
//Retrieve convert job executing engien
$convertEngineType = null;
if ($dbBatchJob->getParentJob()) {
$dbParentBatchJob = $dbBatchJob->getParentJob();
if ($dbParentBatchJob->getJobType() == BatchJobType::CONVERT) {
$convertEngineType = $dbParentBatchJob->getJobSubType();
}
}
$postConvertData = $dbBatchJob->getData();
$postConvertAssetType = BatchJob::POSTCONVERT_ASSET_TYPE_FLAVOR;
if ($postConvertData instanceof kPostConvertJobData) {
$postConvertAssetType = $postConvertData->getPostConvertAssetType();
}
// don't validate in case of bypass, in case target flavor or media info are null
// or ISM/ISMC manifest assets
if ($postConvertAssetType != BatchJob::POSTCONVERT_ASSET_TYPE_BYPASS && $targetFlavor && $productMediaInfo && !$targetFlavor->hasTag(assetParams::TAG_ISM_MANIFEST)) {
try {
$productFlavor = KDLWrap::CDLValidateProduct($sourceMediaInfo, $targetFlavor, $productMediaInfo, $convertEngineType);
} catch (Exception $e) {
KalturaLog::err('KDL Error: ' . print_r($e, true));
}
$err = kBusinessConvertDL::parseFlavorDescription($productFlavor);
KalturaLog::debug("BCDL: job id [" . $dbBatchJob->getId() . "] flavor params output id [" . $targetFlavor->getId() . "] flavor asset id [" . $currentFlavorAsset->getId() . "] desc: {$err}");
if (!$productFlavor->IsValid()) {
$description = $currentFlavorAsset->getDescription() . "\n{$err}";
// mark the asset as ready
$currentFlavorAsset->setDescription($description);
$currentFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
$currentFlavorAsset->save();
if (!kConf::get('ignore_cdl_failure')) {
kJobsManager::failBatchJob($dbBatchJob, $err);
return null;
}
}
}
// mark the asset as ready
$currentFlavorAsset->setStatusLocalReady();
$currentFlavorAsset->save();
$waitingFlavorAssets = assetPeer::retrieveByEntryIdAndStatus($currentFlavorAsset->getEntryId(), flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT);
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($currentFlavorAsset->getEntryId());
foreach ($waitingFlavorAssets as $waitingFlavorAsset) {
$flavor = assetParamsOutputPeer::retrieveByAsset($waitingFlavorAsset);
KalturaLog::debug('Check waiting flavor asset [' . $waitingFlavorAsset->getId() . ']');
if ($dbBatchJob->getParentJob()) {
$parentJob = $dbBatchJob->getParentJob();
} else {
$parentJob = $dbBatchJob;
}
kBusinessPreConvertDL::decideFlavorConvert($waitingFlavorAsset, $flavor, $originalFlavorAsset, null, null, $parentJob);
}
kFlowHelper::generateThumbnailsFromFlavor($dbBatchJob->getEntryId(), $dbBatchJob, $currentFlavorAsset->getFlavorParamsId());
if ($currentFlavorAsset->getIsOriginal()) {
$entry = $currentFlavorAsset->getentry();
if ($entry) {
kBusinessConvertDL::checkForPendingLiveClips($entry);
}
}
return $currentFlavorAsset;
//.........这里部分代码省略.........
示例7: handleProvisionProvideFinished
public static function handleProvisionProvideFinished(BatchJob $dbBatchJob, kProvisionJobData $data)
{
kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::READY);
$entry = $dbBatchJob->getEntry();
if (!$entry) {
return $dbBatchJob;
}
$data->populateEntryFromData($entry);
$liveAssets = assetPeer::retrieveByEntryId($entry->getId(), array(assetType::LIVE));
foreach ($liveAssets as $liveAsset) {
/* @var $liveAsset liveAsset */
$liveAsset->setStatus(asset::ASSET_STATUS_READY);
$liveAsset->save();
}
$entry->save();
return $dbBatchJob;
}
示例8: exportSourceAssetFromJob
public static function exportSourceAssetFromJob(BatchJob $dbBatchJob)
{
// convert profile finished - export source flavor
if ($dbBatchJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
$externalStorages = StorageProfilePeer::retrieveAutomaticByPartnerId($dbBatchJob->getPartnerId());
$sourceFlavor = assetPeer::retrieveOriginalByEntryId($dbBatchJob->getEntryId());
if (!$sourceFlavor) {
KalturaLog::debug('Cannot find source flavor for entry id [' . $dbBatchJob->getEntryId() . ']');
} else {
if (!$sourceFlavor->isLocalReadyStatus()) {
KalturaLog::debug('Source flavor id [' . $sourceFlavor->getId() . '] has status [' . $sourceFlavor->getStatus() . '] - not ready for export');
} else {
foreach ($externalStorages as $externalStorage) {
if ($externalStorage->triggerFitsReadyAsset($dbBatchJob->getEntryId())) {
self::exportFlavorAsset($sourceFlavor, $externalStorage);
}
}
}
}
}
// convert collection finished - export ism and ismc files
if ($dbBatchJob->getJobType() == BatchJobType::CONVERT_COLLECTION && $dbBatchJob->getJobSubType() == conversionEngineType::EXPRESSION_ENCODER3) {
$entry = $dbBatchJob->getEntry();
$externalStorages = StorageProfilePeer::retrieveAutomaticByPartnerId($dbBatchJob->getPartnerId());
foreach ($externalStorages as $externalStorage) {
if ($externalStorage->triggerFitsReadyAsset($entry->getId())) {
$ismKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
if (kFileSyncUtils::fileSync_exists($ismKey)) {
self::export($entry, $externalStorage, $ismKey);
}
$ismcKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($ismcKey)) {
self::export($entry, $externalStorage, $ismcKey);
}
}
}
}
return true;
}
示例9: exportSourceAssetFromJob
public static function exportSourceAssetFromJob(BatchJob $dbBatchJob)
{
// convert collection finished - export ism and ismc files
if ($dbBatchJob->getJobType() == BatchJobType::CONVERT_COLLECTION && $dbBatchJob->getJobSubType() == conversionEngineType::EXPRESSION_ENCODER3) {
$entry = $dbBatchJob->getEntry();
$externalStorages = StorageProfilePeer::retrieveAutomaticByPartnerId($dbBatchJob->getPartnerId());
foreach ($externalStorages as $externalStorage) {
if ($externalStorage->triggerFitsReadyAsset($entry->getId())) {
$ismKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
if (kFileSyncUtils::fileSync_exists($ismKey)) {
self::export($entry, $externalStorage, $ismKey);
}
$ismcKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($ismcKey)) {
self::export($entry, $externalStorage, $ismcKey);
}
}
}
}
return true;
}
示例10: updatedJob
/**
* @param BatchJob $dbBatchJob
* @param BatchJob $twinJob
* @return bool true if should continue to the next consumer
*/
public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null)
{
if ($dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_FINISHED) {
return true;
}
// convert profile finished - export source flavor
if ($dbBatchJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
$externalStorages = StorageProfilePeer::retrieveAutomaticByPartnerId($dbBatchJob->getPartnerId());
foreach ($externalStorages as $externalStorage) {
if ($externalStorage->getTrigger() == StorageProfile::STORAGE_TEMP_TRIGGER_FLAVOR_READY || $externalStorage->getTrigger() == StorageProfile::STORAGE_TEMP_TRIGGER_MODERATION_APPROVED && $dbBatchJob->getEntry()->getModerationStatus() == entry::ENTRY_MODERATION_STATUS_APPROVED) {
$sourceFlavor = flavorAssetPeer::retrieveOriginalReadyByEntryId($dbBatchJob->getEntryId());
if ($sourceFlavor) {
$this->exportFlavorAsset($sourceFlavor, $externalStorage);
}
}
}
}
// convert collection finished - export ism and ismc files
if ($dbBatchJob->getJobType() == BatchJobType::CONVERT_COLLECTION && $dbBatchJob->getJobSubType() == conversionEngineType::EXPRESSION_ENCODER3) {
$entry = $dbBatchJob->getEntry();
$externalStorages = StorageProfilePeer::retrieveAutomaticByPartnerId($dbBatchJob->getPartnerId());
foreach ($externalStorages as $externalStorage) {
if ($externalStorage->getTrigger() == StorageProfile::STORAGE_TEMP_TRIGGER_FLAVOR_READY || $externalStorage->getTrigger() == StorageProfile::STORAGE_TEMP_TRIGGER_MODERATION_APPROVED && $entry->getModerationStatus() == entry::ENTRY_MODERATION_STATUS_APPROVED) {
$ismKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
if (kFileSyncUtils::fileSync_exists($ismKey)) {
$this->export($entry, $externalStorage, $ismKey);
}
$ismcKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($ismcKey)) {
$this->export($entry, $externalStorage, $ismcKey);
}
}
}
}
return true;
}
示例11: updateEntry
public static function updateEntry(BatchJob $dbBatchJob, $status)
{
$entry = $dbBatchJob->getEntry();
if (!$entry) {
KalturaLog::debug("Entry was not found for job id [{$dbBatchJob->getId}()]");
return null;
}
// entry status didn't change - no need to send notification
if ($entry->getStatus() == $status) {
return $entry;
}
// backward compatibility
// if entry has kshow, and this is the first entry in the mix,
// the thumbnail of the entry should be copied into the mix entry
if ($status == entryStatus::READY) {
myEntryUtils::createRoughcutThumbnailFromEntry($entry, false);
}
// entry status is ready and above, not changing status through batch job
if ($entry->getStatus() >= entryStatus::READY) {
return $entry;
}
$entry->setStatus($status);
$entry->save();
kFlowHelper::createEntryUpdateNotification($dbBatchJob);
return $entry;
}
示例12: addPostConvertJob
/**
* @param BatchJob $parentJob
* @param int $jobSubType
* @param string $srcFileSyncLocalPath
* @param int $flavorAssetId
* @param int $flavorParamsOutputId
* @param bool $createThumb
* @param int $thumbOffset
* @return BatchJob
*/
public static function addPostConvertJob(BatchJob $parentJob, $jobSubType, $srcFileSyncLocalPath, $flavorAssetId, $flavorParamsOutputId, $createThumb = false, $thumbOffset = 3)
{
$postConvertData = new kPostConvertJobData();
$postConvertData->setSrcFileSyncLocalPath($srcFileSyncLocalPath);
$postConvertData->setFlavorParamsOutputId($flavorParamsOutputId);
$postConvertData->setFlavorAssetId($flavorAssetId);
$postConvertData->setThumbOffset($thumbOffset);
$postConvertData->setCreateThumb($createThumb);
$parentData = $parentJob->getData();
if ($parentData instanceof kConvartableJobData) {
$postConvertData->setCurrentOperationSet($parentData->getCurrentOperationSet());
$postConvertData->setCurrentOperationIndex($parentData->getCurrentOperationIndex());
}
if ($createThumb) {
$flavorParamsOutput = flavorParamsOutputPeer::retrieveByPK($flavorParamsOutputId);
if (!$flavorParamsOutput) {
$flavorAsset = flavorAssetPeer::retrieveById($flavorAssetId);
if ($flavorAsset) {
$postConvertData->setThumbHeight($flavorAsset->getHeight());
$postConvertData->setThumbBitrate($flavorAsset->getBitrate());
} else {
$postConvertData->setCreateThumb(false);
}
} elseif (!$flavorParamsOutput->getVideoBitrate()) {
$postConvertData->setCreateThumb(false);
} else {
$entry = $parentJob->getEntry();
$rootBatchJob = $parentJob->getRootJob();
if ($rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
$thisFlavorHeight = $flavorParamsOutput->getHeight();
$thisFlavorBitrate = $flavorParamsOutput->getVideoBitrate();
$rootBatchJobData = $rootBatchJob->getData();
$createThumb = false;
if ($rootBatchJobData->getThumbBitrate() < $thisFlavorBitrate) {
$createThumb = true;
} elseif ($rootBatchJobData->getThumbBitrate() == $thisFlavorBitrate && $rootBatchJobData->getThumbHeight() < $thisFlavorHeight) {
$createThumb = true;
}
if ($createThumb) {
$postConvertData->setCreateThumb(true);
$postConvertData->setThumbHeight($thisFlavorHeight);
$postConvertData->setThumbBitrate($thisFlavorBitrate);
}
} elseif (!$entry->getThumbnailVersion()) {
$thisFlavorHeight = $flavorParamsOutput->getHeight();
$thisFlavorBitrate = $flavorParamsOutput->getVideoBitrate();
$postConvertData->setCreateThumb(true);
$postConvertData->setThumbHeight($thisFlavorHeight);
$postConvertData->setThumbBitrate($thisFlavorBitrate);
}
}
}
KalturaLog::log("Post Convert created with file: " . $postConvertData->getSrcFileSyncLocalPath());
return kJobsManager::addJob($parentJob->createChild(), $postConvertData, BatchJobType::POSTCONVERT, $jobSubType);
}