本文整理匯總了PHP中assetParamsPeer::retrieveThumbnailsByPKs方法的典型用法代碼示例。如果您正苦於以下問題:PHP assetParamsPeer::retrieveThumbnailsByPKs方法的具體用法?PHP assetParamsPeer::retrieveThumbnailsByPKs怎麽用?PHP assetParamsPeer::retrieveThumbnailsByPKs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類assetParamsPeer
的用法示例。
在下文中一共展示了assetParamsPeer::retrieveThumbnailsByPKs方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generateThumbnailsFromFlavor
/**
* @param BatchJob $parentJob
* @param int $srcParamsId
*/
public static function generateThumbnailsFromFlavor($entryId, BatchJob $parentJob = null, $srcParamsId = null)
{
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
KalturaLog::notice("Entry id [{$entryId}] not found");
return;
}
if ($entry->getType() != entryType::MEDIA_CLIP || $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO) {
KalturaLog::notice("Cupture thumbnail is not supported for entry [{$entryId}] of type [" . $entry->getType() . "] and media type [" . $entry->getMediaType() . "]");
return;
}
$profile = null;
try {
$profile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
} catch (Exception $e) {
KalturaLog::err('getConversionProfile2ForEntry Error: ' . $e->getMessage());
}
if (!$profile) {
KalturaLog::notice("Profile not found for entry id [{$entryId}]");
return;
}
$assetParamsIds = flavorParamsConversionProfilePeer::getFlavorIdsByProfileId($profile->getId());
if (!count($assetParamsIds)) {
KalturaLog::notice("No asset params objects found for profile id [" . $profile->getId() . "]");
return;
}
// the alternative is the source or the highest bitrate if source not defined
$alternateFlavorParamsId = null;
if (is_null($srcParamsId)) {
$flavorParamsObjects = assetParamsPeer::retrieveFlavorsByPKs($assetParamsIds);
foreach ($flavorParamsObjects as $flavorParams) {
if ($flavorParams->hasTag(flavorParams::TAG_SOURCE)) {
$alternateFlavorParamsId = $flavorParams->getId();
}
}
if (is_null($alternateFlavorParamsId)) {
$srcFlavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entryId);
if ($srcFlavorAsset) {
$alternateFlavorParamsId = $srcFlavorAsset->getFlavorParamsId();
}
}
if (is_null($alternateFlavorParamsId)) {
KalturaLog::notice("No source flavor params object found for entry id [{$entryId}]");
return;
}
}
// create list of created thumbnails
$thumbAssetsList = array();
$thumbAssets = assetPeer::retrieveThumbnailsByEntryId($entryId);
if (count($thumbAssets)) {
foreach ($thumbAssets as $thumbAsset) {
if (!is_null($thumbAsset->getFlavorParamsId())) {
$thumbAssetsList[$thumbAsset->getFlavorParamsId()] = $thumbAsset;
}
}
}
$thumbParamsObjects = assetParamsPeer::retrieveThumbnailsByPKs($assetParamsIds);
foreach ($thumbParamsObjects as $thumbParams) {
if (isset($thumbAssetsList[$thumbParams->getId()])) {
KalturaLog::log("Thumbnail asset already created [" . $thumbAssetsList[$thumbParams->getId()]->getId() . "]");
continue;
}
if (is_null($srcParamsId) && is_null($thumbParams->getSourceParamsId())) {
// alternative should be used
$thumbParams->setSourceParamsId($alternateFlavorParamsId);
} elseif ($thumbParams->getSourceParamsId() != $srcParamsId) {
KalturaLog::log("Only thumbnails that uses source params [{$srcParamsId}] should be generated for now");
continue;
}
kBusinessPreConvertDL::decideThumbGenerate($entry, $thumbParams, $parentJob);
}
}