CC-1615 playlist editor handles cuein/out fadein/out edits with '00:00:00.000000' format.
This commit is contained in:
parent
32368e794c
commit
373a5df4e9
|
@ -48,8 +48,9 @@
|
||||||
|
|
||||||
.pl_head span {
|
.pl_head span {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
vertical-align: top;
|
vertical-align: middle;
|
||||||
padding-top: 0.5em;
|
padding-top: 0.2em;
|
||||||
|
padding-bottom: 0.2em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,49 +67,64 @@
|
||||||
.pl_row span {
|
.pl_row span {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
padding: 0.2em 0;
|
padding-top: 0.2em;
|
||||||
|
padding-bottom: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl_input{
|
.pl_input{
|
||||||
width: 5%;
|
width: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl_title{
|
.pl_title{
|
||||||
width: 21%;
|
width: 160px;
|
||||||
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl_artist{
|
.pl_artist{
|
||||||
width: 20%;
|
width: 140px;
|
||||||
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl_length{
|
.pl_length{
|
||||||
width: 11%;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl_cue_in{
|
.pl_cue_in{
|
||||||
width: 11%;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl_cue_out{
|
.pl_cue_out{
|
||||||
width: 11%;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl_playlength{
|
.pl_playlength{
|
||||||
width: 11%;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl_fade_in{
|
.pl_fade_in{
|
||||||
padding: 0.2em 2em;
|
padding: 0.2em 2em;
|
||||||
border-top: thin ridge black;
|
border-top: thin solid #999999;
|
||||||
background-color: #cccccc;
|
background-color: #cccccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pl_fade_in span{
|
||||||
|
display: inline-block;
|
||||||
|
width: 60px;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.pl_fade_out{
|
.pl_fade_out{
|
||||||
padding-left: 2em;
|
padding-left: 2em;
|
||||||
background-color: #cccccc;
|
background-color: #cccccc;
|
||||||
padding: 0.2em 2em;
|
padding: 0.2em 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pl_fade_out span{
|
||||||
|
display: inline-block;
|
||||||
|
width: 60px;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.pl_time{
|
.pl_time{
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,18 +48,27 @@ $(document).ready(function() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
function removeTextInput(){
|
function removeCueInput(){
|
||||||
var span = $(this).parent();
|
var span = $(this).parent();
|
||||||
var pos = span.parent().attr('id').split("_").pop();
|
var pos = span.parent().attr('id').split("_").pop();
|
||||||
|
|
||||||
var cueIn, cueOut;
|
var cueIn, cueOut;
|
||||||
|
|
||||||
var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,4})?$");
|
var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$");
|
||||||
var oldValue = $("#pl_tmp_time").val();
|
var oldValue = $("#pl_tmp_time").val();
|
||||||
var newValue = $(this).val().trim();
|
var newValue = $(this).val().trim();
|
||||||
|
|
||||||
|
if(span.hasClass('pl_cue_in')){
|
||||||
|
if(newValue === "")
|
||||||
|
newValue = '00:00:00';
|
||||||
|
cueIn = newValue;
|
||||||
|
}
|
||||||
|
else if(span.hasClass('pl_cue_out')){
|
||||||
|
cueOut = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
//test that input is a time.
|
//test that input is a time.
|
||||||
if (!regExpr.test(newValue)) {
|
if (newValue!=="" && !regExpr.test(newValue)) {
|
||||||
span.empty();
|
span.empty();
|
||||||
span.append(oldValue);
|
span.append(oldValue);
|
||||||
span.click(addTextInput);
|
span.click(addTextInput);
|
||||||
|
@ -67,13 +76,6 @@ $(document).ready(function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(span.hasClass('pl_cue_in')){
|
|
||||||
cueIn = $(this).val();
|
|
||||||
}
|
|
||||||
else if(span.hasClass('pl_cue_out')){
|
|
||||||
cueOut = $(this).val();
|
|
||||||
}
|
|
||||||
|
|
||||||
$.post("ui_handler.php",
|
$.post("ui_handler.php",
|
||||||
|
|
||||||
{ 'act': 'PL.setClipLength', 'pos': pos, 'cueIn': cueIn, 'cueOut': cueOut },
|
{ 'act': 'PL.setClipLength', 'pos': pos, 'cueIn': cueIn, 'cueOut': cueOut },
|
||||||
|
@ -92,24 +94,99 @@ $(document).ready(function() {
|
||||||
span.click(addTextInput);
|
span.click(addTextInput);
|
||||||
alert(data.error);
|
alert(data.error);
|
||||||
}
|
}
|
||||||
else if(data.type==="cue"){
|
span = li.find(".pl_playlength");
|
||||||
span = li.find(".pl_playlength");
|
span.empty();
|
||||||
span.empty();
|
span.append(data.cliplength);
|
||||||
span.append(data.cliplength);
|
|
||||||
|
span = $(".pl_duration");
|
||||||
|
span.empty();
|
||||||
|
span.append(data.length);
|
||||||
|
|
||||||
|
if(data.cueIn){
|
||||||
|
span = li.find(".pl_cue_in");
|
||||||
|
span.empty();
|
||||||
|
span.append(data.cueIn);
|
||||||
|
span.click(addTextInput);
|
||||||
|
}
|
||||||
|
if(data.cueOut){
|
||||||
|
span = li.find(".pl_cue_out");
|
||||||
|
span.empty();
|
||||||
|
span.append(data.cueOut);
|
||||||
|
span.click(addTextInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
span = li.find(".pl_fade_in").find(".pl_time");
|
||||||
|
span.empty();
|
||||||
|
span.append(data.fadeIn);
|
||||||
|
|
||||||
|
span = li.find(".pl_fade_out").find(".pl_time");
|
||||||
|
span.empty();
|
||||||
|
span.append(data.fadeOut);
|
||||||
|
},
|
||||||
|
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeFadeInput(){
|
||||||
|
var span = $(this).parent();
|
||||||
|
var pos = span.parent().parent().attr('id').split("_").pop();
|
||||||
|
|
||||||
|
var fadeIn, fadeOut;
|
||||||
|
|
||||||
|
var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$");
|
||||||
|
var oldValue = $("#pl_tmp_time").val();
|
||||||
|
var newValue = $(this).val().trim();
|
||||||
|
|
||||||
|
if(newValue === "")
|
||||||
|
newValue = '00:00:00';
|
||||||
|
|
||||||
|
if(span.parent().hasClass('pl_fade_in')){
|
||||||
|
fadeIn = newValue;
|
||||||
|
}
|
||||||
|
else if(span.parent().hasClass('pl_fade_out')){
|
||||||
|
fadeOut = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//test that input is a time.
|
||||||
|
if (!regExpr.test(newValue)) {
|
||||||
|
span.empty();
|
||||||
|
span.append(oldValue);
|
||||||
|
span.click(addTextInput);
|
||||||
|
alert("please put in a time '00:00:00 (.0000)'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.post("ui_handler.php",
|
||||||
|
|
||||||
|
{ 'act': 'PL.setFadeLength', 'pos': pos, 'fadeIn': fadeIn, 'fadeOut': fadeOut },
|
||||||
|
|
||||||
|
function(data){
|
||||||
|
var li, span;
|
||||||
|
|
||||||
|
li = $("#pl_"+pos);
|
||||||
|
if(data.error){
|
||||||
|
var hidden = $("#pl_tmp_time");
|
||||||
|
var time = hidden.val();
|
||||||
|
|
||||||
if(data.cueIn){
|
span = hidden.parent();
|
||||||
span = li.find(".pl_cue_in");
|
span.empty();
|
||||||
span.empty();
|
span.append(time);
|
||||||
span.append(data.cueIn);
|
span.click(addTextInput);
|
||||||
span.click(addTextInput);
|
alert(data.error);
|
||||||
}
|
|
||||||
if(data.cueOut){
|
|
||||||
span = li.find(".pl_cue_out");
|
|
||||||
span.empty();
|
|
||||||
span.append(data.cueOut);
|
|
||||||
span.click(addTextInput);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if(data.fadeIn){
|
||||||
|
span = li.find(".pl_fade_in").find(".pl_time");
|
||||||
|
span.empty();
|
||||||
|
span.append(data.fadeIn);
|
||||||
|
span.click(addTextInput);
|
||||||
|
}
|
||||||
|
if(data.fadeOut){
|
||||||
|
span = li.find(".pl_fade_out").find(".pl_time");
|
||||||
|
span.empty();
|
||||||
|
span.append(data.fadeOut);
|
||||||
|
span.click(addTextInput);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"json"
|
"json"
|
||||||
|
@ -118,7 +195,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
function addTextInput(){
|
function addTextInput(){
|
||||||
var time = $(this).text().trim();
|
var time = $(this).text().trim();
|
||||||
var input = $("<input type='text' value="+time+" size='10' maxlength='13'/>");
|
var input = $("<input type='text' value="+time+" size='10' maxlength='15'/>");
|
||||||
|
|
||||||
//Firefox seems to have problems losing focus otherwise, Chrome is fine.
|
//Firefox seems to have problems losing focus otherwise, Chrome is fine.
|
||||||
$(":input").blur();
|
$(":input").blur();
|
||||||
|
@ -126,7 +203,14 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$(this).append(input);
|
$(this).append(input);
|
||||||
input.focus();
|
input.focus();
|
||||||
input.blur(removeTextInput);
|
|
||||||
|
if($(this).hasClass('pl_cue_in') || $(this).hasClass('pl_cue_out')) {
|
||||||
|
input.blur(removeCueInput);
|
||||||
|
}
|
||||||
|
else if($(this).parent().hasClass('pl_fade_in') || $(this).parent().hasClass('pl_fade_out')){
|
||||||
|
input.blur(removeFadeInput);
|
||||||
|
}
|
||||||
|
|
||||||
input.keypress(function(ev){
|
input.keypress(function(ev){
|
||||||
//don't want enter to submit.
|
//don't want enter to submit.
|
||||||
if (ev.keyCode == '13') {
|
if (ev.keyCode == '13') {
|
||||||
|
|
|
@ -325,6 +325,10 @@ switch ($_REQUEST['act']) {
|
||||||
case "PL.setClipLength":
|
case "PL.setClipLength":
|
||||||
$uiHandler->PLAYLIST->setClipLength($_REQUEST['pos'], $_REQUEST['cueIn'], $_REQUEST['cueOut']);
|
$uiHandler->PLAYLIST->setClipLength($_REQUEST['pos'], $_REQUEST['cueIn'], $_REQUEST['cueOut']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "PL.setFadeLength":
|
||||||
|
$uiHandler->PLAYLIST->setFadeLength($_REQUEST['pos'], $_REQUEST['fadeIn'], $_REQUEST['fadeOut']);
|
||||||
|
break;
|
||||||
|
|
||||||
case "PL.removeItem":
|
case "PL.removeItem":
|
||||||
$uiHandler->PLAYLIST->removeItem($_REQUEST['id']);
|
$uiHandler->PLAYLIST->removeItem($_REQUEST['id']);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="pl_container" >
|
<div class="pl_container" >
|
||||||
<div class="pl_header">
|
<div class="pl_header">
|
||||||
<div class="pl_header_left"><span>##Playlist Editor## </span></div>
|
<div class="pl_header_left"><span>##Playlist Editor## </span></div>
|
||||||
<div class="pl_header_right"><span>{$PL->title}</span><span>{niceTime in=$PL->duration} </span></div>
|
<div class="pl_header_right"><span>{$PL->title}</span><span class="pl_duration">{$PL->duration} </span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pl_contents">
|
<div class="pl_contents">
|
||||||
<form name="PL">
|
<form name="PL">
|
||||||
|
@ -19,29 +19,29 @@
|
||||||
<ul id="pl_sortable">
|
<ul id="pl_sortable">
|
||||||
{foreach from=$PL->getActiveArr($PL->activeId) key='pos' item='i'}
|
{foreach from=$PL->getActiveArr($PL->activeId) key='pos' item='i'}
|
||||||
<li class="pl_row" id="pl_{$pos}">
|
<li class="pl_row" id="pl_{$pos}">
|
||||||
<div class="pl_fade_in">fade in: {$i.fadein}</div>
|
<div class="pl_fade_in"><span>Fade in: </span><span class="pl_time">{$i.fadein}</span></div>
|
||||||
<span class="pl_input">
|
<span class="pl_input">
|
||||||
<input type="checkbox" class="checkbox" name="{$pos}"/>
|
<input type="checkbox" class="checkbox" name="{$pos}"/>
|
||||||
</span>
|
</span>
|
||||||
<span class="pl_title">
|
<span class="pl_title">
|
||||||
{$i.track_title}
|
{$i.track_title}
|
||||||
</span>
|
</span>
|
||||||
<span class="pl_artist">
|
<span class="pl_artist">
|
||||||
{$i.artist_name}
|
{$i.artist_name}
|
||||||
</span>
|
</span>
|
||||||
<span class="pl_length" >
|
<span class="pl_length" >
|
||||||
{$i.length}
|
{$i.length}
|
||||||
</span>
|
</span>
|
||||||
<span class="pl_cue_in pl_time">
|
<span class="pl_cue_in pl_time">
|
||||||
{$i.cuein}
|
{$i.cuein}
|
||||||
</span>
|
</span>
|
||||||
<span class="pl_cue_out pl_time">
|
<span class="pl_cue_out pl_time">
|
||||||
{$i.cueout}
|
{$i.cueout}
|
||||||
</span>
|
</span>
|
||||||
<span class="pl_playlength">
|
<span class="pl_playlength">
|
||||||
{$i.cliplength}
|
{$i.cliplength}
|
||||||
</span>
|
</span>
|
||||||
<div class="pl_fade_out">fade out: {$i.fadeout}</div>
|
<div class="pl_fade_out"><span>Fade out: </span><span class="pl_time">{$i.fadeout}</span></div>
|
||||||
</li>
|
</li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{if is_null($pos)}
|
{if is_null($pos)}
|
||||||
|
|
|
@ -302,74 +302,6 @@ class uiPlaylist
|
||||||
return $plid;
|
return $plid;
|
||||||
} // fn create
|
} // fn create
|
||||||
|
|
||||||
public function changeTransition($id, $type, $duration)
|
|
||||||
{
|
|
||||||
$pause = $pause;
|
|
||||||
$xfade = Playlist::secondsToPlaylistTime($duration/1000);
|
|
||||||
|
|
||||||
if ($id) {
|
|
||||||
// just change fade between 2 clips
|
|
||||||
$curr = $this->getCurrElement($id);
|
|
||||||
$prev = $this->getPrevElement($id);
|
|
||||||
$next = $this->getNextElement($id);
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case "fadeX":
|
|
||||||
$item[$prev['attrs']['id']] =
|
|
||||||
array(UI_PL_ELEM_FADEIN => Playlist::secondsToPlaylistTime($prev[UI_PL_ELEM_FADEIN]),
|
|
||||||
UI_PL_ELEM_FADEOUT => $xfade
|
|
||||||
);
|
|
||||||
$item[$id] = array(UI_PL_ELEM_FADEIN => $xfade,
|
|
||||||
UI_PL_ELEM_FADEOUT => Playlist::secondsToPlaylistTime($curr[UI_PL_ELEM_FADEOUT])
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "pause":
|
|
||||||
$item[$prev['attrs']['id']] =
|
|
||||||
array(UI_PL_ELEM_FADEIN => Playlist::secondsToPlaylistTime($prev[UI_PL_ELEM_FADEIN]),
|
|
||||||
UI_PL_ELEM_FADEOUT => $pause
|
|
||||||
);
|
|
||||||
$item[$id] = array(UI_PL_ELEM_FADEIN => $pause,
|
|
||||||
UI_PL_ELEM_FADEOUT => Playlist::secondsToPlaylistTime($curr[UI_PL_ELEM_FADEOUT])
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "fadeIn":
|
|
||||||
$item[$id] = array(UI_PL_ELEM_FADEIN => $xfade,
|
|
||||||
UI_PL_ELEM_FADEOUT => Playlist::secondsToPlaylistTime($curr[UI_PL_ELEM_FADEOUT])
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "fadeOut":
|
|
||||||
$item[$id] = array(UI_PL_ELEM_FADEIN => Playlist::secondsToPlaylistTime($curr[UI_PL_ELEM_FADEIN]),
|
|
||||||
UI_PL_ELEM_FADEOUT => $xfade
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
foreach ($item as $i=>$val) {
|
|
||||||
$r = $this->Base->gb->changeFadeInfo($this->token, $i, $val[UI_PL_ELEM_FADEIN], $val[UI_PL_ELEM_FADEOUT], $this->Base->sessid);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
if (UI_VERBOSE === TRUE) {
|
|
||||||
print_r($r);
|
|
||||||
}
|
|
||||||
$this->Base->_retMsg('Changing fade information failed.');
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// change fade of all clips
|
|
||||||
foreach ($this->getFlat($this->activeId) as $v) {
|
|
||||||
$r = $this->Base->gb->changeFadeInfo($this->token, $v['attrs']['id'], $type==='pause'?$pause:$xfade, $type==='pause'?$pause:$xfade, $this->Base->sessid);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
if (UI_VERBOSE === TRUE) {
|
|
||||||
print_r($r);
|
|
||||||
}
|
|
||||||
$this->Base->_retMsg('Changing fade information failed.');
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
} // fn changeTransition
|
|
||||||
|
|
||||||
|
|
||||||
public function moveItem($oldPos, $newPos)
|
public function moveItem($oldPos, $newPos)
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
|
@ -388,30 +320,27 @@ class uiPlaylist
|
||||||
} // fn moveItem
|
} // fn moveItem
|
||||||
|
|
||||||
|
|
||||||
public function changeTransitionForm($id, $type, $mask)
|
public function setClipLength($pos, $cueIn, $cueOut)
|
||||||
{
|
|
||||||
|
|
||||||
} // fn changeTransitionForm
|
|
||||||
|
|
||||||
|
|
||||||
public function changeAllTransitionsForm($mask)
|
|
||||||
{
|
|
||||||
|
|
||||||
} // fn changeAllTransitionsForm
|
|
||||||
|
|
||||||
|
|
||||||
function setClipLength($pos, $cueIn, $cueOut)
|
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
$response["type"] = "cue";
|
|
||||||
$response["pos"] = $pos;
|
|
||||||
|
|
||||||
$res = $this->Base->gb->changeClipLength($this->activeId, $pos, $cueIn, $cueOut);
|
$res = $this->Base->gb->changeClipLength($this->activeId, $pos, $cueIn, $cueOut);
|
||||||
|
|
||||||
$response = array_merge($response, $res);
|
$response = $res;
|
||||||
|
|
||||||
die(json_encode($response));
|
die(json_encode($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setFadeLength($pos, $fadeIn, $fadeOut)
|
||||||
|
{
|
||||||
|
$response = array();
|
||||||
|
|
||||||
|
$res = $this->Base->gb->changeFadeInfo($this->activeId, $pos, $fadeIn, $fadeOut);
|
||||||
|
|
||||||
|
$response = $res;
|
||||||
|
|
||||||
|
die(json_encode($response));
|
||||||
|
} // fn setFade
|
||||||
|
|
||||||
|
|
||||||
public function metaDataForm($langid)
|
public function metaDataForm($langid)
|
||||||
|
|
|
@ -608,16 +608,59 @@ class Playlist {
|
||||||
public function changeFadeInfo($pos, $fadeIn, $fadeOut)
|
public function changeFadeInfo($pos, $fadeIn, $fadeOut)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$errArray= array();
|
||||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable']. " SET fadein='{$fadeIn}', fadeout='{$fadeOut}' " .
|
|
||||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
if(is_null($pos) || $pos < 0 || $pos >= $this->getNextPos()) {
|
||||||
|
$errArray["error"]="Invalid position.";
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = $sql = "SELECT cliplength
|
||||||
|
FROM cc_playlistcontents WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
|
$clipLength = $CC_DBC->getOne($sql);
|
||||||
|
|
||||||
|
if(!is_null($fadeIn) && !is_null($fadeOut)) {
|
||||||
|
|
||||||
|
if(Playlist::playlistTimeToSeconds($fadeIn) > Playlist::playlistTimeToSeconds($clipLength)) {
|
||||||
|
$errArray["error"]="Fade In can't be larger than overall playlength.";
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
if(Playlist::playlistTimeToSeconds($fadeOut) > Playlist::playlistTimeToSeconds($clipLength)) {
|
||||||
|
$errArray["error"]="Fade Out can't be larger than overall playlength.";
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable']. " SET fadein='{$fadeIn}', fadeout='{$fadeOut}' " .
|
||||||
|
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
|
}
|
||||||
|
else if(!is_null($fadeIn)) {
|
||||||
|
|
||||||
|
if(Playlist::playlistTimeToSeconds($fadeIn) > Playlist::playlistTimeToSeconds($clipLength)) {
|
||||||
|
$errArray["error"]="Fade In can't be larger than overall playlength.";
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable']. " SET fadein='{$fadeIn}' " .
|
||||||
|
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
|
}
|
||||||
|
else if(!is_null($fadeOut)){
|
||||||
|
|
||||||
|
if(Playlist::playlistTimeToSeconds($fadeOut) > Playlist::playlistTimeToSeconds($clipLength)) {
|
||||||
|
$errArray["error"]="Fade Out can't be larger than overall playlength.";
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable']. " SET fadeout='{$fadeOut}' " .
|
||||||
|
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
|
}
|
||||||
|
|
||||||
$res = $CC_DBC->query($sql);
|
$res = $CC_DBC->query($sql);
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
return $res;
|
$errArray["error"] =$res->getMessage();
|
||||||
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -634,36 +677,40 @@ class Playlist {
|
||||||
public function changeClipLength($pos, $cueIn, $cueOut)
|
public function changeClipLength($pos, $cueIn, $cueOut)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$oldCueIn;
|
|
||||||
$oldCueOut;
|
|
||||||
$errArray= array();
|
$errArray= array();
|
||||||
|
|
||||||
if(is_null($pos) || is_null($cueIn) && is_null($cueOut))
|
if(is_null($cueIn) && is_null($cueOut)) {
|
||||||
return FALSE;
|
$errArray["error"]="Cue in and cue out are null.";
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
|
||||||
if($pos < 0 || $pos >= $this->getNextPos())
|
if(is_null($pos) || $pos < 0 || $pos >= $this->getNextPos()) {
|
||||||
return FALSE;
|
$errArray["error"]="Invalid position.";
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = $sql = "SELECT length AS original_length
|
$sql = $sql = "SELECT length AS original_length, cuein, cueout, fadein, fadeout
|
||||||
FROM cc_playlistcontents C JOIN cc_files F ON C.file_id = F.id
|
FROM cc_playlistcontents C JOIN cc_files F ON C.file_id = F.id
|
||||||
WHERE C.playlist_id='{$this->getId()}' AND position='{$pos}'";
|
WHERE C.playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
$origLength = $CC_DBC->getOne($sql);
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT cuein, cueout FROM ".$CC_CONFIG['playListContentsTable']."
|
|
||||||
WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
|
||||||
$res = $CC_DBC->getRow($sql);
|
$res = $CC_DBC->getRow($sql);
|
||||||
|
|
||||||
|
$origLength = $res['original_length'];
|
||||||
$oldCueIn = $res['cuein'];
|
$oldCueIn = $res['cuein'];
|
||||||
$oldCueOut = $res['cueout'];
|
$oldCueOut = $res['cueout'];
|
||||||
|
$fadeIn = $res['fadein'];
|
||||||
|
$fadeOut = $res['fadeout'];
|
||||||
|
|
||||||
if(!is_null($cueIn) && !is_null($cueOut)){
|
if(!is_null($cueIn) && !is_null($cueOut)){
|
||||||
if($cueIn > $cueOut) {
|
|
||||||
$errArray["error"]="Can't set cue in to be larger than cue out.";
|
if($cueOut === ""){
|
||||||
|
$cueOut = $origLength;
|
||||||
|
}
|
||||||
|
if(Playlist::playlistTimeToSeconds($cueIn) > Playlist::playlistTimeToSeconds($cueOut)) {
|
||||||
|
$errArray["error"]= "Can't set cue in to be larger than cue out.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
if($cueOut > $origLength){
|
if(Playlist::playlistTimeToSeconds($cueOut) > Playlist::playlistTimeToSeconds($origLength)){
|
||||||
$errArray["error"] ="Can't set cue out to be greater than file length.";
|
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,13 +719,13 @@ class Playlist {
|
||||||
|
|
||||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||||
" SET cuein='{$cueIn}', cueout='{$cueOut}', ".
|
" SET cuein='{$cueIn}', cueout='{$cueOut}', ".
|
||||||
"cliplength=(cliplength + interval '{$oldCueIn}' - interval '{$cueIn}' - interval '{$oldCueOut}' + interval '{$cueOut}') " .
|
"cliplength=(interval '{$cueOut}' - interval '{$cueIn}') " .
|
||||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!is_null($cueIn)) {
|
else if(!is_null($cueIn)) {
|
||||||
|
|
||||||
if($cueIn > $oldCueOut) {
|
if(Playlist::playlistTimeToSeconds($cueIn) > Playlist::playlistTimeToSeconds($oldCueOut)) {
|
||||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
@ -686,17 +733,21 @@ class Playlist {
|
||||||
$cueIn = pg_escape_string($cueIn);
|
$cueIn = pg_escape_string($cueIn);
|
||||||
|
|
||||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||||
" SET cuein='{$cueIn}', cliplength=(cliplength + interval '{$oldCueIn}' - interval '{$cueIn}') " .
|
" SET cuein='{$cueIn}', cliplength=(interval '{$oldCueOut}' - interval '{$cueIn}') " .
|
||||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
}
|
}
|
||||||
else if(!is_null($cueOut)) {
|
else if(!is_null($cueOut)) {
|
||||||
|
|
||||||
if($cueOut < $oldCueIn) {
|
if($cueOut === ""){
|
||||||
|
$cueOut = $origLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Playlist::playlistTimeToSeconds($cueOut) < Playlist::playlistTimeToSeconds($oldCueIn)) {
|
||||||
$errArray["error"] ="Can't set cue out to be smaller than cue in.";
|
$errArray["error"] ="Can't set cue out to be smaller than cue in.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($cueOut > $origLength){
|
if(Playlist::playlistTimeToSeconds($cueOut) > Playlist::playlistTimeToSeconds($origLength)){
|
||||||
$errArray["error"] ="Can't set cue out to be greater than file length.";
|
$errArray["error"] ="Can't set cue out to be greater than file length.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
@ -704,7 +755,7 @@ class Playlist {
|
||||||
$cueOut = pg_escape_string($cueOut);
|
$cueOut = pg_escape_string($cueOut);
|
||||||
|
|
||||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||||
" SET cueout='{$cueOut}', cliplength=(cliplength - interval '{$oldCueOut}' + interval '{$cueOut}') " .
|
" SET cueout='{$cueOut}', cliplength=(interval '{$cueOut}' - interval '{$oldCueIn}') " .
|
||||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,8 +768,36 @@ class Playlist {
|
||||||
$sql = "SELECT cliplength FROM ".$CC_CONFIG['playListContentsTable']."
|
$sql = "SELECT cliplength FROM ".$CC_CONFIG['playListContentsTable']."
|
||||||
WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
$cliplength = $CC_DBC->getOne($sql);
|
$cliplength = $CC_DBC->getOne($sql);
|
||||||
|
|
||||||
|
if(Playlist::playlistTimeToSeconds($fadeIn) > Playlist::playlistTimeToSeconds($cliplength)){
|
||||||
|
$fadeIn = $cliplength;
|
||||||
|
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||||
|
" SET fadein='{$fadeIn}' " .
|
||||||
|
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
|
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
$errArray["error"] =$res->getMessage();
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Playlist::playlistTimeToSeconds($fadeOut) > Playlist::playlistTimeToSeconds($cliplength)){
|
||||||
|
$fadeOut = $cliplength;
|
||||||
|
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||||
|
" SET fadeout='{$fadeOut}' " .
|
||||||
|
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||||
|
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
$errArray["error"] =$res->getMessage();
|
||||||
|
return $errArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return array("cliplength"=>$cliplength, "cueIn"=>$cueIn, "cueOut"=>$cueOut);
|
return array("cliplength"=>$cliplength, "cueIn"=>$cueIn, "cueOut"=>$cueOut, "length"=>$this->getLength(),
|
||||||
|
"fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue