CC-3336: Refactor schedule API used by pypo

-done
This commit is contained in:
Martin Konecny 2012-02-29 21:27:42 -05:00
parent 08048cd403
commit 92f19139b9
5 changed files with 46 additions and 65 deletions

View file

@ -27,6 +27,7 @@ class ApiController extends Zend_Controller_Action
->addActionContext('live-chat', 'json')
->addActionContext('update-file-system-mount', 'json')
->addActionContext('handle-watched-dir-missing', 'json')
->addActionContext('rabbitmq-do-push', 'json')
->initContext();
}
@ -318,6 +319,7 @@ class ApiController extends Zend_Controller_Action
}
}
/*
public function notifyScheduleGroupPlayAction()
{
global $CC_CONFIG;
@ -357,6 +359,7 @@ class ApiController extends Zend_Controller_Action
exit;
}
}
*/
public function recordedShowsAction()
{
@ -903,5 +906,26 @@ class ApiController extends Zend_Controller_Action
$dir = base64_decode($request->getParam('dir'));
Application_Model_MusicDir::removeWatchedDir($dir, false);
}
/* 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(){
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;
}
Logging::log("Notifying RabbitMQ to send message to pypo");
Application_Model_RabbitMq::PushSchedule();
}
}