def run(self): translation.activate('en') if self.action == 'update_schedule': range_start = datetime.datetime.now() range_end = datetime.datetime.now() + datetime.timedelta(seconds=60*60*6) data = scheduler.get_schedule_for_pypo(range_start, range_end) pg = PypoGateway() message = { 'event_type': 'update_schedule', 'schedule': {'media': data}, } pg.send(message) if self.action == 'reset_schedule': message = { 'event_type': 'update_schedule', 'schedule': {'media': []}, } pypo_send(message) if self.action == 'custom_message': message = { 'event_type': '%s' % self.message, 'schedule': {'media': []}, } pypo_send(message)
def rabbitmq_do_push(self, request, **kwargs): """ airtime /* This action is for use by our dev scripts, that make * a change to the database and we want rabbitmq to send * out a message to pypo that a potential change has been made. */ public function rabbitmqDoPushAction() { Logging::info("Notifying RabbitMQ to send message to pypo"); Application_Model_RabbitMq::SendMessageToPypo("reset_liquidsoap_bootstrap", array()); Application_Model_RabbitMq::PushSchedule(); } """ pypo_send({'event_type': 'reset_liquidsoap_bootstrap'}) data = {} return self.json_response(request, data)