示例#1
0
 /**
  * Push the current schedule to RabbitMQ, to be picked up by Pypo.
  * Will push the schedule in the range from 24 hours ago to 24 hours
  * in the future.
  */
 public static function PushScheduleFinal()
 {
     global $CC_CONFIG;
     if (RabbitMq::$doPush) {
         $conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"], $CC_CONFIG["rabbitmq"]["port"], $CC_CONFIG["rabbitmq"]["user"], $CC_CONFIG["rabbitmq"]["password"]);
         $channel = $conn->channel();
         $channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
         $EXCHANGE = 'airtime-schedule';
         $channel->exchange_declare($EXCHANGE, 'direct', false, true);
         $data = json_encode(Schedule::GetScheduledPlaylists());
         $msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
         $channel->basic_publish($msg, $EXCHANGE);
         $channel->close();
         $conn->close();
         self::SendMessageToShowRecorder("update_schedule");
     }
 }
示例#2
0
 public function scheduleAction()
 {
     global $CC_CONFIG;
     // disable the view and the layout
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $api_key = $this->_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;
     }
     PEAR::setErrorHandling(PEAR_ERROR_RETURN);
     $result = Schedule::GetScheduledPlaylists();
     echo json_encode($result);
 }