CC-3346: Recorder: Merge recorder with pypo

- Pypo fech works as msg listner for recroder now.
- recorder is part of pypo and all it does is waiting for msg from pypo
fetch and spwan a show recorder thread.
- added new parameter logger to api client. This way apiclient will log
into specific log file instead of grabbing current log file.
- show recoder is removed from all check system/status page
This commit is contained in:
James 2012-02-24 13:12:50 -05:00
parent 2ef6d230f9
commit 2f689ed583
30 changed files with 419 additions and 856 deletions

View file

@ -775,7 +775,6 @@ class ApiController extends Zend_Controller_Action
"rabbitmq"=>Application_Model_Systemstatus::GetRabbitMqStatus(),
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
"show_recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
)
);

View file

@ -21,10 +21,6 @@ class SystemstatusController extends Zend_Controller_Action
"media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(),
"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus()
);
if (!isset($_SERVER["AIRTIME_SRV"])){
$services["show-recorder"]=Application_Model_Systemstatus::GetShowRecorderStatus();
}
$partitions = Application_Model_Systemstatus::GetDiskInfo();
@ -32,36 +28,4 @@ class SystemstatusController extends Zend_Controller_Action
$this->view->status->services = $services;
$this->view->status->partitions = $partitions;
}
public function getLogFileAction()
{
$log_files = array("pypo"=>"/var/log/airtime/pypo/pypo.log",
"liquidsoap"=>"/var/log/airtime/pypo-liquidsoap/ls_script.log",
"media-monitor"=>"/var/log/airtime/media-monitor/media-monitor.log",
"show-recorder"=>"/var/log/airtime/show-recorder/show-recorder.log",
"icecast2"=>"/var/log/icecast2/error.log");
$id = $this->_getParam('id');
Logging::log($id);
if (array_key_exists($id, $log_files)){
$filepath = $log_files[$id];
$filename = basename($filepath);
header("Content-Disposition: attachment; filename=$filename");
header("Content-Length: " . filesize($filepath));
// !! binary mode !!
$fp = fopen($filepath, 'rb');
//We can have multiple levels of output buffering. Need to
//keep looping until all have been disabled!!!
//http://www.php.net/manual/en/function.ob-end-flush.php
while (@ob_end_flush());
fpassthru($fp);
fclose($fp);
//make sure to exit here so that no other output is sent.
exit;
}
}
}

View file

@ -8,7 +8,7 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
if (!isset($_SERVER['AIRTIME_SRV'])){
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
Application_Model_RabbitMq::SendMessageToShowRecorder("update_recorder_schedule");
}
}
}

View file

@ -74,7 +74,7 @@ class Application_Model_RabbitMq
$channel = $conn->channel();
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
$EXCHANGE = 'airtime-show-recorder';
$EXCHANGE = 'airtime-pypo';
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
$now = new DateTime("@".time()); //in UTC timezone
@ -82,7 +82,7 @@ class Application_Model_RabbitMq
$temp['event_type'] = $event_type;
$temp['server_timezone'] = Application_Model_Preference::GetTimezone();
if($event_type = "update_schedule"){
if($event_type = "update_recorder_schedule"){
$temp['shows'] = Application_Model_Show::getShows($now, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE);
}
$data = json_encode($temp);

View file

@ -147,21 +147,6 @@ class Application_Model_Systemstatus
}
}
public static function GetShowRecorderStatus(){
$component = CcServiceRegisterQuery::create()->findOneByDbName("show-recorder");
if (is_null($component)){
return null;
} else {
$ip = $component->getDbIp();
$docRoot = self::GetMonitStatus($ip);
$data = self::ExtractServiceInformation($docRoot, "airtime-show-recorder");
return $data;
}
}
public static function GetMediaMonitorStatus(){
$component = CcServiceRegisterQuery::create()->findOneByDbName("media-monitor");