本文整理汇总了PHP中assetPeer::doSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::doSelect方法的具体用法?PHP assetPeer::doSelect怎么用?PHP assetPeer::doSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::doSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCaptions
protected function getCaptions($partnerId, $entryId)
{
$c = new Criteria();
$c->add(assetPeer::PARTNER_ID, $partnerId);
$c->add(assetPeer::ENTRY_ID, $entryId);
$c->add(assetPeer::TYPE, CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION));
$c->add(assetPeer::STATUS, asset::ASSET_STATUS_READY);
return assetPeer::doSelect($c);
}
示例2: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaYahooDistributionProfile) {
return;
}
//Flavor Assets
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$videoAssetFilePathArray = array();
foreach ($flavorAssets as $flavorAsset) {
if ($flavorAsset) {
/* @var $flavorAsset flavorAsset */
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$id = $flavorAsset->getId();
//$this->videoAssetFilePath[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$videoAssetFilePathArray[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
}
$this->videoAssetFilePath = serialize($videoAssetFilePathArray);
}
//Thumbnails
$c = new Criteria();
$c->addAnd(assetPeer::ID, explode(',', $distributionJobData->entryDistribution->thumbAssetIds), Criteria::IN);
$c->addAscendingOrderByColumn(assetPeer::ID);
$thumbAssets = assetPeer::doSelect($c);
//$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets) >= 2) {
if ($thumbAssets[0]->getWidth() <= $thumbAssets[1]->getWidth()) {
$smallThumbAsset = $thumbAssets[0];
$largeThumbAsset = $thumbAssets[1];
} else {
$smallThumbAsset = $thumbAssets[1];
$largeThumbAsset = $thumbAssets[0];
}
$syncKey = $smallThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->smallThumbPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$syncKey = $largeThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->largeThumbPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
}
示例3: doGetListResponse
protected function doGetListResponse(KalturaFilterPager $pager, array $types = null)
{
$this->validateEntryIdFiltered();
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
// verify access to the relevant entries - either same partner as the KS or kaltura network
if ($this->entryIdEqual) {
$entryIds = array($this->entryIdEqual);
} else {
if ($this->entryIdIn) {
$entryIds = explode(',', $this->entryIdIn);
} else {
throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, 'KalturaAssetFilter::entryIdEqual/KalturaAssetFilter::entryIdIn');
}
}
$entryIds = array_slice($entryIds, 0, baseObjectFilter::getMaxInValues());
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->addAnd(entryPeer::ID, $entryIds, Criteria::IN);
$criterionPartnerOrKn = $c->getNewCriterion(entryPeer::PARTNER_ID, kCurrentContext::getCurrentPartnerId());
$criterionPartnerOrKn->addOr($c->getNewCriterion(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK));
$c->addAnd($criterionPartnerOrKn);
$dbEntries = entryPeer::doSelect($c);
if (!$dbEntries) {
return array(array(), 0);
}
$entryIds = array();
foreach ($dbEntries as $dbEntry) {
$entryIds[] = $dbEntry->getId();
}
$this->entryIdEqual = null;
$this->entryIdIn = implode(',', $entryIds);
// get the flavors
$flavorAssetFilter = new AssetFilter();
$this->toObject($flavorAssetFilter);
$c = new Criteria();
$flavorAssetFilter->attachToCriteria($c);
if ($types) {
$c->add(assetPeer::TYPE, $types, Criteria::IN);
}
$pager->attachToCriteria($c);
$list = assetPeer::doSelect($c);
$resultCount = count($list);
if ($resultCount && $resultCount < $pager->pageSize) {
$totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
} else {
KalturaFilterPager::detachFromCriteria($c);
$totalCount = assetPeer::doCount($c);
}
myDbHelper::$use_alternative_con = null;
return array($list, $totalCount);
}
示例4: validateThumbnailExist
/**
* Validate at least one thumbnail exists
* @param $entryDistribution
* @param $action
*/
private function validateThumbnailExist($entryDistribution, $action)
{
$validationErrors = array();
//Validating thumbnails
$c = new Criteria();
$c->addAnd(assetPeer::ID, explode(',', $entryDistribution->getThumbAssetIds()), Criteria::IN);
$c->addAscendingOrderByColumn(assetPeer::ID);
$thumbAssets = assetPeer::doSelect($c);
if (!count($thumbAssets)) {
$errorMsg = 'thumbnail is required';
$validationError = $this->createValidationError($action, DistributionErrorType::INVALID_DATA);
$validationError->setValidationErrorType(DistributionValidationErrorType::CUSTOM_ERROR);
$validationError->setValidationErrorParam($errorMsg);
$validationError->setDescription($errorMsg);
$validationErrors[] = $validationError;
}
return $validationErrors;
}
示例5: doGetListResponse
protected function doGetListResponse(KalturaFilterPager $pager, array $types = null)
{
$this->validateEntryIdFiltered();
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
// verify access to the relevant entries - either same partner as the KS or kaltura network
if ($this->entryIdEqual) {
$entryIds = array($this->entryIdEqual);
} else {
if ($this->entryIdIn) {
$entryIds = explode(',', $this->entryIdIn);
} else {
throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, 'KalturaAssetFilter::entryIdEqual/KalturaAssetFilter::entryIdIn');
}
}
$entryIds = entryPeer::filterEntriesByPartnerOrKalturaNetwork($entryIds, kCurrentContext::getCurrentPartnerId());
if (!$entryIds) {
return array(array(), 0);
}
$this->entryIdEqual = null;
$this->entryIdIn = implode(',', $entryIds);
// get the flavors
$flavorAssetFilter = new AssetFilter();
$this->toObject($flavorAssetFilter);
$c = new Criteria();
$flavorAssetFilter->attachToCriteria($c);
if ($types) {
$c->add(assetPeer::TYPE, $types, Criteria::IN);
}
$pager->attachToCriteria($c);
$list = assetPeer::doSelect($c);
$resultCount = count($list);
if ($resultCount && $resultCount < $pager->pageSize) {
$totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
} else {
KalturaFilterPager::detachFromCriteria($c);
$totalCount = assetPeer::doCount($c);
}
myDbHelper::$use_alternative_con = null;
return array($list, $totalCount);
}
示例6: entryDeleted
/**
* @param entry $entry
*/
protected function entryDeleted(entry $entry)
{
$this->syncableDeleted($entry->getId(), FileSyncObjectType::ENTRY);
// delete flavor assets
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $entry->getId());
$c->add(assetPeer::STATUS, asset::FLAVOR_ASSET_STATUS_DELETED, Criteria::NOT_EQUAL);
$c->add(assetPeer::DELETED_AT, null, Criteria::ISNULL);
assetPeer::resetInstanceCriteriaFilter();
$assets = assetPeer::doSelect($c);
foreach ($assets as $asset) {
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_DELETED);
$asset->setDeletedAt(time());
$asset->save();
}
$c = new Criteria();
$c->add(flavorParamsOutputPeer::ENTRY_ID, $entry->getId());
$c->add(flavorParamsOutputPeer::DELETED_AT, null, Criteria::ISNULL);
$flavorParamsOutputs = flavorParamsOutputPeer::doSelect($c);
foreach ($flavorParamsOutputs as $flavorParamsOutput) {
$flavorParamsOutput->setDeletedAt(time());
$flavorParamsOutput->save();
}
}
示例7: getSearchData
public static function getSearchData(BaseObject $object)
{
if ($object instanceof entry) {
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $object->getId());
$flavorType = self::getAssetTypeCoreValue(WidevineAssetType::WIDEVINE_FLAVOR);
$c->add(assetPeer::TYPE, $flavorType);
$wvFlavorAssets = assetPeer::doSelect($c);
if (count($wvFlavorAssets)) {
$searchData = array();
foreach ($wvFlavorAssets as $wvFlavorAsset) {
$searchData[] = self::getWidevineAssetIdSearchData($wvFlavorAsset->getWidevineAssetId());
}
return array('plugins_data' => implode(' ', $searchData));
}
}
return null;
}
示例8: die
die($argv[0] . " <Partner ID> <comma,separated,asset,Ids> <dry-run|real-run>.\n");
}
$partnerId = $argv[1];
$entryIds = $argv[2];
$entryIdsArray = explode(',', trim($entryIds));
require_once __DIR__ . '/../bootstrap.php';
KalturaStatement::setDryRun($argv[3] !== 'real-run');
if (!PartnerPeer::retrieveByPK($partnerId)) {
die("Partner ID not found.\n");
}
$c = new Criteria();
$c->add(assetPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
$c->add(assetPeer::STATUS, entryStatus::DELETED, Criteria::EQUAL);
$c->add(assetPeer::ID, $entryIdsArray, Criteria::IN);
assetPeer::setUseCriteriaFilter(false);
$assets = assetPeer::doSelect($c);
foreach ($assets as $deletedAsset) {
echo 'LOG: Changing status of asset ' . $deletedAsset->getId() . ' to: ' . asset::ASSET_STATUS_READY . ".\n";
$deletedAsset->setStatus(asset::ASSET_STATUS_READY);
$deletedAsset->save();
assetPeer::clearInstancePool();
FileSyncPeer::setUseCriteriaFilter(false);
$assetSyncKey = $deletedAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$assetfileSyncs = FileSyncPeer::retrieveAllByFileSyncKey($assetSyncKey);
foreach ($assetfileSyncs as $assetfileSync) {
if ($assetfileSync->getStatus() == FileSync::FILE_SYNC_STATUS_DELETED || $assetfileSync->getStatus() == FileSync::FILE_SYNC_STATUS_PURGED) {
$file_full_path = $assetfileSync->getFullPath();
if (file_exists($file_full_path)) {
echo 'LOG: Changing status of file_sync ' . $assetfileSync->getId() . ' to: ' . FileSync::FILE_SYNC_STATUS_READY . ".\n";
$assetfileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
$assetfileSync->save();
示例9: doSelect
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
self::getInstance();
return parent::doSelect($criteria, $con);
}
示例10: getAllowedFlavorAssets
private function getAllowedFlavorAssets(KSecureEntryHelper $secureEntryHelper, $entryId, $format = null, $isOriginal = false, $isBestPlay = false)
{
$flavorAsset = null;
if ($isBestPlay) {
$flavorAssets = assetPeer::retrieveReadyWebByEntryId($entryId);
} else {
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $entryId);
if ($format) {
$c->add(assetPeer::FILE_EXT, $format);
}
if ($isOriginal) {
$c->add(assetPeer::IS_ORIGINAL, true);
}
$flavorAssets = assetPeer::doSelect($c);
}
foreach ($flavorAssets as $currentFlavorAsset) {
if ($secureEntryHelper->isAssetAllowed($currentFlavorAsset)) {
$flavorAsset = $currentFlavorAsset;
break;
}
}
return $flavorAsset;
}
示例11: Criteria
case assetParams::CONTAINER_FORMAT_SWF:
$asset->setType(DocumentAssetType::get()->coreValue(DocumentAssetType::SWF));
break;
case thumbParams::CONTAINER_FORMAT_JPG:
$asset->setType(assetType::THUMBNAIL);
break;
default:
$asset->setType(assetType::FLAVOR);
$asset->putInCustomData(flavorAsset::CUSTOM_DATA_FIELD_BITRATE, $asset->getBitrate());
$asset->putInCustomData(flavorAsset::CUSTOM_DATA_FIELD_FRAME_RATE, $asset->getFrameRate());
$asset->putInCustomData(flavorAsset::CUSTOM_DATA_FIELD_VIDEO_CODEC_ID, $asset->getVideoCodecId());
}
$asset->save();
}
assetPeer::clearInstancePool();
$assets = assetPeer::doSelect($c, $con);
}
$c = new Criteria();
$c->add(assetParamsPeer::TYPE, 0);
$c->setLimit($entryLimitEachLoop);
$assetParams = assetParamsPeer::doSelect($c, $con);
while (count($assetParams)) {
foreach ($assetParams as $assetParam) {
switch ($assetParam->getFormat()) {
case assetParams::CONTAINER_FORMAT_PDF:
$assetParam->setType(DocumentAssetType::get()->coreValue(DocumentAssetType::PDF));
break;
case assetParams::CONTAINER_FORMAT_SWF:
$assetParam->setType(DocumentAssetType::get()->coreValue(DocumentAssetType::SWF));
break;
case thumbParams::CONTAINER_FORMAT_JPG:
示例12: getWidevineFlavorAssetsForEntry
private function getWidevineFlavorAssetsForEntry($entryId)
{
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $entryId);
$flavorType = WidevinePlugin::getAssetTypeCoreValue(WidevineAssetType::WIDEVINE_FLAVOR);
$c->add(assetPeer::TYPE, $flavorType);
return assetPeer::doSelect($c);
}
示例13: servePlaylist
protected function servePlaylist($entry)
{
// allow only manual playlist
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_TEXT) {
KExternalErrors::dieError(KExternalErrors::INVALID_ENTRY_TYPE);
}
// get request parameters
$flavorParamIds = $this->getRequestParameter("flavorParamIds");
if ($flavorParamIds) {
$flavorParamIds = explode(',', $flavorParamIds);
}
$version = $this->getRequestParameter("v");
// execute the playlist
if ($version) {
$entry->setDesiredVersion($version);
}
list($entryIds, $durations, $referenceEntry) = myPlaylistUtils::executeStitchedPlaylist($entry);
if (!$referenceEntry) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
// load the flavor assets
// Note: not filtering by $flavorParamIds here, so that in case some flavor is missing
// we can fill in the gap using some other flavor params
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $entryIds, Criteria::IN);
$c->add(assetPeer::STATUS, flavorAsset::FLAVOR_ASSET_STATUS_READY);
$flavorTypes = assetPeer::retrieveAllFlavorsTypes();
$c->add(assetPeer::TYPE, $flavorTypes, Criteria::IN);
$flavorAssets = assetPeer::doSelect($c);
// group the flavors by entry and flavor params
$groupedFlavors = array();
foreach ($flavorAssets as $flavor) {
if (!isset($groupedFlavors[$flavor->getEntryId()])) {
$groupedFlavors[$flavor->getEntryId()] = array();
}
$groupedFlavors[$flavor->getEntryId()][$flavor->getFlavorParamsId()] = $flavor;
}
// remove entries that don't have flavors
for ($i = count($entryIds) - 1; $i >= 0; $i--) {
$entryId = $entryIds[$i];
if (isset($groupedFlavors[$entryId])) {
continue;
}
unset($entryIds[$i]);
unset($durations[$i]);
}
// get the flavor params of the reference entry that should be returned
$referenceEntryFlavorParamsIds = array_keys($groupedFlavors[$referenceEntry->getId()]);
if ($flavorParamIds) {
$flavorParamIds = array_intersect($referenceEntryFlavorParamsIds, $flavorParamIds);
} else {
$flavorParamIds = $referenceEntryFlavorParamsIds;
}
if (!$flavorParamIds) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
// build the sequences
$storeCache = true;
$sequences = array();
foreach ($flavorParamIds as $flavorParamsId) {
$referenceFlavor = $groupedFlavors[$referenceEntry->getId()][$flavorParamsId];
// build the clips of the current sequence
$clips = array();
foreach ($entryIds as $entryId) {
if (isset($groupedFlavors[$entryId][$flavorParamsId])) {
$flavor = $groupedFlavors[$entryId][$flavorParamsId];
} else {
// don't have a flavor for this entry in the desired flavor params,
// choose the one with the closest bitrate
$flavor = null;
foreach ($groupedFlavors[$entryId] as $curFlavor) {
if (!$flavor || abs($curFlavor->getBitrate() - $referenceFlavor->getBitrate()) < abs($flavor->getBitrate() - $referenceFlavor->getBitrate())) {
$flavor = $curFlavor;
}
}
}
// get the file path of the flavor
$syncKey = $flavor->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, false, false);
if ($fileSync) {
$resolvedFileSync = kFileSyncUtils::resolve($fileSync);
$path = $resolvedFileSync->getFullPath();
} else {
error_log('missing file sync for flavor ' . $flavor->getId() . ' version ' . $flavor->getVersion());
$path = '';
$storeCache = false;
}
$clips[] = array('type' => 'source', 'path' => $path);
}
$sequences[] = array('clips' => $clips);
}
// build the json
$mediaSet = array('durations' => $durations, 'sequences' => $sequences);
$json = json_encode($mediaSet);
$renderer = new kRendererString($json, self::JSON_CONTENT_TYPE);
if ($storeCache) {
$this->storeCache($renderer, $entry->getPartnerId());
}
$renderer->output();
KExternalErrors::dieGracefully();
//.........这里部分代码省略.........
示例14: validateForSubmission
public function validateForSubmission(EntryDistribution $entryDistribution, $action)
{
$validationErrors = parent::validateForSubmission($entryDistribution, $action);
// make sure that all flavor assets marked for distribution have a flavor params id assigned to them
$flavorAssetIds = explode(',', $entryDistribution->getFlavorAssetIds());
if (count($flavorAssetIds)) {
$c = new Criteria();
$c->addAnd(assetPeer::ID, $flavorAssetIds, Criteria::IN);
$flavorTypes = assetPeer::retrieveAllFlavorsTypes();
$c->add(assetPeer::TYPE, $flavorTypes, Criteria::IN);
$flavorAssets = assetPeer::doSelect($c);
foreach ($flavorAssets as $asset) {
/* @var $asset flavorAsset */
if (strlen($asset->getFlavorParamsId()) <= 0) {
$validationErrors[] = $this->createValidationError($action, DistributionErrorType::INVALID_DATA, 'flavor asset', 'flavor asset must be assigned to a flavor params id');
}
}
}
return $validationErrors;
}
示例15: entryDeleted
/**
* @param entry $entry
*/
protected function entryDeleted(entry $entry)
{
$this->syncableDeleted($entry->getId(), FileSyncObjectType::ENTRY);
// delete flavor assets
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $entry->getId());
$c->add(assetPeer::STATUS, asset::FLAVOR_ASSET_STATUS_DELETED, Criteria::NOT_EQUAL);
$c->add(assetPeer::DELETED_AT, null, Criteria::ISNULL);
$assets = assetPeer::doSelect($c);
foreach ($assets as $asset) {
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_DELETED);
$asset->setDeletedAt(time());
$asset->save();
}
$c = new Criteria();
$c->add(assetParamsOutputPeer::ENTRY_ID, $entry->getId());
$c->add(assetParamsOutputPeer::DELETED_AT, null, Criteria::ISNULL);
$flavorParamsOutputs = assetParamsOutputPeer::doSelect($c);
foreach ($flavorParamsOutputs as $flavorParamsOutput) {
$flavorParamsOutput->setDeletedAt(time());
$flavorParamsOutput->save();
}
$filter = new categoryEntryFilter();
$filter->setEntryIdEqual($entry->getId());
$c = new Criteria();
$c->add(categoryEntryPeer::ENTRY_ID, $entry->getId());
if (!categoryEntryPeer::doSelectOne($c)) {
return;
}
kJobsManager::addDeleteJob($entry->getPartnerId(), DeleteObjectType::CATEGORY_ENTRY, $filter);
}