CC-2588 :Use RabbitMQ to control the show recorder

- done
This commit is contained in:
James 2011-07-25 16:24:00 -04:00
parent 047a288c38
commit 2b36e8193e
4 changed files with 150 additions and 210 deletions

View file

@ -80,7 +80,16 @@ class RabbitMq
$EXCHANGE = 'airtime-show-recorder';
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
$msg = new AMQPMessage($event_type, array('content_type' => 'text/plain'));
$today_timestamp = date("Y-m-d H:i:s");
$now = new DateTime($today_timestamp);
$end_timestamp = $now->add(new DateInterval("PT2H"));
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
$temp['event_type'] = $event_type;
if($event_type = "update_schedule"){
$temp['shows'] = Show::getShows($today_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE);
}
$data = json_encode($temp);
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
$channel->basic_publish($msg, $EXCHANGE);
$channel->close();

View file

@ -1611,10 +1611,17 @@ class ShowInstance {
public function deleteShow()
{
// see if it was recording show
$recording = CcShowInstancesQuery::create()
->findPK($this->_instanceId)
->getDbRecord();
CcShowInstancesQuery::create()
->findPK($this->_instanceId)
->delete();
RabbitMq::PushSchedule();
if($recording){
RabbitMq::SendMessageToShowRecorder("cancel_recording");
}
}
public function setRecordedFile($file_id)