protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_eq_type", entryType::DATA); $fields_set->set("_eq_status", entryStatus::READY); // make sure will display only $this->setP("use_filter_puser_id", "false"); // don't mind filtering according to the puser/kuser }
protected function getEntryFilter($extraData) { $entry_filter = new entryFilter(); // This is the old way to search within a partner - allow both $entry_filter->setByName("_eq_partner_id", $extraData); // this is the better way - $entry_filter->setPartnerSearchScope($extraData); return $entry_filter; }
protected function setExtraFilters(entryFilter &$fields_set) { if (intval($fields_set->get("_in_moderation_status")) == moderation::MODERATION_STATUS_APPROVED) { $fields_set->set("_in_moderation_status", array(moderation::MODERATION_STATUS_APPROVED, moderation::MODERATION_STATUS_AUTO_APPROVED)); } $fields_set->set("_eq_type", entryType::PLAYLIST); $fields_set->set("_eq_status", entryStatus::READY); // make sure will display only $this->setP("use_filter_puser_id", "false"); // don't mind filtering according to the puser/kuser }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser, $create_cachekey = false) { myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3; // TODO - verify permissions for viewing lists $detailed = $this->getP("detailed", false); $limit = $this->getP("page_size", 10); $limit = $this->maxPageSize($limit); $page = $this->getP("page", 1); $user_filter_prefix = $this->getP("fp", "filter"); $offset = ($page - 1) * $limit; // TODO - should limit search to partner ?? // kuserPeer::setUseCriteriaFilter( false ); // entryPeer::setUseCriteriaFilter( false ); $playlist_id = $this->getPM("playlist_id"); $input_params = $this->getInputParams(); $extra_filters = array(); for ($i = 1; $i < self::MAX_FILTER_COUNT; $i++) { // filter $extra_filter = new entryFilter(); $fields_set = $extra_filter->fillObjectFromRequest($input_params, "{$user_filter_prefix}{$i}_", null); if ($fields_set) { $extra_filters[$i] = $extra_filter; } } // this service is executed twice! (first time for the cache key, second time for the execution) if (is_null($this->playlist)) { $playlist = entryPeer::retrieveByPK($playlist_id); if (!$playlist) { throw new APIException(APIErrors::INVALID_ENTRY_ID, "Playlist", $playlist_id); } myPartnerUtils::addPartnerToCriteria(new accessControlPeer(), $playlist->getPartnerId(), $this->getPrivatePartnerData(), $this->partnerGroup2(), null); $this->playlist = $playlist; } if ($create_cachekey) { if ($this->isAdmin()) { return null; } $cache_key_arr = array("playlist_id" => $playlist_id, "filters" => $extra_filters); $cahce_key = new executionCacheKey(); $cahce_key->expiry = 600; $cahce_key->key = md5(print_r($cache_key_arr, true)); return $cahce_key; } if ($this->isAdmin()) { myPlaylistUtils::setIsAdminKs(true); } $entry_list = myPlaylistUtils::executePlaylistById($partner_id, $playlist_id, $extra_filters, $detailed); myEntryUtils::updatePuserIdsForEntries($entry_list); $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR; $wrapper = objectWrapperBase::getWrapperClass($entry_list, $level); $this->addMsg("count", count($entry_list)); $this->addMsg($this->getObjectPrefix(), $wrapper); }
function resolveEntryTag(Tag $tag) { $c = KalturaCriteria::create(entryPeer::OM_CLASS); $c->add(entryPeer::PARTNER_ID, $tag->getPartnerId()); if ($tag->getPrivacyContext() != kTagFlowManager::NULL_PC) { $c->addAnd(entryPeer::PRIVACY_BY_CONTEXTS, $tag->getPrivacyContext(), Criteria::LIKE); } $entryFilter = new entryFilter(); $entryFilter->set('_mlikeand_tags', $tag->getTag()); $entryFilter->attachToCriteria($c); $count = $c->getRecordsCount(); if (!$count) { $tag->delete(); } }
public function applyCondition(IKalturaDbQuery $query) { if (is_null($this->categoriesMatchOr) && is_null($this->categoryIdEqual)) { return; } // Fetch the list of categories $categoryEntries = null; if ($this->categoriesMatchOr) { $categoryEntries = entryFilter::categoryFullNamesToIdsParsed($this->categoriesMatchOr, $this->categoryEntryStatusIn); } else { $categoryEntries = entryFilter::categoryIdsToSphinxIds($this->categoryIdEqual, $this->categoryEntryStatusIn); } if ($categoryEntries == '') { // Set a non-exiting cat. id. in order to return empty results (instead of throwing an exception) $categoryEntries = category::CATEGORY_ID_THAT_DOES_NOT_EXIST; } $categoryEntries = explode(',', $categoryEntries); $query->addColumnWhere(entryPeer::CATEGORIES_IDS, $categoryEntries, KalturaCriteria::IN_LIKE); if ($this->orderBy) { $orderByField = substr($this->orderBy, 1); $orderBy = $this->orderBy[0] == '+' ? Criteria::ASC : Criteria::DESC; if ($orderByField != self::CREATED_AT) { throw new kCoreException("Unsupported orderBy criteria [{$orderByField}]"); } $dynAttribCriteriaFieldName = entryIndex::DYNAMIC_ATTRIBUTES . '.' . self::getCategoryCreatedAtDynamicAttributeName($this->categoryIdEqual); $query->addNumericOrderBy($dynAttribCriteriaFieldName, $orderBy); } }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { // TODO - verify permissions for viewing lists $detailed = $this->getP("detailed", false); if (!$detailed) { $detailed = false; } $limit = $this->getP("page_size", 10); $limit = $this->maxPageSize($limit); $page = $this->getP("page", 1); $user_filter_prefix = $this->getP("fp", "filter"); $offset = ($page - 1) * $limit; // TODO - should limit search to partner ?? // kuserPeer::setUseCriteriaFilter( false ); // entryPeer::setUseCriteriaFilter( false ); $input_params = $this->getInputParams(); // fill the playlist (infact only the mediaType and contentData are important $playlist = new entry(); $playlist->setType(entryType::PLAYLIST); // prepare the playlist type before filling from request $obj_wrapper = objectWrapperBase::getWrapperClass($playlist, 0); $playlist->setMediaType($this->getP("playlist_mediaType")); $data_content = $this->getP("playlist_dataContent"); $playlist->setDataContent($data_content); /* $updateable_fields = $obj_wrapper->getUpdateableFields() ; $fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields( $input_params , $playlist , "playlist_" , $updateable_fields , BasePeer::TYPE_PHPNAME ,false ); */ // rest is similar to the executeplaylist service $extra_filters = array(); for ($i = 1; $i < self::MAX_FILTER_COUNT; $i++) { // filter $extra_filter = new entryFilter(); $fields_set = $extra_filter->fillObjectFromRequest($input_params, "{$user_filter_prefix}{$i}_", null); $extra_filters[$i] = $extra_filter; } $entry_list = myPlaylistUtils::executePlaylist($partner_id, $playlist, $extra_filters, $detailed); myEntryUtils::updatePuserIdsForEntries($entry_list); $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR; $wrapper = objectWrapperBase::getWrapperClass($entry_list, $level); $this->addMsg("count", count($entry_list)); $this->addMsg($this->getObjectPrefix(), $wrapper); }
public function postInsert(PropelPDO $con = null) { parent::postInsert($con); if (!$this->getFeedId() || !$this->getId()) { return; } $syndicationFeed = syndicationFeedPeer::retrieveByPK($this->getFeedId()); if (!$syndicationFeed || !$syndicationFeed instanceof genericSyndicationFeed) { return; } // "Creates advanced filter on distribution profile $distributionAdvancedSearch = new ContentDistributionSearchFilter(); $distributionAdvancedSearch->setDistributionProfileId($this->getId()); $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE); $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY); $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE); //Creates entry filter with advanced filter $entryFilter = new entryFilter(); $entryFilter->setPartnerIdEquel($this->getPartnerId()); $entryFilter->setAdvancedSearch($distributionAdvancedSearch); // Creates playlist with entry filter $playlistXml = new SimpleXMLElement("<playlist/>"); $filtersXml = $playlistXml->addChild("filters"); $filterXml = $filtersXml->addChild("filter"); $entryFilter->toXml($filterXml); $playlistContent = $playlistXml->asXML(); // creates playlist based on the filter XML $playlist = new entry(); $playlist->setKuserId(kCurrentContext::$uid); $playlist->setCreatorKuserId(kCurrentContext::$uid); $playlist->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM); $playlist->setPartnerId($this->getPartnerId()); $playlist->setStatus(entryStatus::READY); $playlist->setKshowId(null); $playlist->setType(entryType::PLAYLIST); $playlist->setMediaType(entry::ENTRY_MEDIA_TYPE_XML); $playlist->setDataContent($playlistContent); $playlist->save(); KalturaLog::log("Playlist [" . $playlist->getId() . "] created"); // creates feed based on the playlist $syndicationFeed->setPlaylistId($playlist->getId()); $syndicationFeed->save(); }
public function apply(baseObjectFilter $filter, IKalturaDbQuery $query) { if (is_null($this->categoriesMatchOr) || is_null($this->categoryEntryStatusIn)) { return; } $categoriesTocategoryEntryStatus = entryFilter::categoryFullNamesToIdsParsed($this->categoriesMatchOr, $this->categoryEntryStatusIn); if ($categoriesTocategoryEntryStatus == '') { $categoriesTocategoryEntryStatus = category::CATEGORY_ID_THAT_DOES_NOT_EXIST; } $query->addColumnWhere(entryPeer::CATEGORIES_IDS, explode(',', $categoriesTocategoryEntryStatus), kalturaCriteria::IN_LIKE); }
/** * @action getFeed * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY * @param int $distributionProfileId * @param string $hash * @return file */ public function getFeedAction($distributionProfileId, $hash) { if (!$this->getPartnerId() || !$this->getPartner()) { throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId()); } $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId); if (!$profile || !$profile instanceof SynacorHboDistributionProfile) { throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId); } if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) { throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId); } if ($profile->getUniqueHashForFeedUrl() != $hash) { throw new KalturaAPIException(SynacorHboDistributionErrors::INVALID_FEED_URL); } // "Creates advanced filter on distribution profile $distributionAdvancedSearch = new ContentDistributionSearchFilter(); $distributionAdvancedSearch->setDistributionProfileId($profile->getId()); $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE); $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY); $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE); $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false); //Creates entry filter with advanced filter $entryFilter = new entryFilter(); $entryFilter->setStatusEquel(entryStatus::READY); $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED); $entryFilter->setPartnerSearchScope($this->getPartnerId()); $entryFilter->setAdvancedSearch($distributionAdvancedSearch); $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS); $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); $entryFilter->attachToCriteria($baseCriteria); $entries = entryPeer::doSelect($baseCriteria); $feed = new SynacorHboFeed('synacor_hbo_feed_template.xml'); $feed->setDistributionProfile($profile); $counter = 0; foreach ($entries as $entry) { /* @var $entry entry */ $entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId()); if (!$entryDistribution) { KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']'); continue; } $fields = $profile->getAllFieldValues($entryDistribution); $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds())); $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds())); $additionalAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getAssetIds())); $feed->addItem($fields, $entry, $flavorAssets, $thumbAssets, $additionalAssets); $counter++; //to avoid the cache exceeding the memory size if ($counter >= 100) { kMemoryManager::clearMemory(); $counter = 0; } } header('Content-Type: text/xml'); echo $feed->getXml(); die; }
/** * @action getFeed * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY * @param int $distributionProfileId * @param string $hash * @return file */ public function getFeedAction($distributionProfileId, $hash) { if (!$this->getPartnerId() || !$this->getPartner()) { throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId()); } $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId); if (!$profile || !$profile instanceof UverseDistributionProfile) { throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId); } if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) { throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId); } if ($profile->getUniqueHashForFeedUrl() != $hash) { throw new KalturaAPIException(UverseDistributionErrors::INVALID_FEED_URL); } // "Creates advanced filter on distribution profile $distributionAdvancedSearch = new ContentDistributionSearchFilter(); $distributionAdvancedSearch->setDistributionProfileId($profile->getId()); $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE); $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY); $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false); //Creates entry filter with advanced filter $entryFilter = new entryFilter(); $entryFilter->setStatusEquel(entryStatus::READY); $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED); $entryFilter->setPartnerSearchScope($this->getPartnerId()); $entryFilter->setAdvancedSearch($distributionAdvancedSearch); $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS); $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); $entryFilter->attachToCriteria($baseCriteria); $entries = entryPeer::doSelect($baseCriteria); $feed = new UverseFeed('uverse_template.xml'); $feed->setDistributionProfile($profile); $feed->setChannelFields(); $lastBuildDate = $profile->getUpdatedAt(null); foreach ($entries as $entry) { /* @var $entry entry */ $entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId()); if (!$entryDistribution) { KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']'); continue; } $fields = $profile->getAllFieldValues($entryDistribution); $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds())); $flavorAsset = reset($flavorAssets); $flavorAssetRemoteUrl = $entryDistribution->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_URL); $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds())); $feed->addItem($fields, $flavorAsset, $flavorAssetRemoteUrl, $thumbAssets); // we want to find the newest update time between all entries if ($entry->getUpdatedAt(null) > $lastBuildDate) { $lastBuildDate = $entry->getUpdatedAt(null); } } $feed->setChannelLastBuildDate($lastBuildDate); header('Content-Type: text/xml'); echo $feed->getXml(); die; }
protected function getEntryFilter($context, $keepScheduling = true) { // "Creates advanced filter on distribution profile $distributionAdvancedSearch = new ContentDistributionSearchFilter(); $distributionAdvancedSearch->setDistributionProfileId($this->profile->getId()); $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE); $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY); $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false); //Creates entry filter with advanced filter $entryFilter = new entryFilter(); $entryFilter->setStatusEquel(entryStatus::READY); $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED); $entryFilter->setPartnerSearchScope($this->getPartnerId()); $entryFilter->setAdvancedSearch($distributionAdvancedSearch); return $entryFilter; }
/** * request conversion for all entries that doesnt have the required flavor param * returns a comma-separated ids of conversion jobs * * @action requestConversion * @param string $feedId * @return string */ public function requestConversionAction($feedId) { // find entry ids that already converted to the flavor $feedRendererWithTheFlavor = new KalturaSyndicationFeedRenderer($feedId); $feedRendererWithTheFlavor->addFlavorParamsAttachedFilter(); $entriesWithTheFlavor = $feedRendererWithTheFlavor->getEntriesIds(); // create filter of the entries that not converted $entryFilter = new entryFilter(); $entryFilter->setIdNotIn($entriesWithTheFlavor); // create feed with the new filter $feedRendererToConvert = new KalturaSyndicationFeedRenderer($feedId); $feedRendererToConvert->addFilter($entryFilter); $createdJobsIds = array(); $flavorParamsId = $feedRendererToConvert->syndicationFeed->flavorParamId; while ($entry = $feedRendererToConvert->getNextEntry()) { $originalFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entry->getId()); if (!is_null($originalFlavorAsset)) { $err = ""; $job = kBusinessPreConvertDL::decideAddEntryFlavor(null, $entry->getId(), $flavorParamsId, $err); if ($job && is_object($job)) { $createdJobsIds[] = $job->getId(); } } } return implode(',', $createdJobsIds); }
protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_eq_group_id", myPartnerUtils::PARTNER_GROUP); $fields_set->set("_in_type", entryType::MEDIA_CLIP . "," . entryType::MIX); }
/** * @action getFeed * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY * @param int $distributionProfileId * @param string $hash * @return file */ public function getFeedAction($distributionProfileId, $hash) { if (!$this->getPartnerId() || !$this->getPartner()) { throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId()); } $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId); if (!$profile || !$profile instanceof AttUverseDistributionProfile) { throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId); } if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) { throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId); } if ($profile->getUniqueHashForFeedUrl() != $hash) { throw new KalturaAPIException(AttUverseDistributionErrors::INVALID_FEED_URL); } // "Creates advanced filter on distribution profile $distributionAdvancedSearch = new ContentDistributionSearchFilter(); $distributionAdvancedSearch->setDistributionProfileId($profile->getId()); $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE); $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY); $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE); $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false); //Creates entry filter with advanced filter $entryFilter = new entryFilter(); $entryFilter->setStatusEquel(entryStatus::READY); $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED); $entryFilter->setPartnerSearchScope($this->getPartnerId()); $entryFilter->setAdvancedSearch($distributionAdvancedSearch); $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS); $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); $entryFilter->attachToCriteria($baseCriteria); $entries = entryPeer::doSelect($baseCriteria); $feed = new AttUverseDistributionFeedHelper('feed_template.xml', $profile); $channelTitle = $profile->getChannelTitle(); $counter = 0; foreach ($entries as $entry) { /* @var $entry entry */ /* @var $entryDistribution Entrydistribution */ $entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId()); if (!$entryDistribution) { KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']'); continue; } $fields = $profile->getAllFieldValues($entryDistribution); //flavors assets and remote flavor asset file urls $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::DISTRIBUTED_FLAVOR_IDS))); $remoteAssetFileUrls = unserialize($entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::REMOTE_ASSET_FILE_URLS)); //thumb assets and remote thumb asset file urls $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::DISTRIBUTED_THUMBNAIL_IDS))); $remoteThumbailFileUrls = unserialize($entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::REMOTE_THUMBNAIL_FILE_URLS)); //thumb assets and remote thumb asset file urls $captionAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::DISTRIBUTED_CAPTION_IDS))); $feed->addItem($fields, $flavorAssets, $remoteAssetFileUrls, $thumbAssets, $remoteThumbailFileUrls, $captionAssets); $counter++; //to avoid the cache exceeding the memory size if ($counter >= 100) { kMemoryManager::clearMemory(); $counter = 0; } } //set channel title if (isset($fields)) { $channelTitle = $fields[AttUverseDistributionField::CHANNEL_TITLE]; } $feed->setChannelTitle($channelTitle); header('Content-Type: text/xml'); echo str_replace('&', '&', html_entity_decode($feed->getXml(), ENT_QUOTES, 'UTF-8')); die; }
/** return array('status' => $status, 'message' => $message, 'objects' => $objects); objects - array of 'thumb' 'title' 'description' 'id' - unique id to be passed to getMediaInfo */ public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null) { $page_size = $pageSize > 20 ? 20 : $pageSize; $page--; if ($page < 0) { $page = 0; } $status = "ok"; $message = ''; $objects = array(); $should_serach = true; if (defined("KALTURA_API_V3")) { $kuser = kuserPeer::getKuserByPartnerAndUid(self::$partner_id, self::$puser_id); $should_serach = true; $kuser_id = $kuser->getId(); } else { $puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid(self::$partner_id, self::$subp_id, self::$puser_id, true); if (!$puser_kuser) { // very bad - does not exist in system $should_serach = false; } else { $kuser = $puser_kuser->getKuser(); if (!$kuser) { $should_serach = false; } else { $kuser_id = $kuser->getId(); } } } // echo "[" . self::$partner_id . "],[". self::$subp_id . "],[" . self::$puser_id . "],[$kuser_id]"; if ($should_serach) { $c = KalturaCriteria::create(entryPeer::OM_CLASS); $c->add(entryPeer::KUSER_ID, $kuser_id); $c->add(entryPeer::MEDIA_TYPE, $media_type); $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP); // $keywords_array = mySearchUtils::getKeywordsFromStr ( $searchText ); $filter = new entryFilter(); $filter->setPartnerSearchScope(self::$partner_id); $filter->addSearchMatchToCriteria($c, $searchText, entry::getSearchableColumnName()); $c->setLimit($pageSize); $c->setOffset($page * $pageSize); $entry_results = entryPeer::doSelect($c); //JoinAll( $c ); $number_of_results = $c->getRecordsCount(); $number_of_pages = (int) ($number_of_results / $pageSize); if ($number_of_results % $pageSize != 0) { $number_of_pages += 1; } // if there are some left-overs - there must be a nother page // add thumbs when not image or video $should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO; foreach ($entry_results as $entry) { // send the id as the url $object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getDescription()); if ($should_add_thumbs) { $object["thumb"] = $entry->getThumbnailUrl(); } $objects[] = $object; } } return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO); }
private function hasWidevineFlavorAssetsWithSameWvAssetIdInOtherEntries($wvAssetId, $entryId) { $entryFilter = new entryFilter(); $entryFilter->fields['_like_plugins_data'] = WidevinePlugin::getWidevineAssetIdSearchData($wvAssetId); $entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); $c = KalturaCriteria::create(entryPeer::OM_CLASS); $entryFilter->attachToCriteria($c); $c->add(entryPeer::ID, $entryId, Criteria::NOT_EQUAL); $c->applyFilters(); $entriesCount = $c->getRecordsCount(); if ($entriesCount) { KalturaLog::debug('Found active flavors for WV asset id [' . $wvAssetId . ']'); return true; } else { return false; } }
/** * Authenticate live-stream entry against stream token and partner limitations * * @action authenticate * @param string $entryId Live stream entry id * @param string $token Live stream broadcasting token * @return KalturaLiveStreamEntry The authenticated live stream entry * * @throws KalturaErrors::ENTRY_ID_NOT_FOUND * @throws KalturaErrors::LIVE_STREAM_INVALID_TOKEN */ function authenticateAction($entryId, $token) { $dbEntry = entryPeer::retrieveByPK($entryId); if (!$dbEntry || $dbEntry->getType() != entryType::LIVE_STREAM) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } /* @var $dbEntry LiveStreamEntry */ if ($dbEntry->getStreamPassword() != $token) { throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_INVALID_TOKEN, $entryId); } $mediaServer = $dbEntry->getMediaServer(true); if ($mediaServer) { $url = null; $protocol = null; foreach (array(KalturaPlaybackProtocol::HLS, KalturaPlaybackProtocol::APPLE_HTTP) as $hlsProtocol) { $config = $dbEntry->getLiveStreamConfigurationByProtocol($hlsProtocol, requestUtils::PROTOCOL_HTTP, null, true); if ($config) { $url = $config->getUrl(); $protocol = $hlsProtocol; break; } } if ($url) { KalturaLog::info('Determining status of live stream URL [' . $url . ']'); $dpda = new DeliveryProfileDynamicAttributes(); $dpda->setEntryId($entryId); $dpda->setFormat($protocol); $deliveryProfile = DeliveryProfilePeer::getLiveDeliveryProfileByHostName(parse_url($url, PHP_URL_HOST), $dpda); if ($deliveryProfile && $deliveryProfile->isLive($url)) { throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_ALREADY_BROADCASTING, $entryId, $mediaServer->getHostname()); } } } // fetch current stream live params $liveParamsIds = flavorParamsConversionProfilePeer::getFlavorIdsByProfileId($dbEntry->getConversionProfileId()); $usedLiveParamsIds = array(); foreach ($liveParamsIds as $liveParamsId) { $usedLiveParamsIds[$liveParamsId] = array($entryId); } // fetch all live entries that currently are live $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS); $filter = new entryFilter(); $filter->setIsLive(true); $filter->setIdNotIn(array($entryId)); $filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); $filter->attachToCriteria($baseCriteria); $entries = entryPeer::doSelect($baseCriteria); $maxInputStreams = $this->getPartner()->getMaxLiveStreamInputs(); if (!$maxInputStreams) { $maxInputStreams = kConf::get('partner_max_live_stream_inputs', 'local', 10); } KalturaLog::debug("Max live stream inputs [{$maxInputStreams}]"); $maxTranscodedStreams = 0; if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_KALTURA_LIVE_STREAM_TRANSCODE, $this->getPartnerId())) { $maxTranscodedStreams = $this->getPartner()->getMaxLiveStreamOutputs(); if (!$maxTranscodedStreams) { $maxTranscodedStreams = kConf::get('partner_max_live_stream_outputs', 'local', 10); } } KalturaLog::debug("Max live stream outputs [{$maxTranscodedStreams}]"); $totalInputStreams = count($entries) + 1; if ($totalInputStreams > $maxInputStreams + $maxTranscodedStreams) { KalturaLog::debug("Live input stream [{$totalInputStreams}]"); throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_EXCEEDED_MAX_PASSTHRU, $entryId); } $entryIds = array($entryId); foreach ($entries as $liveEntry) { /* @var $liveEntry LiveEntry */ $entryIds[] = $liveEntry->getId(); $liveParamsIds = array_map('intval', explode(',', $liveEntry->getFlavorParamsIds())); foreach ($liveParamsIds as $liveParamsId) { if (isset($usedLiveParamsIds[$liveParamsId])) { $usedLiveParamsIds[$liveParamsId][] = $liveEntry->getId(); } else { $usedLiveParamsIds[$liveParamsId] = array($liveEntry->getId()); } } } $liveParams = assetParamsPeer::retrieveByPKs(array_keys($usedLiveParamsIds)); $passthruEntries = null; $transcodedEntries = null; foreach ($liveParams as $liveParamsItem) { /* @var $liveParamsItem LiveParams */ if ($liveParamsItem->hasTag(liveParams::TAG_INGEST)) { $passthruEntries = array_intersect(is_array($passthruEntries) ? $passthruEntries : $entryIds, $usedLiveParamsIds[$liveParamsItem->getId()]); } else { $transcodedEntries = array_intersect(is_array($transcodedEntries) ? $transcodedEntries : $entryIds, $usedLiveParamsIds[$liveParamsItem->getId()]); } } $passthruEntries = array_diff($passthruEntries, $transcodedEntries); $passthruEntriesCount = count($passthruEntries); $transcodedEntriesCount = count($transcodedEntries); KalturaLog::debug("Live transcoded entries [{$transcodedEntriesCount}], max live transcoded streams [{$maxTranscodedStreams}]"); if ($transcodedEntriesCount > $maxTranscodedStreams) { throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_EXCEEDED_MAX_TRANSCODED, $entryId); } $maxInputStreams += $maxTranscodedStreams - $transcodedEntriesCount; KalturaLog::debug("Live params inputs [{$passthruEntriesCount}], max live stream inputs [{$maxInputStreams}]"); if ($passthruEntriesCount > $maxInputStreams) { throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_EXCEEDED_MAX_PASSTHRU, $entryId); } $entry = KalturaEntryFactory::getInstanceByType($dbEntry->getType()); $entry->fromObject($dbEntry, $this->getResponseProfile()); return $entry; }
/** * List base entries by filter according to reference id * * @action listByReferenceId * @param string $refId Entry Reference ID * @param KalturaFilterPager $pager Pager * @throws KalturaErrors::MISSING_MANDATORY_PARAMETER */ function listByReferenceId($refId, KalturaFilterPager $pager = null) { if (!$refId) { //if refId wasn't provided return an error of missing parameter throw new KalturaAPIException(KalturaErrors::MISSING_MANDATORY_PARAMETER, $refId); } if (!$pager) { $pager = new KalturaFilterPager(); } $entryFilter = new entryFilter(); $entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); //setting reference ID $entryFilter->set('_eq_reference_id', $refId); $c = KalturaCriteria::create(entryPeer::OM_CLASS); $pager->attachToCriteria($c); $entryFilter->attachToCriteria($c); $c->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); KalturaCriterion::disableTag(KalturaCriterion::TAG_WIDGET_SESSION); $list = entryPeer::doSelect($c); KalturaCriterion::restoreTag(KalturaCriterion::TAG_WIDGET_SESSION); $totalCount = $c->getRecordsCount(); $newList = KalturaBaseEntryArray::fromEntryArray($list, false); $response = new KalturaBaseEntryListResponse(); $response->objects = $newList; $response->totalCount = $totalCount; return $response; }
private function getLicenseRequestEntry($keyId, $entryId = null) { $entry = null; $keyId = strtolower($keyId); if (!$keyId) { throw new KalturaAPIException(KalturaErrors::MISSING_MANDATORY_PARAMETER, "keyId"); } if ($entryId) { $entry = entryPeer::retrieveByPK($entryId); if (!$entry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } $entryKeyId = $this->getEntryKeyId($entry->getId()); if ($entryKeyId != $keyId) { throw new KalturaAPIException(KalturaPlayReadyErrors::KEY_ID_DONT_MATCH, $keyId, $entryKeyId); } } else { $entryFilter = new entryFilter(); $entryFilter->fields['_like_plugins_data'] = PlayReadyPlugin::getPlayReadyKeyIdSearchData($keyId); $entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); $c = KalturaCriteria::create(entryPeer::OM_CLASS); $entryFilter->attachToCriteria($c); $c->applyFilters(); $entries = entryPeer::doSelect($c); if ($entries && count($entries) > 0) { $entry = $entries[0]; } if (!$entry) { throw new KalturaAPIException(KalturaPlayReadyErrors::ENTRY_NOT_FOUND_BY_KEY_ID, $keyId); } } return $entry; }
/** * @param KalturaBaseEntryFilter $filter * @param KalturaFilterPager $pager * @return KalturaCriteria */ protected function prepareEntriesCriteriaFilter(KalturaBaseEntryFilter $filter = null, KalturaFilterPager $pager = null) { if (!$filter) { $filter = new KalturaBaseEntryFilter(); } // because by default we will display only READY entries, and when deleted status is requested, we don't want this to disturb entryPeer::allowDeletedInCriteriaFilter(); $this->setDefaultStatus($filter); $this->setDefaultModerationStatus($filter); $this->fixFilterUserId($filter); $this->fixFilterDuration($filter); $entryFilter = new entryFilter(); $entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); $filter->toObject($entryFilter); $c = KalturaCriteria::create(entryPeer::OM_CLASS); if ($pager) { $pager->attachToCriteria($c); } $entryFilter->attachToCriteria($c); $c->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); // when session is not admin and without list:* privilege, allow access to user entries only //moved to Additional criteria on entryPeer //moved it init service. /*if (!$this->getKs() || (!$this->getKs()->isAdmin() && !$this->getKs()->verifyPrivileges(ks::PRIVILEGE_LIST, ks::PRIVILEGE_WILDCARD))) { KalturaCriterion::enableTag(KalturaCriterion::TAG_WIDGET_SESSION);*/ /*$filter->userIdEqual = $this->getKuser()->getPuserId(); $crit = $c->getNewCriterion(entryPeer::KUSER_ID , $this->getKuser()->getId(), Criteria::EQUAL); $c->addAnd($crit);*/ /*}*/ return $c; }
protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_eq_type", entryType::DVD); $this->setP("use_filter_puser_id", "false"); // don't mind filtering according to the puser/kuser }
/** * This is not a regular service. * Because the caller is not a partner but rather a 3rd party provider that wishs to query our system, * The security is slightly different and the respons is in the format of mRss which is related to entries only. */ public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2; header("Content-Type: text/xml; charset=utf-8"); // TODO - verify permissions for viewing lists // validate the ks of the caller $code = $this->getP("code"); if ($code != 'fsalh5423a43g') { return "<xml></xml>"; die; } $detailed = $this->getP("detailed", false); $limit = $this->getP("page_size", 100); $limit = $this->maxPageSize($limit); $operated_partner_id = $this->getP("operated_partner_id"); $page = $this->getP("page", 1); $offset = ($page - 1) * $limit; // kuserPeer::setUseCriteriaFilter( false ); if ($operated_partner_id) { entryPeer::setUseCriteriaFilter(true); } else { entryPeer::setUseCriteriaFilter(false); } // FOR now - display only 2 partners // 2460 - dorimedia $partner_list = array(593, 2460); $c = KalturaCriteria::create(entryPeer::OM_CLASS); $c->addAnd(entryPeer::STATUS, entryStatus::READY); // for now display only entries that are part of the kaltura network // $c->addAnd ( entryPeer::DISPLAY_IN_SEARCH , mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK ); // filter $filter = new entryFilter(); $fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null); $this->setExtraFilters($filter); $offset = ($page - 1) * $limit; $c->setLimit($limit); if ($offset > 0) { $c->setOffset($offset); } $filter->attachToCriteria($c); //if ($order_by != -1) entryPeer::setOrder( $c , $order_by ); $c->addAnd(entryPeer::PARTNER_ID, $partner_list, Criteria::IN); $start_1 = microtime(true); if ($detailed) { // for some entry types - there are no kshow or kusers - don't join even when detailed if ($this->joinOnDetailed()) { $list = entryPeer::doSelectJoinAll($c); } else { $list = entryPeer::doSelect($c); } $level = objectWrapperBase::DETAIL_LEVEL_DETAILED; } else { $list = entryPeer::doSelect($c); $level = objectWrapperBase::DETAIL_LEVEL_REGULAR; } $count = $c->getRecordsCount(); $end_1 = microtime(true); KalturaLog::log("benchmark db: [" . ($end_1 - $start_1) . "]"); $result_count = count($list); $start_2 = microtime(true); $mrss_renderer = new kalturaRssRenderer(kalturaRssRenderer::TYPE_TABOOLA); $str = $mrss_renderer->renderMrssFeed($list, $page, $result_count); $end_2 = microtime(true); KalturaLog::log("benchmark render: [" . ($end_2 - $start_2) . "]"); echo $str; // don't return to the rest of the implementation - the base class manipulates the content. die; }
/** * will set the match-against cluase depending on the input_filter->categories * * If emtpy, will return the valid "1=1" query element so the queries will stay correct * * @param reportsInputFilter $input_filter */ private static function setCategoriesMatchClause(reportsInputFilter $input_filter) { $categories_ids_str = null; if ($input_filter->categories) { $categories_ids_str = entryFilter::categoryNamesToIndexedIds($input_filter->categories); if ($categories_ids_str) { $categories_match = " MATCH (search_text_discrete) AGAINST ( '{$categories_ids_str}' IN BOOLEAN MODE ) "; return $categories_match; } } return "1=1"; }
/** * @param KalturaFilterPager $pager * @return KalturaCriteria */ public function prepareEntriesCriteriaFilter(KalturaFilterPager $pager = null) { // because by default we will display only READY entries, and when deleted status is requested, we don't want this to disturb entryPeer::allowDeletedInCriteriaFilter(); $c = KalturaCriteria::create(entryPeer::OM_CLASS); if ($this->idEqual == null && $this->redirectFromEntryId == null) { $this->setDefaultStatus(); $this->setDefaultModerationStatus($this); if ($this->parentEntryIdEqual == null) { $c->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); } } $this->fixFilterUserId($this); $entryFilter = new entryFilter(); $entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); $this->toObject($entryFilter); if ($pager) { $pager->attachToCriteria($c); } $entryFilter->attachToCriteria($c); return $c; }
private static function addSchedulingToCriteria(Criteria $c, entryFilter $filter = null) { $min = 0; $max = kApiCache::getTime(); $allowNull = true; if ($filter) { if ($filter->is_set('_lteornull_start_date')) { $max = min($max, $filter->get('_lteornull_start_date')); $filter->unsetByName('_lteornull_start_date'); } if ($filter->is_set('_gteornull_start_date')) { $min = max($min, $filter->get('_gteornull_start_date')); $filter->unsetByName('_gteornull_start_date'); } if ($filter->is_set('_lte_start_date')) { $max = min($max, $filter->get('_lte_start_date')); $allowNull = false; $filter->unsetByName('_lte_start_date'); } if ($filter->is_set('_gte_start_date')) { $min = max($min, $filter->get('_gte_start_date')); $allowNull = false; $filter->unsetByName('_gte_start_date'); } } self::addSchedulingCriterion($c, entryPeer::START_DATE, $min, $max, $allowNull); $min = kApiCache::getTime(); $max = 0; $allowNull = true; if ($filter) { if ($filter->is_set('_lteornull_end_date')) { $max = min($max, $filter->get('_lteornull_end_date')); $filter->unsetByName('_lteornull_end_date'); } if ($filter->is_set('_gteornull_end_date')) { $min = max($min, $filter->get('_gteornull_end_date')); $filter->unsetByName('_gteornull_end_date'); } if ($filter->is_set('_lte_end_date')) { $max = min($max, $filter->get('_lte_end_date')); $allowNull = false; $filter->unsetByName('_lte_end_date'); } if ($filter->is_set('_gte_end_date')) { $min = max($min, $filter->get('_gte_end_date')); $allowNull = false; $filter->unsetByName('_gte_end_date'); } } self::addSchedulingCriterion($c, entryPeer::END_DATE, $min, $max, $allowNull); }
public static function toQueryString(entry $playlist, $should_append_filter_to_url = false) { $query = "playlist_id={$playlist->getId()}"; if ($playlist->getMediaType() != entry::ENTRY_MEDIA_TYPE_XML) { return $query; } if (!$should_append_filter_to_url) { return $query; } $xml = $playlist->getDataContent(); list($total_results, $list_of_filters) = self::getPlaylistFilterListStruct($xml); $entry_filters = array(); $partner_id = $playlist->getPartnerId(); // add ks=_KS_ for the playlist to replace it before hitting the executePlaylist $query .= "&fp=f"; // make sure the filter prefix is short if (!$list_of_filters) { return $query; } $i = 1; // the extra_filter is 1-based foreach ($list_of_filters as $entry_filter_xml) { $prefix = "f{$i}_"; // in general this service can fetch entries from kaltura networks. // for each filter we should decide if thie assumption is true... $allow_partner_only = true; // compile all the filters - only then execute them if not yet reached the total_results // TODO - optimize - maybe create them only when needed. - For now it's safer to compile all even if not needed. $entry_filter = new entryFilter(); // add the desired prefix "_" because the XML is not expected to have it while the entryFilter class expects it $entry_filter->fillObjectFromXml($entry_filter_xml, "_"); // make sure there is alway a limit for each filter - if not an explicit one - the system limit should be used if ($entry_filter->getLimit() == null || $entry_filter->getLimit() < 1) { $entry_filter->setLimit(self::TOTAL_RESULTS); } $entry_filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); self::updateEntryFilter($entry_filter, $partner_id); //$entry_filters[] = $entry_filter; $fields = $entry_filter->fields; foreach ($fields as $field => $value) { if ($value) { $query .= "&" . $prefix . $field . "=" . $value; } } $i++; } return $query; }
public function attachToFinalCriteria(Criteria $c) { $c->addCondition(entryIndex::DYNAMIC_ATTRIBUTES . '.' . QuizPlugin::getDynamicAttributeName() . ' = 1'); return parent::attachToFinalCriteria($c); }
/** * Returns all live entries that were live in the past X hours */ protected function getLiveEntries(WSLiveReportsClient $client, $partnerId, KalturaFilterPager $pager) { // Get live entries list /** @var WSLiveEntriesListResponse */ $response = $client->getLiveEntries($partnerId); if ($response->totalCount == 0) { return null; } // Hack to overcome the bug of single value $entryIds = $response->entries; if (!is_array($entryIds)) { $entryIds = array(); $entryIds[] = $response->entries; } // Order entries by first broadcast $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS); $filter = new entryFilter(); $filter->setTypeEquel(KalturaEntryType::LIVE_STREAM); $filter->setIdIn($entryIds); $filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); $filter->attachToCriteria($baseCriteria); $baseCriteria->addAscendingOrderByColumn("entry.name"); $pager->attachToCriteria($baseCriteria); $entries = entryPeer::doSelect($baseCriteria); $entryIds = array(); foreach ($entries as $entry) { $entryIds[] = $entry->getId(); } $totalCount = $baseCriteria->getRecordsCount(); return array($entryIds, $totalCount); }
public function playlistContentXmlToFilters() { list($totalResults, $listOfFilters) = myPlaylistUtils::getPlaylistFilterListStruct($this->playlistContent); // $totalResults is SimpleXMLElement $this->filters = new KalturaMediaEntryFilterForPlaylistArray(); foreach ($listOfFilters as $entryFilterXml) { $entryFilter = new entryFilter(); $entryFilter->fillObjectFromXml($entryFilterXml, "_"); $filter = new KalturaMediaEntryFilterForPlaylist(); $filter->fromObject($entryFilter); $this->filters[] = $filter; } $this->totalResults = (int) $totalResults; // will cast SimpleXMLElement correctly }