Skip to content

Commit

Permalink
Merge pull request kaltura#1364 from kaltura/IX-9.18.0-PLAT-1375
Browse files Browse the repository at this point in the history
Added ALT_RAW_FILENAME
  • Loading branch information
Avi Bueno committed Jun 24, 2014
2 parents 598aeaf + aec7383 commit 723ab71
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ protected function getYoutubeApiProps()
$props['commentVote'] = $this->getValueForField(KalturaYouTubeApiDistributionField::ALLOW_RATINGS);
$props['videoRespond'] = $this->getValueForField(KalturaYouTubeApiDistributionField::ALLOW_RESPONSES);
$props['embed'] = $this->getValueForField(KalturaYouTubeApiDistributionField::ALLOW_EMBEDDING);

$props['slugHeader'] = $this->getValueForField(KalturaYouTubeApiDistributionField::ALT_RAW_FILENAME);

KalturaLog::debug("Props [" . print_r($props, true) . "]");

Expand Down Expand Up @@ -138,7 +140,7 @@ public function doSubmit(KalturaDistributionSubmitJobData $data, KalturaYoutubeA
}

$youTubeApiImpl = new YouTubeApiImpl($distributionProfile->username, $distributionProfile->password, $this->getHttpClientConfig());
$remoteId = $youTubeApiImpl->uploadVideo($videoFilePath, $videoFilePath, $props, $private);
$remoteId = $youTubeApiImpl->uploadVideo($videoFilePath, $props, $private);

if ($needDel == true)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct($user, $pass, array $config = null)
$this->yt->setMajorProtocolVersion(2);
}

public function uploadVideo($fileDisk, $fileUrl, $props, $private = false)
public function uploadVideo($fileDisk, $props, $private = false)
{
// foreach ($props as $key => $val)
// {
Expand All @@ -82,7 +82,8 @@ public function uploadVideo($fileDisk, $fileUrl, $props, $private = false)
$filesource->setContentType('video/quicktime');
// print_r($filesource);
// set slug header
$filesource->setSlug($fileUrl);
$slugHeader = $props['slugHeader'] ? $props['slugHeader'] : $fileDisk;
$filesource->setSlug($slugHeader);
// add the filesource to the video entry
$myVideoEntry->setMediaSource($filesource);
$myVideoEntry->setVideoTitle($props['title']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ interface YouTubeApiDistributionField extends BaseEnum
const ALLOW_RESPONSES = 'ALLOW_RESPONSES';
const ALLOW_RATINGS = 'ALLOW_RATINGS';
const ALLOW_EMBEDDING = 'ALLOW_EMBEDDING';

const ALT_RAW_FILENAME = 'ALT_RAW_FILENAME'; // Alternative raw filename
}
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ protected function getDefaultFieldConfigArray()
$fieldConfig->setEntryMrssXslt('<xsl:value-of select="distribution[@entryDistributionId=$entryDistributionId]/allow_embedding" />');
$fieldConfigArray[$fieldConfig->getFieldName()] = $fieldConfig;

// The following allows defining an alternative slug header for an uploaded video, which
// affects the "raw file" field of a YouTube video entry.
// A typical MRSS XSLT value would be the entry's title (similar to MEDIA_TITLE)
$fieldConfig = new DistributionFieldConfig();
$fieldConfig->setFieldName(YouTubeApiDistributionField::ALT_RAW_FILENAME);
$fieldConfig->setUserFriendlyFieldName('Alternative Raw File Name ');
$fieldConfig->setEntryMrssXslt(''); // Empty by default to indicate that the feature is switched off.
$fieldConfigArray[$fieldConfig->getFieldName()] = $fieldConfig;

return $fieldConfigArray;
}
Expand Down

0 comments on commit 723ab71

Please sign in to comment.