From f5b9ee58c780a0bf69be316df13ce1d55377f7da Mon Sep 17 00:00:00 2001 From: "daniel.barak" Date: Wed, 24 Jul 2024 17:20:10 +0300 Subject: [PATCH 1/3] PLAT-24907: update legacy ep partners --- alpha/lib/model/Partner.php | 2 +- .../utils/setConcurrentLivePlusToPartners.php | 69 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 alpha/scripts/utils/setConcurrentLivePlusToPartners.php diff --git a/alpha/lib/model/Partner.php b/alpha/lib/model/Partner.php index 550b2baac6d..71fb0e6f9ad 100644 --- a/alpha/lib/model/Partner.php +++ b/alpha/lib/model/Partner.php @@ -82,7 +82,7 @@ class Partner extends BasePartner const PARTNER_MAX_LIVE_STREAM_INPUTS_DEFAULT = 10; - const PARTNER_MAX_LIVE_STREAM_OUTPUTS_DEFAULT = 10; + const PARTNER_MAX_LIVE_STREAM_OUTPUTS_DEFAULT = 15; const CUSTOMER_DATA_RTC_ENV = 'rtc_env_name'; diff --git a/alpha/scripts/utils/setConcurrentLivePlusToPartners.php b/alpha/scripts/utils/setConcurrentLivePlusToPartners.php new file mode 100644 index 00000000000..d7e12f38e24 --- /dev/null +++ b/alpha/scripts/utils/setConcurrentLivePlusToPartners.php @@ -0,0 +1,69 @@ +addAscendingOrderByColumn(PartnerPeer::ID); +$c->addAnd(PartnerPeer::ID, 99, Criteria::GREATER_EQUAL); +$c->addAnd(PartnerPeer::STATUS,1, Criteria::EQUAL); +$c->setLimit($countLimitEachLoop); + +$partners = PartnerPeer::doSelect($c, $con); + +while (count($partners)) +{ + foreach ($partners as $partner) + { + /* @var $partner Partner */ + $eventPlatformPermission = PermissionPeer::getByNameAndPartner(FEATURE_EVENT_PLATFORM_PERMISSION, $partner->getId()); + if ($eventPlatformPermission && $eventPlatformPermission->getStatus() == PermissionStatus::ACTIVE) + { + $partner->setMaxLiveStreamOutputs(DEFAULT_MAX_OUTPUT_STREAMS); + print("Existing Event Platform permission on partner: [" . $partner->getId(). "] with status [" . $eventPlatformPermission->getStatus(). "] max output streams set to ". DEFAULT_MAX_OUTPUT_STREAMS . "\n"); +// if (!$dryRun) +// { + $partner->save(); +// } + } + } + + kMemoryManager::clearMemory(); + $c = new Criteria(); + $c->addAscendingOrderByColumn(PartnerPeer::ID); + $c->addAnd(PartnerPeer::ID, 99, Criteria::GREATER_EQUAL); + $c->addAnd(PartnerPeer::STATUS,1, Criteria::EQUAL); + $c->setLimit($countLimitEachLoop); + $c->setOffset($offset); + + $partners = PartnerPeer::doSelect($c, $con); + $offset += $countLimitEachLoop; +} + +print("Done\n"); From f16c3e82e1fad9a309f3773793cd849b690dd553 Mon Sep 17 00:00:00 2001 From: "daniel.barak" Date: Thu, 25 Jul 2024 10:01:50 +0300 Subject: [PATCH 2/3] PLAT-24907: update legacy ep partners --- alpha/scripts/utils/setConcurrentLivePlusToPartners.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/alpha/scripts/utils/setConcurrentLivePlusToPartners.php b/alpha/scripts/utils/setConcurrentLivePlusToPartners.php index d7e12f38e24..f37013a90f9 100644 --- a/alpha/scripts/utils/setConcurrentLivePlusToPartners.php +++ b/alpha/scripts/utils/setConcurrentLivePlusToPartners.php @@ -47,10 +47,7 @@ { $partner->setMaxLiveStreamOutputs(DEFAULT_MAX_OUTPUT_STREAMS); print("Existing Event Platform permission on partner: [" . $partner->getId(). "] with status [" . $eventPlatformPermission->getStatus(). "] max output streams set to ". DEFAULT_MAX_OUTPUT_STREAMS . "\n"); -// if (!$dryRun) -// { - $partner->save(); -// } + $partner->save(); } } From f7ceab98e909ae934ecc54f93b5607a3c1993026 Mon Sep 17 00:00:00 2001 From: "daniel.barak" Date: Sun, 28 Jul 2024 15:04:21 +0300 Subject: [PATCH 3/3] PLAT-24907: update legacy ep partners --- .../utils/setConcurrentLivePlusToPartners.php | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/alpha/scripts/utils/setConcurrentLivePlusToPartners.php b/alpha/scripts/utils/setConcurrentLivePlusToPartners.php index f37013a90f9..3cdddf830b3 100644 --- a/alpha/scripts/utils/setConcurrentLivePlusToPartners.php +++ b/alpha/scripts/utils/setConcurrentLivePlusToPartners.php @@ -45,9 +45,9 @@ $eventPlatformPermission = PermissionPeer::getByNameAndPartner(FEATURE_EVENT_PLATFORM_PERMISSION, $partner->getId()); if ($eventPlatformPermission && $eventPlatformPermission->getStatus() == PermissionStatus::ACTIVE) { - $partner->setMaxLiveStreamOutputs(DEFAULT_MAX_OUTPUT_STREAMS); - print("Existing Event Platform permission on partner: [" . $partner->getId(). "] with status [" . $eventPlatformPermission->getStatus(). "] max output streams set to ". DEFAULT_MAX_OUTPUT_STREAMS . "\n"); - $partner->save(); + updateMaxLiveStreamOutputs($partner, $eventPlatformPermission->getStatus()); + + addLiveFlavorsToLiveTranscodingProfile($partner->getId(), $con); } } @@ -63,4 +63,54 @@ $offset += $countLimitEachLoop; } +function updateMaxLiveStreamOutputs($partner, $eventPlatformPermissionStatus): void +{ + $partner->setMaxLiveStreamOutputs(DEFAULT_MAX_OUTPUT_STREAMS); + print("Existing Event Platform permission on partner: [" . $partner->getId(). "] with status [" . $eventPlatformPermissionStatus. "] max output streams set to ". DEFAULT_MAX_OUTPUT_STREAMS . "\n"); + $partner->save(); +} + +function addLiveFlavorsToLiveTranscodingProfile($partnerId, $con) +{ + $conversionProfileCriteria = new Criteria(); + $conversionProfileCriteria->add(conversionProfile2Peer::PARTNER_ID, $partnerId, Criteria::EQUAL); + $conversionProfileCriteria->add(conversionProfile2Peer::SYSTEM_NAME, 'Default_Live', Criteria::EQUAL); + $conversionProfile = conversionProfile2Peer::doSelectOne($conversionProfileCriteria, $con); + + if ($conversionProfile) + { + $flavorParamsConversionProfileCriteria = new Criteria(); + $flavorParamsConversionProfileCriteria->add(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $conversionProfile->getId(), Criteria::EQUAL); + $flavorParamsConversionProfileCriteria->add(flavorParamsConversionProfilePeer::FLAVOR_PARAMS_ID, 42, Criteria::EQUAL); + $flavorParamsConversionProfile = flavorParamsConversionProfilePeer::doSelectOne($flavorParamsConversionProfileCriteria, $con); + + if(!$flavorParamsConversionProfile) + { + $flavorParamsConversionProfile42 = new flavorParamsConversionProfile; + /** @var $flavorParamsConversionProfile $flavorParamsConversionProfile42 */ + $flavorParamsConversionProfile42->setConversionProfileId($conversionProfile->getId()); + $flavorParamsConversionProfile42->setFlavorParamsId(42); + $flavorParamsConversionProfile42->setSystemName('HD/720 - WEB/MBL (H264/1700)'); + $flavorParamsConversionProfile42->save(); + print("flavor 42 added to Conversion Profile 'Cloud transcode' for partner [" . $partnerId . "]\n"); + } + + $flavorParamsConversionProfileCriteria->add(flavorParamsConversionProfilePeer::FLAVOR_PARAMS_ID, 43, Criteria::EQUAL); + $flavorParamsConversionProfile = flavorParamsConversionProfilePeer::doSelectOne($flavorParamsConversionProfileCriteria, $con); + if(!$flavorParamsConversionProfile) + { + $flavorParamsConversionProfile43 = new flavorParamsConversionProfile; + /** @var $flavorParamsConversionProfile $flavorParamsConversionProfile43 */ + $flavorParamsConversionProfile43->setConversionProfileId($conversionProfile->getId()); + $flavorParamsConversionProfile43->setFlavorParamsId(43); + $flavorParamsConversionProfile43->setSystemName('HD/720 - WEB/MBL (H264/2600)'); + $flavorParamsConversionProfile43->save(); + } + } + else + { + print("Conversion Profile 'Cloud transcode' for partner [" . $partnerId . "] was not found\n"); + } +} + print("Done\n");