CC-3174: showbuilder/library refactoring
adding new context menu files, playlist is working except for editing fades.
This commit is contained in:
parent
46fdf56b70
commit
38f3d6bfb0
14 changed files with 2124 additions and 538 deletions
|
@ -165,15 +165,18 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$ids = $this->_getParam('ids');
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
$afterItem = $this->_getParam('afterItem', null);
|
||||
//$afterItem = (!is_numeric($afterItem)) ? null : intval($afterItem);
|
||||
$addType = $this->_getParam('type', 'after');
|
||||
|
||||
Logging::log("type is ".$addType);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->addAudioClips($ids, $afterItem);
|
||||
$pl->addAudioClips($ids, $afterItem, $addType);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist {$pl_id} not found");
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
|
@ -189,15 +192,15 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$ids = $this->_getParam('ids');
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
$afterItem = $this->_getParam('afterItem', null);
|
||||
//$afterItem = (!is_numeric($afterItem)) ? null : intval($afterItem);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->moveAudioClips($ids, $afterItem);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist {$pl_id} not found");
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
|
@ -218,8 +221,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl->delAudioClips($ids);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist {$pl_id} not found");
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
|
@ -232,23 +236,30 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
public function setCueAction()
|
||||
{
|
||||
$pos = $this->_getParam('pos');
|
||||
$pl = $this->getPlaylist();
|
||||
if ($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
$cueIn = $this->_getParam('cueIn', null);
|
||||
$cueOut = $this->_getParam('cueOut', null);
|
||||
|
||||
$response = $pl->changeClipLength($pos, $cueIn, $cueOut);
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$response = $pl->changeClipLength($id, $cueIn, $cueOut);
|
||||
|
||||
$this->view->response = $response;
|
||||
$this->view->response = $response;
|
||||
|
||||
if(!isset($response["error"])) {
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
if(!isset($response["error"])) {
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
public function setFadeAction()
|
||||
|
|
|
@ -209,8 +209,10 @@ class Application_Model_Playlist {
|
|||
* an array of audioclips to add to the playlist
|
||||
* @param int|null $p_afterItem
|
||||
* item which to add the new items after in the playlist, null if added to the end.
|
||||
* @param string (before|after) $addAfter
|
||||
* whether to add the clips before or after the selected item.
|
||||
*/
|
||||
public function addAudioClips($p_items, $p_afterItem=NULL)
|
||||
public function addAudioClips($p_items, $p_afterItem=NULL, $addType = 'after')
|
||||
{
|
||||
$this->con->beginTransaction();
|
||||
$contentsToUpdate = array();
|
||||
|
@ -221,11 +223,14 @@ class Application_Model_Playlist {
|
|||
Logging::log("Finding playlist content item {$p_afterItem}");
|
||||
|
||||
$afterItem = CcPlaylistcontentsQuery::create()->findPK($p_afterItem);
|
||||
$pos = $afterItem->getDbPosition() + 1;
|
||||
|
||||
$index = $afterItem->getDbPosition();
|
||||
Logging::log("index is {$index}");
|
||||
$pos = ($addType == 'after') ? $index + 1 : $index;
|
||||
|
||||
$contentsToUpdate = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos-1, Criteria::GREATER_THAN)
|
||||
->filterByDbPosition($pos, Criteria::GREATER_EQUAL)
|
||||
->orderByDbPosition()
|
||||
->find($this->con);
|
||||
|
||||
|
@ -234,8 +239,9 @@ class Application_Model_Playlist {
|
|||
}
|
||||
else {
|
||||
|
||||
$pos = $this->getSize();
|
||||
Logging::log("Adding to end of playlist");
|
||||
$pos = ($addType == 'after') ? $this->getSize() : 0;
|
||||
|
||||
Logging::log("Adding to playlist");
|
||||
Logging::log("at position {$pos}");
|
||||
}
|
||||
|
||||
|
@ -449,22 +455,6 @@ class Application_Model_Playlist {
|
|||
return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
|
||||
}
|
||||
|
||||
public function getCueInfo($pos) {
|
||||
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->joinWith(CcFilesPeer::OM_CLASS)
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos)
|
||||
->findOne();
|
||||
|
||||
$file = $row->getCcFiles();
|
||||
$origLength = $file->getDbLength();
|
||||
$cueIn = $row->getDBCuein();
|
||||
$cueOut = $row->getDbCueout();
|
||||
|
||||
return array($cueIn, $cueOut, $origLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change cueIn/cueOut values for playlist element
|
||||
*
|
||||
|
@ -476,27 +466,26 @@ class Application_Model_Playlist {
|
|||
* new value in ss.ssssss or extent format
|
||||
* @return boolean or pear error object
|
||||
*/
|
||||
public function changeClipLength($pos, $cueIn, $cueOut)
|
||||
public function changeClipLength($id, $cueIn, $cueOut)
|
||||
{
|
||||
$errArray= array();
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
if(is_null($cueIn) && is_null($cueOut)) {
|
||||
if (is_null($cueIn) && is_null($cueOut)) {
|
||||
$errArray["error"]="Cue in and cue out are null.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
if(is_null($pos) || $pos < 0 || $pos >= $this->getNextPos()) {
|
||||
$errArray["error"]="Invalid position.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->joinWith(CcFilesPeer::OM_CLASS)
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos)
|
||||
->filterByPrimaryKey($id)
|
||||
->findOne();
|
||||
|
||||
if (is_null($row)) {
|
||||
$errArray["error"]="Playlist item does not exist!.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$oldCueIn = $row->getDBCuein();
|
||||
$oldCueOut = $row->getDbCueout();
|
||||
$fadeIn = $row->getDbFadein();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<dl id="spl_cue_editor" class="inline-list">
|
||||
<dt>Cue In:</dt>
|
||||
<dd id="spl_cue_in_<?php echo $this->pos; ?>" class="spl_cue_in">
|
||||
<dd id="spl_cue_in_<?php echo $this->id; ?>" class="spl_cue_in">
|
||||
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueIn; ?></span>
|
||||
</dd>
|
||||
<dd class="edit-error"></dd>
|
||||
<dt>Cue Out:</dt>
|
||||
<dd id="spl_cue_out_<?php echo $this->pos; ?>" class="spl_cue_out">
|
||||
<dd id="spl_cue_out_<?php echo $this->id; ?>" class="spl_cue_out">
|
||||
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueOut; ?></span>
|
||||
</dd>
|
||||
<dd class="edit-error"></dd>
|
||||
|
|
|
@ -30,7 +30,7 @@ if (count($items)) : ?>
|
|||
|
||||
<div id="cues_<?php echo $i ?>" class="cue-edit clearfix" style="display: none">
|
||||
<?php echo $this->partial('playlist/set-cue.phtml', array(
|
||||
'pos' => $i,
|
||||
'id' => $item["id"],
|
||||
'cueIn' => $item['cuein'],
|
||||
'cueOut' => $item['cueout'],
|
||||
'origLength' => $item["CcFiles"]['length'])); ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue