CC-2065: Fade times longer than Airtime supports can be set in Playlist Builder and Preferences
- Updated the logic in the fade in/out loggic so the Time format 00:00:00 appears as the more practical seconds format 00. - I also updated the error message so it includes the time unit seconds in the message.
This commit is contained in:
parent
de7bbbb479
commit
03329ad2cf
|
@ -11,7 +11,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
|
||||
$defaultFade = Application_Model_Preference::GetDefaultFade();
|
||||
if($defaultFade == ""){
|
||||
$defaultFade = '00:00:00.500000';
|
||||
$defaultFade = '00.500000';
|
||||
}
|
||||
|
||||
//Station name
|
||||
|
@ -33,8 +33,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(array('regex', false,
|
||||
array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\.\d{1,6})?$/',
|
||||
'messages' => 'enter a time 00:00:00{.000000}'))),
|
||||
array('/^[0-5][0-9](\.\d{1,6})?$/',
|
||||
'messages' => 'enter a time in seconds 00{.000000}'))),
|
||||
'value' => $defaultFade,
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
|
|
@ -409,12 +409,39 @@ class Application_Model_Playlist {
|
|||
$files[$i]['cliplength'] = Application_Model_Playlist::secondsToPlaylistTime($clipSec);
|
||||
$offset += $clipSec;
|
||||
$files[$i]['offset'] = Application_Model_Playlist::secondsToPlaylistTime($offset);
|
||||
|
||||
#For issue CC-2065 - update fade in and out values between playlst elements
|
||||
#modified from the db default format of 00:00:00 to the more practical
|
||||
#00.000000 format which is for only seconds.
|
||||
$files[$i]['fadein'] = $this->normalizeFade($files[$i]['fadein']);
|
||||
$files[$i]['fadeout'] = $this->normalizeFade($files[$i]['fadeout']);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* The database stores fades in 00:00:00 Time format with optional millisecond resolution .000000
|
||||
* but this isn't practical since fades shouldn't be very long usuall 1 second or less. This function
|
||||
* will normalize the fade so that it looks like 00.000000 to the user.
|
||||
**/
|
||||
public function normalizeFade($fade) {
|
||||
//First get rid of the first six characters 00:00: which will be added back later for db update
|
||||
$fade = substr($fade, 6);
|
||||
|
||||
//Second add .000000 if the fade does't have milliseconds format already
|
||||
$dbFadeStrPos = strpos( $fade, '.' );
|
||||
if ( $dbFadeStrPos === False )
|
||||
$fade .= '.000000';
|
||||
else
|
||||
while( strlen( $fade ) < 8 )
|
||||
$fade .= '0';
|
||||
//done, just need to set back the formated values
|
||||
return $fade;
|
||||
}
|
||||
|
||||
public function getLength() {
|
||||
$res = CcPlaylistQuery::create()
|
||||
->findPK($this->id)
|
||||
|
@ -496,9 +523,9 @@ class Application_Model_Playlist {
|
|||
* @param string $p_position
|
||||
* optional, Which position in the playlist to insert the audio clip
|
||||
* @param string $p_fadeIn
|
||||
* optional, in time format hh:mm:ss.ssssss - total duration
|
||||
* optional, in time format ss.ssssss - total duration
|
||||
* @param string $p_fadeOut
|
||||
* optional, in time format hh:mm:ss.ssssss - total duration
|
||||
* optional, in time format ss.ssssss - total duration
|
||||
* @param string $p_clipLength
|
||||
* optional length in in time format hh:mm:ss.ssssss -
|
||||
* for webstream (or for overrule length of audioclip)
|
||||
|
@ -612,7 +639,13 @@ class Application_Model_Playlist {
|
|||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
|
||||
return array($fadeIn, $fadeOut);
|
||||
#For issue CC-2065, fade in and out values are for the Playlist itself and must be
|
||||
#modified from the db default format of 00:00:00 to the more practical
|
||||
#00.000000 format which is for only seconds.
|
||||
$fadeIn = $this->normalizeFade($fadeIn);
|
||||
$fadeOut = $this->normalizeFade($fadeOut);
|
||||
|
||||
return array($fadeIn, $fadeOut);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -628,6 +661,10 @@ class Application_Model_Playlist {
|
|||
*/
|
||||
public function changeFadeInfo($pos, $fadeIn, $fadeOut)
|
||||
{
|
||||
#See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema
|
||||
$fadeIn = '00:00:'.$fadeIn;
|
||||
$fadeOut = '00:00:'.$fadeOut;
|
||||
|
||||
$errArray= array();
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
|
@ -651,7 +688,6 @@ class Application_Model_Playlist {
|
|||
//"Fade In can't be larger than overall playlength.";
|
||||
$fadeIn = $clipLength;
|
||||
}
|
||||
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
if(!is_null($fadeOut)){
|
||||
|
@ -662,7 +698,6 @@ class Application_Model_Playlist {
|
|||
//Fade Out can't be larger than overall playlength.";
|
||||
$fadeOut = $clipLength;
|
||||
}
|
||||
|
||||
$row->setDbFadeout($fadeOut);
|
||||
}
|
||||
|
||||
|
@ -987,13 +1022,13 @@ class Application_Model_Playlist {
|
|||
if($defaultFade != "")
|
||||
$fadeIn = $defaultFade;
|
||||
else
|
||||
$fadeIn = '00:00:00.000';
|
||||
$fadeIn = '00.000000';
|
||||
}
|
||||
if(is_null($fadeOut)) {
|
||||
if($defaultFade != "")
|
||||
$fadeOut = $defaultFade;
|
||||
else
|
||||
$fadeOut = '00:00:00.000';
|
||||
$fadeOut = '00.000000';
|
||||
}
|
||||
|
||||
$row = new CcPlaylistcontents();
|
||||
|
@ -1004,6 +1039,7 @@ class Application_Model_Playlist {
|
|||
|
||||
$row->setDbCliplength($clipLength);
|
||||
$row->setDbCuein($cuein);
|
||||
|
||||
$row->setDbCueout($cueout);
|
||||
$row->setDbFadein($fadeIn);
|
||||
$row->setDbFadeout($fadeOut);
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
<span class="ui-icon ui-icon-closethick"></span>
|
||||
<dl id="spl_editor-main" class="inline-list">
|
||||
<dt>Fade in:</dt>
|
||||
<dd id="spl_fade_in_main"><span contenteditable="true" class="spl_text_input">00:00:00</span></dd>
|
||||
<dd id="spl_fade_in_main"><span contenteditable="true" class="spl_text_input">00</span></dd>
|
||||
<dd class="edit-error"></dd>
|
||||
<dt>Fade out:</dt>
|
||||
<dd id="spl_fade_out_main"><span contenteditable="true" class="spl_text_input">00:00:00</span></dd>
|
||||
<dd id="spl_fade_out_main"><span contenteditable="true" class="spl_text_input">00/span></dd>
|
||||
<dd class="edit-error"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
|
|
@ -109,7 +109,7 @@ function changeFadeIn(event) {
|
|||
unqid = li.attr("unqid");
|
||||
|
||||
if(!isTimeValid(fadeIn)){
|
||||
showError(span, "please put in a time '00:00:00 (.000000)'");
|
||||
showError(span, "please put in a time in seconds '00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ function changeFadeOut(event) {
|
|||
unqid = li.attr("unqid");
|
||||
|
||||
if(!isTimeValid(fadeOut)){
|
||||
showError(span, "please put in a time '00:00:00 (.000000)'");
|
||||
showError(span, "please put in a time in seconds '00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ function setUpSPL() {
|
|||
fadeIn = $.trim(span.text());
|
||||
|
||||
if(!isTimeValid(fadeIn)){
|
||||
showError(span, "please put in a time '00:00:00 (.000000)'");
|
||||
showError(span, "please put in a time in seconds '00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ function setUpSPL() {
|
|||
fadeOut = $.trim(span.text());
|
||||
|
||||
if(!isTimeValid(fadeOut)){
|
||||
showError(span, "please put in a time '00:00:00 (.000000)'");
|
||||
showError(span, "please put in a time in seconds '00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue