private function getFlavorAssetUrl($kalturaEntry) { $partner = PartnerPeer::retrieveByPK($this->syndicationFeed->partnerId); if (!$partner) { return null; } $flavorAsset = assetPeer::retrieveByEntryIdAndParams($kalturaEntry->id, $this->syndicationFeed->flavorParamId); if (!$flavorAsset) { return null; } $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $externalStorageUrl = $this->getExternalStorageUrl($partner, $flavorAsset, $syncKey); if ($externalStorageUrl) { return $externalStorageUrl; } if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) { return null; } if ($this->syndicationFeedDb->getServePlayManifest()) { $cdnHost = requestUtils::getApiCdnHost(); $clientTag = 'feed:' . $this->syndicationFeedDb->getId(); $url = $cdnHost . $flavorAsset->getPlayManifestUrl($clientTag); } else { $urlManager = DeliveryProfilePeer::getDeliveryProfile($flavorAsset->getEntryId()); $urlManager->initDeliveryDynamicAttributes(null, $flavorAsset); $url = "http://" . $urlManager->getFullAssetUrl($flavorAsset); } return $url; }
private function getFlavorAssetUrl($kalturaEntry) { $partner = PartnerPeer::retrieveByPK($this->syndicationFeed->partnerId); if (!$partner) { return null; } $flavorAsset = assetPeer::retrieveByEntryIdAndParams($kalturaEntry->id, $this->syndicationFeed->flavorParamId); if (!$flavorAsset) { return null; } $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $externalStorageUrl = $this->getExternalStorageUrl($partner, $flavorAsset, $syncKey); if ($externalStorageUrl) { return $externalStorageUrl; } if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) { return null; } if ($this->syndicationFeedDb->getServePlayManifest()) { $shouldAddKtToken = false; if ($this->syndicationFeed->type == KalturaSyndicationFeedType::ITUNES) { $entry = $flavorAsset->getentry(); $accessControl = $entry->getaccessControl(); if ($accessControl && $accessControl->hasRules()) { $shouldAddKtToken = true; } } $cdnHost = requestUtils::getApiCdnHost(); $clientTag = 'feed:' . $this->syndicationFeedDb->getId(); $url = $cdnHost . $flavorAsset->getPlayManifestUrl($clientTag, null, PlaybackProtocol::HTTP, $shouldAddKtToken); } else { $urlManager = DeliveryProfilePeer::getDeliveryProfile($flavorAsset->getEntryId()); $urlManager->initDeliveryDynamicAttributes(null, $flavorAsset); $protocol = requestUtils::getProtocol(); if (!$urlManager->isProtocolSupported($protocol)) { $protocol = $protocol == 'http' ? 'https' : 'http'; if (!$urlManager->isProtocolSupported($protocol)) { $protocol = 'http'; } } $url = $protocol . '://' . $urlManager->getFullAssetUrl($flavorAsset); } return $url; }
/** * @param syndicationFeed $syndicationFeed */ protected function syndicationFeedDeleted(syndicationFeed $syndicationFeed) { if ($syndicationFeed->getType() == syndicationFeedType::KALTURA_XSLT) { $this->syncableDeleted($syndicationFeed->getId(), FileSyncObjectType::SYNDICATION_FEED); } }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param syndicationFeed $value A syndicationFeed object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(syndicationFeed $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) { self::$instances[$key] = $obj; kMemoryManager::registerPeer('syndicationFeedPeer'); } } }
/** * @param $entry * @param $syndicationFeed * @return string */ private function getMrssEntryXml(entry $entry, syndicationFeed $syndicationFeed = null, $link = null) { if ($syndicationFeed->getMrssParameters()) { $mrssParams = clone $syndicationFeed->getMrssParameters(); } else { $mrssParams = new kMrssParameters(); } $mrssParams->setLink($link); $mrssParams->setFilterByFlavorParams($syndicationFeed->getFlavorParamId()); $mrssParams->setIncludePlayerTag(true); $mrssParams->setPlayerUiconfId($syndicationFeed->getPlayerUiconfId()); $mrssParams->setStorageId($syndicationFeed->getStorageId()); $mrssParams->setServePlayManifest($syndicationFeed->getServePlayManifest()); $mrssParams->setPlayManifestClientTag('feed:' . $syndicationFeed->getId()); $mrss = kMrssManager::getEntryMrssXml($entry, null, $mrssParams); if (!$mrss) { KalturaLog::err("No MRSS returned for entry [" . $entry->getId() . "]"); return null; } return $mrss->asXML(); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param syndicationFeed $value A syndicationFeed object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(syndicationFeed $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
/** * @param $entry * @param $syndicationFeed * @return string */ private function getMrssEntryXml(entry $entry, syndicationFeed $syndicationFeed = null, $link = null) { if ($syndicationFeed->getMrssParameters()) { $mrssParams = clone $syndicationFeed->getMrssParameters(); } else { $mrssParams = new kMrssParameters(); } $mrssParams->setLink($link); $mrssParams->setFilterByFlavorParams($syndicationFeed->getFlavorParamId()); $mrssParams->setIncludePlayerTag(true); $mrssParams->setPlayerUiconfId($syndicationFeed->getPlayerUiconfId()); $mrssParams->setStorageId($syndicationFeed->getStorageId()); $mrssParams->setServePlayManifest($syndicationFeed->getServePlayManifest()); $mrssParams->setPlayManifestClientTag('feed:' . $syndicationFeed->getId()); $features = null; if ($syndicationFeed->getUseCategoryEntries()) { KalturaLog::info("Getting entry's associated categories from the category_entry table"); $features = array(ObjectFeatureType::CATEGORY_ENTRIES); } $mrss = kMrssManager::getEntryMrssXml($entry, null, $mrssParams, $features); if (!$mrss) { KalturaLog::err("No MRSS returned for entry [" . $entry->getId() . "]"); return null; } return $mrss->asXML(); }