CC-2745: Show status of liquidsoap/icecast connection on Stream Settings
page - initial commit
This commit is contained in:
parent
5b6b81e5f3
commit
d3833f9a32
7 changed files with 156 additions and 22 deletions
|
@ -23,6 +23,8 @@ class ApiController extends Zend_Controller_Action
|
|||
->addActionContext('get-stream-setting', 'json')
|
||||
->addActionContext('status', 'json')
|
||||
->addActionContext('register-component', 'json')
|
||||
->addActionContext('update-liquidsoap-error', 'json')
|
||||
->addActionContext('update-liquidsoap-connection', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -696,5 +698,21 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||
}
|
||||
|
||||
public function updateLiquidsoapErrorAction(){
|
||||
$request = $this->getRequest();
|
||||
|
||||
$error_msg = $request->getParam('error_msg');
|
||||
$stream_id = $request->getParam('stream_id');
|
||||
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $error_msg);
|
||||
}
|
||||
|
||||
public function updateLiquidsoapConnectionAction(){
|
||||
$request = $this->getRequest();
|
||||
|
||||
$stream_id = $request->getParam('stream_id');
|
||||
// setting error_msg as "" when there is no error_msg
|
||||
Application_Model_StreamSetting::setLiquidsoapError($stream_id, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ class Application_Model_StreamSetting {
|
|||
public static function getStreamSetting(){
|
||||
global $CC_DBC;
|
||||
$sql = "SELECT *"
|
||||
." FROM cc_stream_setting";
|
||||
." FROM cc_stream_setting"
|
||||
." WHERE keyname not like '%_error'";
|
||||
|
||||
$rows = $CC_DBC->getAll($sql);
|
||||
return $rows;
|
||||
|
@ -74,4 +75,33 @@ class Application_Model_StreamSetting {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function setLiquidsoapError($stream_id, $msg){
|
||||
global $CC_DBC;
|
||||
|
||||
$keyname = "s".$stream_id."_liquidsoap_error";
|
||||
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
||||
." WHERE keyname = '$keyname'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
if ($result == 1){
|
||||
$sql = "UPDATE cc_stream_setting"
|
||||
." SET value = '$value'"
|
||||
." WHERE keyname = '$keyname'";
|
||||
}else{
|
||||
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
||||
." VALUES ($keyname, '$msg', 'string')";
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLiquidsoapError($stream_id){
|
||||
global $CC_DBC;
|
||||
|
||||
$keyname = "s".$stream_id."_liquidsoap_error";
|
||||
$sql = "SELECT value FROM cc_stream_setting"
|
||||
." WHERE keyname = '$key'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue