From 9b390518b75da5dddb2b69f9518f3e60ef44c6b5 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Thu, 13 Mar 2014 14:59:48 -0400 Subject: [PATCH] CC-5709: Airtime Analyzer * Fix the callback URL * Imports files successfully now! --- .../modules/rest/controllers/MediaController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index f0eaf7b53..dd5f11da1 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -66,13 +66,14 @@ class Rest_MediaController extends Zend_Rest_Controller return; } - $this->processUploadedFile($this->getRequest()->getRequestUri()); - //TODO: Strip or sanitize the JSON output $file = new CcFiles(); $file->fromArray($this->getRequest()->getPost()); $file->save(); + $callbackUrl = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getRequestUri() . "/" . $file->getPrimaryKey(); + $this->processUploadedFile($callbackUrl); + $this->getResponse() ->setHttpResponseCode(201) ->appendBody(json_encode($file->toArray(BasePeer::TYPE_FIELDNAME))); @@ -193,10 +194,11 @@ class Rest_MediaController extends Zend_Rest_Controller $storDir = Application_Model_MusicDir::getStorDir(); $finalDestinationDir = $storDir->getDirectory() . "/organize"; - //Dispatch a message to airtime_analyzer through RabbitMQ, + //Dispatch a message to airtime_analyzer through RabbitMQ, //notifying it that there's a new upload to process! Application_Model_RabbitMq::SendMessageToAnalyzer($tempFilePath, $finalDestinationDir, $callbackUrl, $apiKey); } -} \ No newline at end of file +} +