CC-2745: Show status of liquidsoap/icecast connection on
Stream Settings page - commit w/o design
This commit is contained in:
parent
2e4b8d82ee
commit
faba5aec57
5 changed files with 66 additions and 4 deletions
|
@ -13,6 +13,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
->addActionContext('remove-watch-directory', 'json')
|
||||
->addActionContext('is-import-in-progress', 'json')
|
||||
->addActionContext('change-stream-setting', 'json')
|
||||
->addActionContext('get-liquidsoap-status', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -284,6 +285,20 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
die(json_encode($res));
|
||||
}
|
||||
|
||||
public function getLiquidsoapStatusAction(){
|
||||
$out = array();
|
||||
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
|
||||
for($i=1; $i<=$num_of_stream; $i++){
|
||||
$status = Application_Model_StreamSetting::getLiquidsoapError($i);
|
||||
$status = $status == ''?"OK":$status;
|
||||
if(!Application_Model_StreamSetting::getStreamEnabled($i)){
|
||||
$status = "N/A";
|
||||
}
|
||||
$out[] = array("id"=>$i, "status"=>$status);
|
||||
}
|
||||
die(json_encode($out));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -155,8 +155,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
}
|
||||
$this->addElement($user);
|
||||
|
||||
$liquidsopa_error_msg = "Getting infomation from the server..";
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number))
|
||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "liquidsoap_error_msg"=>$liquidsopa_error_msg))
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -99,9 +99,25 @@ class Application_Model_StreamSetting {
|
|||
|
||||
$keyname = "s".$stream_id."_liquidsoap_error";
|
||||
$sql = "SELECT value FROM cc_stream_setting"
|
||||
." WHERE keyname = '$key'";
|
||||
." WHERE keyname = '$keyname'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getStreamEnabled($stream_id){
|
||||
global $CC_DBC;
|
||||
|
||||
$keyname = "s".$stream_id."_ouput";
|
||||
$sql = "SELECT value FROM cc_stream_setting"
|
||||
." WHERE keyname = '$keyname'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
if($result == 'disabled'){
|
||||
$result = false;
|
||||
}else{
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
<div class="stream-setting-content" <?php echo $this->stream_number != '1'?'style="display: none;':''?> id="<?=$s_name?>-config">
|
||||
<fieldset class="padded">
|
||||
<dl class="zend_form clearfix">
|
||||
<dt id="<?=$s_name?>Liquidsoap-error-msg-label">
|
||||
<label>Liquidsoap Status: </label>
|
||||
</dt>
|
||||
<dd id="<?=$s_name?>Liquidsoap-error-msg-element">
|
||||
<?php echo $this->liquidsoap_error_msg?>
|
||||
</dd>
|
||||
<dt id="<?=$s_name?>Enabled-label">
|
||||
<label for="<?=$s_name?>Enabled"><?php echo $this->element->getElement('enable')->getLabel() ?></label>
|
||||
</dt>
|
||||
|
|
|
@ -69,6 +69,29 @@ function showForIcecast(ele){
|
|||
div.find("select[id$=data-type]").find("option[value='ogg']").attr("disabled","");
|
||||
}
|
||||
|
||||
function checkLiquidsoapStatus(){
|
||||
var url = '/Preference/get-liquidsoap-status/format/json';
|
||||
var id = $(this).attr("id");
|
||||
$.post(url, function(json){
|
||||
var json_obj = jQuery.parseJSON(json);
|
||||
for(var i=0;i<json_obj.length;i++){
|
||||
var obj = json_obj[i];
|
||||
var id
|
||||
var status
|
||||
for(var key in obj){
|
||||
if(key == "id"){
|
||||
id = obj[key];
|
||||
}
|
||||
if(key == "status"){
|
||||
status = obj[key];
|
||||
}
|
||||
}
|
||||
$("#s"+id+"Liquidsoap-error-msg-element").html(status);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// initial stream url
|
||||
$("dd[id=outputStreamURL-element]").each(function(){
|
||||
|
@ -127,6 +150,6 @@ $(document).ready(function() {
|
|||
})
|
||||
|
||||
showErrorSections()
|
||||
|
||||
setInterval('checkLiquidsoapStatus()', 5000)
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue