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;
 }
예제 #2
0
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     $list_type = $this->getP("list_type", self::LIST_TYPE_ALL);
     $kshow_entry_list = array();
     $kuser_entry_list = array();
     if ($list_type & self::LIST_TYPE_KSHOW) {
         $c = new Criteria();
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
         $c->add(entryPeer::KSHOW_ID, $this->kshow_id);
         $kshow_entry_list = entryPeer::doSelectJoinkuser($c);
     }
     if ($list_type & self::LIST_TYPE_KUSER) {
         $c = new Criteria();
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
         $c->add(entryPeer::KUSER_ID, $this->getLoggedInUserIds(), Criteria::IN);
         $kuser_entry_list = entryPeer::doSelectJoinkuser($c);
     }
     if ($list_type & self::LIST_TYPE_EPISODE) {
         if ($kshow->getEpisodeId()) {
             // episode_id will point to the "parent" kshow
             // fetch the entries of the parent kshow
             $c = new Criteria();
             $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
             $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
             $c->add(entryPeer::KSHOW_ID, $kshow->getEpisodeId());
             $parent_kshow_entries = entryPeer::doSelectJoinkuser($c);
             if (count($parent_kshow_entries)) {
                 $kshow_entry_list = kArray::append($kshow_entry_list, $parent_kshow_entries);
             }
         }
     }
     // fetch all entries that were used in the roughcut - those of other kusers
     // - appeared under kuser_entry_list when someone else logged in
     if ($list_type & self::LIST_TYPE_ROUGHCUT) {
         if ($kshow->getHasRoughcut()) {
             $roughcut_file_name = $entry->getDataPath();
             $entry_ids_from_roughcut = myFlvStreamer::getAllAssetsIds($roughcut_file_name);
             $final_id_list = array();
             foreach ($entry_ids_from_roughcut as $id) {
                 $found = false;
                 foreach ($kshow_entry_list as $entry) {
                     if ($entry->getId() == $id) {
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     $final_id_list[] = $id;
                 }
             }
             $c = new Criteria();
             $c->add(entryPeer::ID, $final_id_list, Criteria::IN);
             $extra_entries = entryPeer::doSelectJoinkuser($c);
             // merge the 2 lists into 1:
             $kshow_entry_list = kArray::append($kshow_entry_list, $extra_entries);
         }
     }
     $this->kshow_entry_list = $kshow_entry_list;
     $this->kuser_entry_list = $kuser_entry_list;
 }