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();
 }
예제 #2
0
 protected static function getReplacingEntry($recordedEntry, $asset, $retries = 1)
 {
     $replacingEntryId = $recordedEntry->getReplacingEntryId();
     $replacingEntry = null;
     // in replacement
     if ($replacingEntryId) {
         $replacingEntry = entryPeer::retrieveByPKNoFilter($replacingEntryId);
         // check if asset already ingested
         $replacingAsset = assetPeer::retrieveByEntryIdAndParams($replacingEntryId, $asset->getFlavorParamsId());
         if ($replacingAsset) {
             KalturaLog::err('Asset with params [' . $asset->getFlavorParamsId() . '] already replaced');
             return null;
         }
     } else {
         $advancedOptions = new kEntryReplacementOptions();
         $advancedOptions->setKeepManualThumbnails(true);
         $recordedEntry->setReplacementOptions($advancedOptions);
         $replacingEntry = new entry();
         $replacingEntry->setType(entryType::MEDIA_CLIP);
         $replacingEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_VIDEO);
         $replacingEntry->setConversionProfileId($recordedEntry->getConversionProfileId());
         $replacingEntry->setName($recordedEntry->getPartnerId() . '_' . time());
         $replacingEntry->setKuserId($recordedEntry->getKuserId());
         $replacingEntry->setAccessControlId($recordedEntry->getAccessControlId());
         $replacingEntry->setPartnerId($recordedEntry->getPartnerId());
         $replacingEntry->setSubpId($recordedEntry->getPartnerId() * 100);
         $replacingEntry->setDefaultModerationStatus();
         $replacingEntry->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM);
         $replacingEntry->setReplacedEntryId($recordedEntry->getId());
         $replacingEntry->save();
         $recordedEntry->setReplacingEntryId($replacingEntry->getId());
         $recordedEntry->setReplacementStatus(entryReplacementStatus::APPROVED_BUT_NOT_READY);
         $affectedRows = $recordedEntry->save();
         if (!$affectedRows) {
             $replacingEntry->delete();
             $replacingEntry = null;
             if ($retries) {
                 sleep(10);
                 $recordedEntry = entryPeer::retrieveByPKNoFilter($recordedEntry->getId());
                 return kFlowHelper::getReplacingEntry($recordedEntry, $asset, 0);
             } else {
                 KalturaLog::err("Failed to update replacing entry");
                 return null;
             }
         }
     }
     return $replacingEntry;
 }
예제 #3
0
파일: kFlowHelper.php 프로젝트: wzur/server
 private static function createReplacigEntry($recordedEntry)
 {
     $advancedOptions = new kEntryReplacementOptions();
     $advancedOptions->setKeepManualThumbnails(true);
     $recordedEntry->setReplacementOptions($advancedOptions);
     $replacingEntry = new entry();
     $replacingEntry->setType(entryType::MEDIA_CLIP);
     $replacingEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_VIDEO);
     $replacingEntry->setConversionProfileId($recordedEntry->getConversionProfileId());
     $replacingEntry->setName($recordedEntry->getPartnerId() . '_' . time());
     $replacingEntry->setKuserId($recordedEntry->getKuserId());
     $replacingEntry->setAccessControlId($recordedEntry->getAccessControlId());
     $replacingEntry->setPartnerId($recordedEntry->getPartnerId());
     $replacingEntry->setSubpId($recordedEntry->getPartnerId() * 100);
     $replacingEntry->setDefaultModerationStatus();
     $replacingEntry->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM);
     $replacingEntry->setReplacedEntryId($recordedEntry->getId());
     $replacingEntry->save();
     $recordedEntry->setReplacingEntryId($replacingEntry->getId());
     $recordedEntry->setReplacementStatus(entryReplacementStatus::APPROVED_BUT_NOT_READY);
     $affectedRows = $recordedEntry->save();
     return $replacingEntry;
 }