本文整理汇总了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);
}
}