private function createPlayManifestURLs(KalturaEntryDistribution $entryDistribution, entry $entry, TvinciDistributionFeedHelper $feedHelper)
 {
     $distributionFlavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->flavorAssetIds));
     $videoAssetDataMap = $this->getVideoAssetDataMap();
     foreach ($videoAssetDataMap as $videoAssetData) {
         $tvinciAssetName = $videoAssetData[0];
         $playbackProtocol = $videoAssetData[1];
         $tags = $videoAssetData[2];
         $fileExt = $videoAssetData[3];
         $keys = array();
         $relevantTags = array();
         foreach ($distributionFlavorAssets as $distributionFlavorAsset) {
             foreach ($tags as $tag) {
                 if ($distributionFlavorAsset->isLocalReadyStatus() && $distributionFlavorAsset->hasTag($tag)) {
                     $key = $this->createFileCoGuid($entry->getEntryId(), $distributionFlavorAsset->getFlavorParamsId());
                     if (!in_array($key, $keys)) {
                         $keys[] = $key;
                     }
                     if (!in_array($tag, $relevantTags)) {
                         $relevantTags[] = $tag;
                     }
                 }
             }
         }
         if ($keys) {
             $fileCoGuid = implode(",", $keys);
             $tagFlag = implode(",", $relevantTags);
             $url = $this->getPlayManifestUrl($entry, $playbackProtocol, $tagFlag, $fileExt);
             $feedHelper->setVideoAssetData($tvinciAssetName, $url, $fileCoGuid);
         }
     }
 }
 public function __construct(KalturaDistributionJobData $distributionJobData = null)
 {
     parent::__construct($distributionJobData);
     if (!$distributionJobData || !$distributionJobData->distributionProfile instanceof KalturaTvinciDistributionProfile || !$distributionJobData->entryDistribution) {
         return;
     }
     $entry = null;
     if ($distributionJobData->entryDistribution->entryId) {
         $entry = entryPeer::retrieveByPK($distributionJobData->entryDistribution->entryId);
     }
     if (!$entry) {
         KalturaLog::err("Can't find entry with id: {$distributionJobData->entryDistribution->entryId}");
         return;
     }
     $feedHelper = new TvinciDistributionFeedHelper($distributionJobData->distributionProfile, $entry);
     if ($distributionJobData instanceof KalturaDistributionSubmitJobData) {
         $this->xml = $feedHelper->buildSubmitFeed();
     } elseif ($distributionJobData instanceof KalturaDistributionUpdateJobData) {
         $this->xml = $feedHelper->buildUpdateFeed();
     } elseif ($distributionJobData instanceof KalturaDistributionDeleteJobData) {
         $this->xml = $feedHelper->buildDeleteFeed();
     }
 }
 public function __construct(KalturaDistributionJobData $distributionJobData = null)
 {
     parent::__construct($distributionJobData);
     if (!$distributionJobData) {
         return;
     }
     if (!$distributionJobData->distributionProfile instanceof KalturaTvinciDistributionProfile) {
         return;
     }
     $fieldValues = unserialize($this->fieldValues);
     $entry = null;
     if ($distributionJobData->entryDistribution->entryId) {
         $entry = entryPeer::retrieveByPK($distributionJobData->entryDistribution->entryId);
     }
     if (!$entry) {
         KalturaLog::err("Can't find entry with id: {$distributionJobData->entryDistribution->entryId}");
         return;
     }
     $feedHelper = new TvinciDistributionFeedHelper($distributionJobData->distributionProfile, $fieldValues);
     $feedHelper->setEntryId($entry->getId());
     $feedHelper->setCreatedAt($entry->getCreatedAtAsInt());
     $broadcasterName = 'Kaltura-' . $entry->getPartnerId();
     $feedHelper->setBroadcasterName($broadcasterName);
     $thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
     $picRatios = array();
     $defaultThumbUrl = null;
     foreach ($thumbAssets as $thumbAsset) {
         $thumbDownloadUrl = $this->getAssetDownloadUrl($thumbAsset);
         $ratio = KDLVideoAspectRatio::ConvertFrameSize($thumbAsset->getWidth(), $thumbAsset->getHeight());
         $picRatios[] = array('url' => $thumbDownloadUrl, 'ratio' => $ratio);
         if ($thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
             $defaultThumbUrl = $thumbDownloadUrl;
         }
     }
     $feedHelper->setPicRatiosArray($picRatios);
     if (!$defaultThumbUrl && count($picRatios)) {
         // Choose the URL of the first resource in the array
         $defaultThumbUrl = $picRatios[0]['url'];
     }
     $feedHelper->setDefaultThumbnailUrl($defaultThumbUrl);
     $this->initPlayManifestUrls($entry, $feedHelper);
     if ($distributionJobData instanceof KalturaDistributionSubmitJobData) {
         $this->xml = $feedHelper->buildSubmitFeed();
     } elseif ($distributionJobData instanceof KalturaDistributionUpdateJobData) {
         $this->xml = $feedHelper->buildUpdateFeed();
     } elseif ($distributionJobData instanceof KalturaDistributionDeleteJobData) {
         $this->xml = $feedHelper->buildDeleteFeed();
     }
 }