CC-3224: "On-the-fly" stream rebroadcasting

- A section where user can setup port and mount point for harbor input in
stream setting page(front-end and back-end)
- updated the part where it rewrites the liquidsoap.cfg file
This commit is contained in:
James 2012-02-23 11:11:02 -05:00
parent 48bb19d758
commit 30901aa0d6
8 changed files with 74 additions and 7 deletions

View File

@ -805,8 +805,11 @@ class ApiController extends Zend_Controller_Action
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
exit; exit;
} }
$this->view->msg = Application_Model_StreamSetting::getStreamSetting(); $info = Application_Model_StreamSetting::getStreamSetting();
$info[] = (array("keyname" =>"harbor_input_port", "value"=>Application_Model_Preference::GetLiveSteamPort(), "type"=>"integer"));
$info[] = (array("keyname" =>"harbor_input_mount_point", "value"=>Application_Model_Preference::GetLiveSteamMountPoint(), "type"=>"string"));
$this->view->msg = $info;
} }
public function statusAction() { public function statusAction() {

View File

@ -207,6 +207,8 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_StreamSetting::setStreamSetting($values); Application_Model_StreamSetting::setStreamSetting($values);
$data = array(); $data = array();
$data['setting'] = Application_Model_StreamSetting::getStreamSetting(); $data['setting'] = Application_Model_StreamSetting::getStreamSetting();
$data['setting']['harbor_input_port'] = $values["harbor_input_port"];
$data['setting']['harbor_input_mount_point'] = $values["harbor_input_mount_point"];
for($i=1;$i<=$num_of_stream;$i++){ for($i=1;$i<=$num_of_stream;$i++){
Application_Model_StreamSetting::setLiquidsoapError($i, "waiting"); Application_Model_StreamSetting::setLiquidsoapError($i, "waiting");
} }
@ -215,7 +217,8 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetLiveSteamAutoEnable($values["auto_enable_live_stream"]); Application_Model_Preference::SetLiveSteamAutoEnable($values["auto_enable_live_stream"]);
Application_Model_Preference::SetLiveSteamMasterUsername($values["master_username"]); Application_Model_Preference::SetLiveSteamMasterUsername($values["master_username"]);
Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]); Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]);
Application_Model_Preference::SetLiveSteamPort($values["harbor_input_port"]);
Application_Model_Preference::SetLiveSteamMountPoint($values["harbor_input_mount_point"]);
// store stream update timestamp // store stream update timestamp
Application_Model_Preference::SetStreamUpdateTimestamp(); Application_Model_Preference::SetStreamUpdateTimestamp();
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data); Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);

View File

@ -36,5 +36,22 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
->setFilters(array('StringTrim')) ->setFilters(array('StringTrim'))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($master_password); $this->addElement($master_password);
//liquidsoap harbor.input port
$port = new Zend_Form_Element_Text('harbor_input_port');
$port->setLabel("Port to Connect")
->setValue(Application_Model_Preference::GetLiveSteamPort())
->setValidators(array(new Zend_Validate_Between(array('min'=>0, 'max'=>99999))))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
->setDecorators(array('ViewHelper'));
$this->addElement($port);
$mount = new Zend_Form_Element_Text('harbor_input_mount_point');
$mount->setLabel("Mount Point to Connect")
->setValue(Application_Model_Preference::GetLiveSteamMountPoint())
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
->setDecorators(array('ViewHelper'));
$this->addElement($mount);
} }
} }

View File

@ -729,6 +729,21 @@ class Application_Model_Preference
return self::GetValue("live_stream_master_password"); return self::GetValue("live_stream_master_password");
} }
public static function SetLiveSteamPort($value){
self::SetValue("live_stream_port", $value, false);
}
public static function GetLiveSteamPort(){
return self::GetValue("live_stream_port");
}
public static function SetLiveSteamMountPoint($value){
self::SetValue("live_stream_mp", $value, false);
}
public static function GetLiveSteamMountPoint(){
return self::GetValue("live_stream_mp");
}
/* User specific preferences end */ /* User specific preferences end */
} }

View File

@ -43,5 +43,33 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="harbor_input_port-label">
<label class="optional" for="harbor_input_port"><?php echo $this->element->getElement('harbor_input_port')->getLabel() ?> :
</label>
</dt>
<dd id="harbor_input_port-element">
<?php echo $this->element->getElement('harbor_input_port') ?>
<?php if($this->element->getElement('harbor_input_port')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('harbor_input_port')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="harbor_input_mount_point-label">
<label class="optional" for="harbor_input_mount_point"><?php echo $this->element->getElement('harbor_input_mount_point')->getLabel() ?> :
</label>
</dt>
<dd id="harbor_input_mount_point-element">
<?php echo $this->element->getElement('harbor_input_mount_point') ?>
<?php if($this->element->getElement('harbor_input_mount_point')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('harbor_input_mount_point')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl> </dl>
</fieldset> </fieldset>

View File

@ -2110,9 +2110,6 @@ dd .info-text-small {
.simple-formblock .display_field dd { .simple-formblock .display_field dd {
min-width:68%; min-width:68%;
} }
.stream-config dd input[id$=port] {
width:152px;
}
dt.block-display.info-block { dt.block-display.info-block {
width: auto; width: auto;

View File

@ -54,7 +54,7 @@ def check_client(user,password) =
end end
end end
live = input.harbor("test", port=8080, auth=check_client) live = input.harbor(harbor_input_mount_point, port=harbor_input_port, auth=check_client)
s = fallback(track_sensitive=false, [live, queue, default]) s = fallback(track_sensitive=false, [live, queue, default])

View File

@ -155,6 +155,10 @@ class PypoFetch(Thread):
if (existing[s[u'keyname']] != s[u'value']): if (existing[s[u'keyname']] != s[u'value']):
self.logger.info("'Need-to-restart' state detected for %s...", s[u'keyname']) self.logger.info("'Need-to-restart' state detected for %s...", s[u'keyname'])
restart = True; restart = True;
elif "harbor_input_mount_point" in s[u'keyname'] or "harbor_input_port" in s[u'keyname']:
if (existing[s[u'keyname']] != s[u'value']):
logger.info("'Need-to-restart' state detected for %s...", s[u'keyname'])
restart = True;
else: else:
stream, dump = s[u'keyname'].split('_',1) stream, dump = s[u'keyname'].split('_',1)
if "_output" in s[u'keyname']: if "_output" in s[u'keyname']: