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'); }
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); } }
/** * 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) { if (!$distributionJobData) { return; } if (!$distributionJobData->distributionProfile instanceof KalturaExampleDistributionProfile) { return; } $this->videoAssetFilePaths = new KalturaExampleDistributionAssetPathArray(); // loads all the flavor assets that should be submitted to the remote destination site $flavorAssets = flavorAssetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds)); foreach ($flavorAssets as $flavorAsset) { $videoAssetFilePath = new KalturaExampleDistributionAssetPath(); $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $videoAssetFilePath->path = kFileSyncUtils::getLocalFilePathForKey($syncKey, true); $this->videoAssetFilePaths[] = $videoAssetFilePath; } $thumbAssets = thumbAssetPeer::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, true); } }
/** * @param EntryDistribution $entryDistribution * @param entry $entry * @param DistributionProfile $distributionProfile * @return boolean true if the list of flavors modified */ public static function assignFlavorAssets(EntryDistribution $entryDistribution, entry $entry, DistributionProfile $distributionProfile) { $requiredFlavorParamsIds = $distributionProfile->getRequiredFlavorParamsIdsArray(); $optionalFlavorParamsIds = $distributionProfile->getRequiredFlavorParamsIdsArray(); $flavorParamsIds = array_merge($requiredFlavorParamsIds, $optionalFlavorParamsIds); $flavorAssetIds = array(); if (!is_array($flavorParamsIds)) { return false; } $originalList = $entryDistribution->getFlavorAssetIds(); // remove deleted flavor assets if ($originalList) { $assignedFlavorAssetIds = explode(',', $originalList); $assignedFlavorAssets = flavorAssetPeer::retrieveByIds($assignedFlavorAssetIds); foreach ($assignedFlavorAssets as $assignedFlavorAsset) { if (in_array($assignedFlavorAsset->getFlavorParamsId(), $flavorParamsIds)) { $flavorAssetIds[] = $assignedFlavorAsset->getId(); } } } // adds added flavor assets $newFlavorAssetIds = flavorAssetPeer::getReadyIdsByParamsIds($entry->getId(), $flavorParamsIds); foreach ($newFlavorAssetIds as $newFlavorAssetId) { $flavorAssetIds[] = $newFlavorAssetId; } $entryDistribution->setFlavorAssetIds($flavorAssetIds); return $originalList != $entryDistribution->getFlavorAssetIds(); }