Skip to content

Commit

Permalink
Merge pull request #8866 from kaltura/Orion-15.10.0-SUP-18799-addDefa…
Browse files Browse the repository at this point in the history
…ultRecordingConversionProfile

SUP-18799: add default recording conversion profile per partner
  • Loading branch information
david-winder-kaltura committed Nov 11, 2019
2 parents 2ac62ec + c72856a commit 6bedddd
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 2 deletions.
7 changes: 6 additions & 1 deletion admin_console/forms/PartnerConfiguration.php
Expand Up @@ -456,6 +456,11 @@ public function init()
'filters' => array('StringTrim'),
));

$this->addElement('text', 'default_recording_conversion_profile', array(
'label' => 'Default Recording Conversion Profile:',
'filters' => array('StringTrim'),
));


//--------------- Host white list ----------------------------

Expand Down Expand Up @@ -1000,7 +1005,7 @@ public function addAllDisplayGroups($permissionNames)

$this->addDisplayGroup(
array_merge(
array('default_live_stream_entry_source_type', 'live_stream_provision_params', 'default_live_stream_segment_duration'),
array('default_live_stream_entry_source_type', 'live_stream_provision_params', 'default_live_stream_segment_duration', 'default_recording_conversion_profile'),
array('crossLine')),
'liveStreamConfig',
array('legend' => 'Live Stream Config')
Expand Down
10 changes: 10 additions & 0 deletions alpha/lib/model/LiveEntry.php
Expand Up @@ -1009,5 +1009,15 @@ public function isPlayable()
return $this->getViewMode() == ViewMode::ALLOW_ALL && in_array($this->getLiveStatus(), array(EntryServerNodeStatus::PLAYABLE, EntryServerNodeStatus::BROADCASTING, EntryServerNodeStatus::AUTHENTICATED));
}

public function getRecordedEntryConversionProfile()
{
$conversionProfileId = $this->getPartner()->getDefaultRecordingConversionProfile();
if (!$conversionProfileId)
{
$conversionProfileId = $this->conversion_profile_id;
}
return $conversionProfileId;
}


}
10 changes: 10 additions & 0 deletions alpha/lib/model/Partner.php
Expand Up @@ -1953,6 +1953,16 @@ public function setDefaultLiveStreamSegmentDuration($v)
$this->putInCustomData( "default_live_stream_segment_duration", $v );
}

public function getDefaultRecordingConversionProfile()
{
return $this->getFromCustomData("default_recording_conversion_profile" );
}

public function setDefaultRecordingConversionProfile($v)
{
$this->putInCustomData( "default_recording_conversion_profile", $v );
}

/**
* @param string $name
* @param string $namespace
Expand Down
8 changes: 8 additions & 0 deletions alpha/lib/model/conversionProfile2Peer.php
Expand Up @@ -65,5 +65,13 @@ public static function retrieveByPartnerIdAndSystemName ($partnerId, $systemName

return conversionProfile2Peer::doSelectOne($c);
}

public static function retrieveByPKAndPartnerId($id, $partnerId)
{
$c = new Criteria();
$c->addAnd(conversionProfile2Peer::ID, $id);
$c->addAnd(conversionProfile2Peer::PARTNER_ID, $partnerId);
return conversionProfile2Peer::doSelectOne($c);
}

}
3 changes: 2 additions & 1 deletion api_v3/lib/KalturaLiveEntryService.php
Expand Up @@ -290,7 +290,8 @@ private function createRecordedEntry(LiveEntry $dbEntry, $mediaServerIndex)
$recordedEntry->setIsRecordedEntry(true);
$recordedEntry->setTags($dbEntry->getTags());
$recordedEntry->setStatus(entryStatus::NO_CONTENT);
$recordedEntry->setConversionProfileId($dbEntry->getConversionProfileId());

$recordedEntry->setConversionProfileId($dbEntry->getRecordedEntryConversionProfile());

// make the recorded entry to be "hidden" in search so it won't return in entry list action
if ($dbEntry->getRecordingOptions() && $dbEntry->getRecordingOptions()->getShouldMakeHidden())
Expand Down
Expand Up @@ -17,6 +17,8 @@ class SystemPartnerErrors extends KalturaErrors

const DOMAINS_NOT_ALLOWED = "DOMAINS_NOT_ALLOWED;DOMAINS;Some domains are not allowing Kaltura: @DOMAINS@ ";

const PARTNER_RECORDING_CONVERSION_PROFILE_ID_ERROR = "PARTNER_RECORDING_CONVERSION_PROFILE_ID_ERROR;ID;Wrong conversion profile id - @ID@ - for recording entries";

/**
* codes
*/
Expand Down
Expand Up @@ -360,6 +360,11 @@ class KalturaSystemPartnerConfiguration extends KalturaObject
*/
public $defaultLiveStreamSegmentDuration;

/**
* @var int
*/
public $defaultRecordingConversionProfile;

/**
* @var string
*/
Expand Down Expand Up @@ -479,6 +484,7 @@ class KalturaSystemPartnerConfiguration extends KalturaObject
"htmlPurifierBehaviour",
"htmlPurifierBaseListUsage",
"defaultLiveStreamSegmentDuration",
"defaultRecordingConversionProfile",
"eSearchLanguages",
"publisherEnvironmentType",
"ovpEnvironmentUrl",
Expand Down Expand Up @@ -565,6 +571,16 @@ public function validateForUpdate($sourceObject, $propertiesToSkip = array())
$this->validatePropertyNumeric('defaultLiveStreamSegmentDuration');
$this->validatePropertyMinMaxValue('defaultLiveStreamSegmentDuration', KalturaLiveEntry::MIN_ALLOWED_SEGMENT_DURATION_MILLISECONDS, KalturaLiveEntry::MAX_ALLOWED_SEGMENT_DURATION_MILLISECONDS);
}

if (!$this->isNull('defaultRecordingConversionProfile'))
{
$this->validatePropertyNumeric('defaultRecordingConversionProfile');
$conversionProfile = conversionProfile2Peer::retrieveByPKAndPartnerId($this->defaultRecordingConversionProfile, $sourceObject->getId());
if (!$conversionProfile) {
throw new KalturaAPIException(SystemPartnerErrors::PARTNER_RECORDING_CONVERSION_PROFILE_ID_ERROR, $this->defaultRecordingConversionProfile);
}
}

$this->validateAllowedFromEmailWhiteList();
return parent::validateForUpdate($sourceObject,$propertiesToSkip);
}
Expand Down

0 comments on commit 6bedddd

Please sign in to comment.