Skip to content

Commit

Permalink
Merge pull request #9442 from kaltura/Propus-16.3.0-PLAT-10931
Browse files Browse the repository at this point in the history
PLAT-10931: use serveFlavor when export from remote storage periodic
  • Loading branch information
avichainoach committed May 26, 2020
2 parents 536948a + f523df7 commit d669203
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion alpha/lib/model/DeliveryProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
abstract class DeliveryProfile extends BaseDeliveryProfile implements IBaseObject
{
abstract protected function buildServeFlavors();
abstract public function buildServeFlavors();

protected $DEFAULT_RENDERER_CLASS = 'kF4MManifestRenderer';

Expand Down
18 changes: 17 additions & 1 deletion alpha/lib/model/FileSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,18 @@ public function getStatusAsString()
{
return (isset($this->statusMap[$this->getStatus()])) ? $this->statusMap[$this->getStatus()] : "Unknown";
}


protected function getServeUrl($entryId)
{
$dynamicAttributes = DeliveryProfileDynamicAttributes::init($this->getDc(), $entryId, PlaybackProtocol::HTTP, infraRequestUtils::getProtocol());
$flavorAsset = assetPeer::retrieveById($this->getObjectId());
$dynamicAttributes->setFlavorAssets(array($flavorAsset));
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId($dynamicAttributes);
$urlManager->setDynamicAttributes($dynamicAttributes);
$url = $urlManager->buildServeFlavors();
return ($url[0]['urlPrefix'] . $url[0]['url']);
}

public function getExternalUrl($entryId, $format = PlaybackProtocol::HTTP)
{
$storage = StorageProfilePeer::retrieveByPK($this->getDc());
Expand All @@ -294,6 +305,11 @@ public function getExternalUrl($entryId, $format = PlaybackProtocol::HTTP)
return null;
}

if(in_array($this->getDc(), kStorageExporter::getPeriodicStorageIdsByPartner($this->getPartnerId())))
{
return $this->getServeUrl($entryId);
}

$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($this->getDc(), $entryId, PlaybackProtocol::HTTP, infraRequestUtils::getProtocol()));
if(is_null($urlManager) && infraRequestUtils::getProtocol() != 'http')
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($this->getDc(), $entryId));
Expand Down

0 comments on commit d669203

Please sign in to comment.