Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
denise 2013-01-10 14:58:02 -05:00
commit 954b65fa41
6 changed files with 51 additions and 22 deletions

View File

@ -255,6 +255,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
Application_Model_Preference::SetEnableReplayGain($values["enableReplayGain"]);
Application_Model_Preference::setReplayGainModifier($values["replayGainModifier"]);
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {

View File

@ -65,6 +65,12 @@ class Application_Form_StreamSetting extends Zend_Form
->setDecorators(array('ViewHelper'));
$this->addElement($offAirMeta);
$enable_replay_gain = new Zend_Form_Element_Checkbox("enableReplayGain");
$enable_replay_gain->setLabel(_("Enable Replay Gain"))
->setValue(Application_Model_Preference::GetEnableReplayGain())
->setDecorators(array('ViewHelper'));
$this->addElement($enable_replay_gain);
$replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
$replay_gain->setLabel(_("Replay Gain Modifier"))
->setValue(Application_Model_Preference::getReplayGainModifier())

View File

@ -1253,6 +1253,14 @@ class Application_Model_Preference
return ($data != "") ? unserialize($data) : null;
}
public static function SetEnableReplayGain($value) {
self::setValue("enable_replay_gain", $value, false);
}
public static function GetEnableReplayGain() {
return self::getValue("enable_replay_gain", false);
}
public static function getReplayGainModifier(){
$rg_modifier = self::getValue("replay_gain_modifier");

View File

@ -679,8 +679,13 @@ SQL;
$same_hour = $start_hour == $end_hour;
$independent_event = !$same_hour;
$replay_gain = is_null($item["replay_gain"]) ? "0": $item["replay_gain"];
$replay_gain += Application_Model_Preference::getReplayGainModifier();
if ( !Application_Model_Preference::GetEnableReplayGain() ) {
$replay_gain = 0;
}
$schedule_item = array(
'id' => $media_id,
@ -695,7 +700,7 @@ SQL;
'end' => $end,
'show_name' => $item["show_name"],
'replay_gain' => $replay_gain,
'independent_event' => $independent_event,
'independent_event' => $independent_event,
);
self::appendScheduleItem($data, $start, $schedule_item);
}
@ -839,8 +844,8 @@ SQL;
/* Check if two events are less than or equal to 1 second apart
*/
public static function areEventsLinked($event1, $event2) {
$dt1 = DateTime::createFromFormat("Y-m-d-H-i-s", $event1['start']);
$dt2 = DateTime::createFromFormat("Y-m-d-H-i-s", $event2['start']);
$dt1 = DateTime::createFromFormat("Y-m-d-H-i-s", $event1['start']);
$dt2 = DateTime::createFromFormat("Y-m-d-H-i-s", $event2['start']);
$seconds = $dt2->getTimestamp() - $dt1->getTimestamp();
return $seconds <= 1;
@ -860,7 +865,7 @@ SQL;
*
* There's a special case here is well. When the back-to-back streams are the same, we
* can collapse the instructions 1,2,(3,4,1,2),3,4 to 1,2,3,4. We basically cut out the
* middle part. This function handles this.
* middle part. This function handles this.
*/
private static function foldData(&$data)
{

View File

@ -71,25 +71,33 @@
<dd id="offAirMeta-element">
<?php echo $this->form->getElement('offAirMeta') ?>
</dd>
<dt id="enableReplayGain-label">
<label>
<?php echo $this->form->getElement('enableReplayGain')->getLabel() ?> :
</label>
</dt>
<dd id="enableReplayGain-element">
<?php echo $this->form->getElement('enableReplayGain') ?>
</dd>
<dt id="replayGainModifier-label" class="block-display">
<label><?php echo $this->form->getElement('replayGainModifier')->getLabel() ?>:
</label>
<span id="rg_modifier_value" style="border: 0; color: #f6931f; font-weight: bold;">
<?php echo $this->form->getElement('replayGainModifier')->getValue() ?>
</span>
dB
</dt>
<dd id="replayGainModifier-element" class="block-display">
<?php echo $this->form->getElement('replayGainModifier') ?>
<?php if($this->form->getElement('replayGainModifier')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->form->getElement('replayGainModifier')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div id="slider-range-max" style="width: 99%"></div>
</dd>
<label><?php echo $this->form->getElement('replayGainModifier')->getLabel() ?>:
</label>
<span id="rg_modifier_value" style="border: 0; color: #f6931f; font-weight: bold;">
<?php echo $this->form->getElement('replayGainModifier')->getValue() ?>
</span>
dB
</dt>
<dd id="replayGainModifier-element" class="block-display">
<?php echo $this->form->getElement('replayGainModifier') ?>
<?php if($this->form->getElement('replayGainModifier')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->form->getElement('replayGainModifier')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div id="slider-range-max" style="width: 99%"></div>
</dd>
</dl>
</fieldset>
<?php echo $this->form->getSubform('live_stream_subform'); ?>

View File

@ -1,6 +1,7 @@
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
-- added in 2.3
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('off_air_meta', 'Airtime - offline', 'string');
INSERT INTO cc_pref("keystr", "valstr") VALUES('enable_replay_gain', 1);
-- end of added in 2.3
-- added in 2.1