Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
a84a28d556
8 changed files with 119 additions and 30 deletions
|
@ -21,6 +21,7 @@ class ApiController extends Zend_Controller_Action
|
|||
->addActionContext('remove-watched-dir', 'json')
|
||||
->addActionContext('set-storage-dir', 'json')
|
||||
->addActionContext('get-stream-setting', 'json')
|
||||
->addActionContext('status', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -636,5 +637,32 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$this->view->msg = Application_Model_StreamSetting::getStreamSetting();
|
||||
}
|
||||
|
||||
public function statusAction() {
|
||||
global $CC_CONFIG;
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
/*
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
{
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource.';
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
$status = array(
|
||||
"airtime_version"=>Application_Model_Systemstatus::GetAirtimeVersion(),
|
||||
"icecast"=>Application_Model_Systemstatus::GetIcecastStatus(),
|
||||
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
||||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||
"show-recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||
"media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||
);
|
||||
|
||||
$this->view->status = $status;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
|
|||
if (RabbitMq::$doPush) {
|
||||
$md = array('schedule' => Schedule::GetScheduledPlaylists());
|
||||
RabbitMq::SendMessageToPypo("update_schedule", $md);
|
||||
RabbitMq::SendMessageToShowRecorder("update_schedule");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,6 @@ class RabbitMq
|
|||
$channel->basic_publish($msg, $EXCHANGE);
|
||||
$channel->close();
|
||||
$conn->close();
|
||||
|
||||
self::SendMessageToShowRecorder("update_schedule");
|
||||
}
|
||||
|
||||
public static function SendMessageToMediaMonitor($event_type, $md)
|
||||
|
|
|
@ -3,6 +3,50 @@
|
|||
class Application_Model_Systemstatus
|
||||
{
|
||||
|
||||
public static function GetPypoStatus(){
|
||||
|
||||
RabbitMq::SendMessageToPypo("get_status", array());
|
||||
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetLiquidsoapStatus(){
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetShowRecorderStatus(){
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetMediaMonitorStatus(){
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetIcecastStatus(){
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetAirtimeVersion(){
|
||||
return AIRTIME_VERSION;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function getCheckSystemResults(){
|
||||
//exec("airtime-check-system", $output);
|
||||
|
||||
|
|
3
airtime_mvc/application/views/scripts/api/status.phtml
Normal file
3
airtime_mvc/application/views/scripts/api/status.phtml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
echo $status;
|
|
@ -14,7 +14,7 @@ $PORT = 5672;
|
|||
$USER = 'guest';
|
||||
$PASS = 'guest';
|
||||
$VHOST = '/';
|
||||
$EXCHANGE = 'router';
|
||||
$EXCHANGE = 'airtime-schedule';
|
||||
$QUEUE = 'msgs';
|
||||
$CONSUMER_TAG = 'consumer';
|
||||
|
||||
|
@ -23,7 +23,7 @@ $ch = $conn->channel();
|
|||
$ch->access_request($VHOST, false, false, true, true);
|
||||
|
||||
$ch->queue_declare($QUEUE);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, false, false);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||
$ch->queue_bind($QUEUE, $EXCHANGE);
|
||||
|
||||
function process_message($msg) {
|
||||
|
|
|
@ -13,15 +13,17 @@ $PORT = 5672;
|
|||
$USER = 'guest';
|
||||
$PASS = 'guest';
|
||||
$VHOST = '/';
|
||||
$EXCHANGE = 'router';
|
||||
$EXCHANGE = 'airtime-schedule';
|
||||
|
||||
$QUEUE = 'msgs';
|
||||
|
||||
$conn = new AMQPConnection($HOST, $PORT, $USER, $PASS);
|
||||
$ch = $conn->channel();
|
||||
$ch->access_request($VHOST, false, false, true, true);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, false, false);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||
|
||||
$msg_body = implode(' ', array_slice($argv, 1));
|
||||
$msg_body = json_encode(array("event_type"=>"get_status", "id"=>time()));
|
||||
//$msg_body = '{"schedule":{"status":{"range":{"start":"2011-09-12 20:45:22","end":"2011-09-13 20:45:22"},"version":"1.1"},"playlists":[],"check":1,"stream_metadata":{"format":"","station_name":""}},"event_type":"update_schedule"}';
|
||||
$msg = new AMQPMessage($msg_body, array('content_type' => 'text/plain'));
|
||||
|
||||
$ch->basic_publish($msg, $EXCHANGE);
|
||||
|
@ -29,4 +31,5 @@ $ch->basic_publish($msg, $EXCHANGE);
|
|||
echo "Sent message '".$msg_body."'\n";
|
||||
$ch->close();
|
||||
$conn->close();
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue