Skip to content

Commit

Permalink
Merge pull request #8151 from kaltura/Naos-14.15.0-SUP-16956
Browse files Browse the repository at this point in the history
Naos 14.15.0 sup 16956
  • Loading branch information
MosheMaorKaltura committed Feb 24, 2019
2 parents 21768b3 + d29597f commit 3bced70
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions alpha/apps/kaltura/lib/myPlaylistUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,21 +879,23 @@ private static function updateEntryFilter(entryFilter $entry_filter, $partner_id

/**
* @param $captionAsset
* @param $filteredCaptionAssets
* @return array
* @param &$localFilePath
* @return boolean
* @throws Exception
*/
protected static function getCaptionFilePath($captionAsset)
protected static function getCaptionFilePath($captionAsset, &$localFilePath)
{
$captionFileSyncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);

list($captionFileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($captionFileSyncKey, false, false);
if ($captionFileSync)
list($captionFileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($captionFileSyncKey, true, false);
if (!$captionFileSync)
{
$captionFullPath = $captionFileSync->getFullPath();
return $captionFullPath;
return false;
}
return false;
if($local)
{
$localFilePath = $captionFileSync->getFullPath();
}
return true;
}

/**
Expand Down Expand Up @@ -1197,15 +1199,18 @@ protected static function getCaptionFilesForEntryIds($entryIds, $captionLanguage
if(!$captionAsset->getDisplayOnPlayer())
continue;

$filePath = self::getCaptionFilePath($captionAsset);
if ($filePath)
//Try getting caption
//if exist but no local - return empty path
$localFilePath = '';
$fileSyncExist = self::getCaptionFilePath($captionAsset, $localFilePath);
if ($fileSyncExist)
{
if (!isset($filteredCaptionAssets[$captionAsset->getEntryId()]))
$filteredCaptionAssets[$captionAsset->getEntryId()] = array();
if (!isset($filteredCaptionAssets[$captionAsset->getEntryId()][$captionAsset->getLanguage()]))
$filteredCaptionAssets[$captionAsset->getEntryId()][$captionAsset->getLanguage()] = array();
$filteredCaptionAssets[$captionAsset->getEntryId()][$captionAsset->getLanguage()] =
array(self::CAPTION_FILES_LABEL => $captionAsset->getLabel(), self::CAPTION_FILES_PATH => $filePath, self::CAPTION_FILES_ID => $captionAsset->getId());
array(self::CAPTION_FILES_LABEL => $captionAsset->getLabel(), self::CAPTION_FILES_PATH => $localFilePath, self::CAPTION_FILES_ID => $captionAsset->getId());
}
}
return $filteredCaptionAssets;
Expand Down

0 comments on commit 3bced70

Please sign in to comment.