protected function executeImpl(kshow $kshow) { $asset_type = $this->getRequestParameter("type", entry::ENTRY_MEDIA_TYPE_VIDEO); if ($asset_type > entry::ENTRY_MEDIA_TYPE_AUDIO || $asset_type < entry::ENTRY_MEDIA_TYPE_VIDEO) { // TODO - // trying to fetch invalid media type } $show_entry_id = $kshow->getShowEntryId(); $intro_id = $kshow->getIntroId(); $c = new Criteria(); $c->add(entryPeer::KUSER_ID, kuser::KUSER_KALTURA); $c->add(entryPeer::TYPE, kuser::KUSER_KALTURA); $this->entry_list = entryPeer::doSelect($c); if ($this->entry_list == NULL) { $this->entry_list = array(); } }
/** * Executes index action */ protected function executeImpl(kshow $kshow) { $this->xml_content = ""; $kshow_id = $this->kshow_id; if ($kshow_id == NULL || $kshow_id == 0) { return sfView::SUCCESS; } $metadata_creator = new myKshowMetadataCreator(); $this->show_metadata = $metadata_creator->createMetadata($kshow_id); // $kshow = kshowPeer:retrieveByPK( $kshow_id ); $entry = entryPeer::retrieveByPK($kshow->getShowEntryId()); // TODO - this should never happen if ($entry == NULL) { // there is no show entry for this show ! $entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $kshow->getProducerId()); } $content_path = myContentStorage::getFSContentRootPath(); $file_path = $content_path . $entry->getDataPath(); // check to see if the content of the file changed $current_metadata = kFile::getFileContent($file_path); $comp_result = strcmp($this->show_metadata, $current_metadata); if ($comp_result != 0) { $ext = pathinfo($file_path, PATHINFO_EXTENSION); if ($ext != "xml") { // this is for the first time - override the template path by setting the data to NULL $entry->setData(NULL); $file_path = pathinfo($file_path, PATHINFO_DIRNAME) . "/" . kFile::getFileNameNoExtension($file_path) . ".xml"; } // this will increment the name if needed $entry->setData($file_path); $file_path = $content_path . $entry->getDataPath(); $entry->save(); kFile::fullMkdir($file_path); kFile::setFileContent($file_path, $this->show_metadata); $this->xml_content = $this->show_metadata; } }
public static function shalowClone(kshow $source_kshow, $new_prodcuer_id) { $target_kshow = $source_kshow->copy(); $target_kshow->setProducerId($new_prodcuer_id); $target_kshow->save(); self::resetKshowStats($target_kshow, true); if (!$source_kshow->getEpisodeId()) { $target_kshow->setEpisodeId($source_kshow->getId()); } //$target_kshow->setHasRoughcut($source_kshow->getHasRoughcut()); $target_show_entry = $target_kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $new_prodcuer_id); $content = myContentStorage::getFSContentRootPath(); $source_thumbnail_path = $source_kshow->getThumbnailPath(); $target_kshow->setThumbnail(null); $target_kshow->setThumbnail($source_kshow->getThumbnail()); $target_thumbnail_path = $target_kshow->getThumbnailPath(); // myContentStorage::moveFile( $content . $source_thumbnail_path , $content . $target_thumbnail_path , false , true ); $target_kshow->save(); // copy the show_entry file content $source_show_entry = entryPeer::retrieveByPK($source_kshow->getShowEntryId()); $source_show_entry_data_key = $source_show_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA); $target_show_entry->setData(null); $target_show_entry->setData($source_show_entry->getData()); $target_show_entry_data_key = $target_show_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA); $target_show_entry->setName($source_show_entry->getName()); $target_show_entry->setLengthInMsecs($source_show_entry->getLengthInMsecs()); kFileSyncUtils::softCopy($source_show_entry_data_key, $target_show_entry_data_key); //myContentStorage::moveFile( $content . $source_show_entry_path , $content . $target_show_entry_path , false , true ); myEntryUtils::createThumbnail($target_show_entry, $source_show_entry, true); // $target_kshow->setHasRoughcut(true); // $target_kshow->save(); $target_show_entry->save(); return $target_kshow; }