From 32bdbe1ad69777dbc65b948b5be75cc4b9bb5383 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Fri, 14 Nov 2014 11:12:10 -0500 Subject: [PATCH 1/3] Improved some comments --- .../airtime_analyzer/airtime_analyzer/analyzer_pipeline.py | 2 +- .../airtime_analyzer/airtime_analyzer/message_listener.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py b/python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py index 39c558bac..e36c03688 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py @@ -52,7 +52,7 @@ class AnalyzerPipeline: metadata = dict() metadata = MetadataAnalyzer.analyze(audio_file_path, metadata) metadata = FileMoverAnalyzer.move(audio_file_path, import_directory, original_filename, metadata) - metadata["import_status"] = 0 # imported + metadata["import_status"] = 0 # Successfully imported # Note that the queue we're putting the results into is our interprocess communication # back to the main process. diff --git a/python_apps/airtime_analyzer/airtime_analyzer/message_listener.py b/python_apps/airtime_analyzer/airtime_analyzer/message_listener.py index 9b890321c..495682d7b 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/message_listener.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/message_listener.py @@ -26,7 +26,7 @@ QUEUE = "airtime-uploads" Airtime's music library directory. Lastly, the extracted metadata is reported back to the Airtime web application. - There's a couple of Very Important technical details and contraints that you + There's a couple of Very Important technical details and constraints that you need to know if you're going to work on this code: 1) airtime_analyzer is designed so it doesn't have to run on the same From e7e1926896ab102086085ee7cb19067ba08b2cb4 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 18 Nov 2014 17:11:09 -0500 Subject: [PATCH 2/3] CC-5950: Fix for issue where clear button in Recent Uploads didn't work sometimes --- airtime_mvc/application/models/StoredFile.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 0e588bbe9..8c5910182 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -355,7 +355,13 @@ SQL; { $exists = false; try { - $exists = file_exists($this->getFilePath()); + //Explicitly check filepath because if it's blank, getFilePath() can + //still return a directory that exists. + if (!$this->_file->getDbFilepath()) { + $exists = false; + } else { + $exists = file_exists($this->getFilePath()); + } } catch (Exception $e) { return false; } From 6460854fdad351a91fe054a321caa7ab54b3a040 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Mon, 10 Nov 2014 16:07:23 -0500 Subject: [PATCH 3/3] Fixed 'clear' button not working when files failed to import --- .../modules/rest/controllers/MediaController.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index 87af946bb..243eeeb50 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -1,8 +1,13 @@ findPk($id); + // Since we check for this value when deleting files, set it first + $file->setDbDirectory(self::MUSIC_DIRS_STOR_PK); $requestData = json_decode($this->getRequest()->getRawBody(), true); $whiteList = $this->removeBlacklistedFieldsFromRequestData($requestData); @@ -228,7 +235,7 @@ class Rest_MediaController extends Zend_Rest_Controller $fileSizeBytes = filesize($requestData["full_path"]); if (!isset($fileSizeBytes) || $fileSizeBytes === false) { - $file->setDbImportStatus(2)->save(); + $file->setDbImportStatus(self::IMPORT_STATUS_FAILED)->save(); $this->fileNotFoundResponse(); return; } @@ -244,7 +251,6 @@ class Rest_MediaController extends Zend_Rest_Controller $filePathRelativeToStor = substr($fullPath, strlen($storDir)); $file->setDbFilepath($filePathRelativeToStor); - $file->setDbDirectory(1); //1 corresponds to the default stor/imported directory. } } @@ -259,7 +265,7 @@ class Rest_MediaController extends Zend_Rest_Controller ->setHttpResponseCode(200) ->appendBody(json_encode(CcFiles::sanitizeResponse($file))); } else { - $file->setDbImportStatus(2)->save(); + $file->setDbImportStatus(self::IMPORT_STATUS_FAILED)->save(); $this->fileNotFoundResponse(); } } @@ -270,6 +276,7 @@ class Rest_MediaController extends Zend_Rest_Controller { return; } + $id = $this->getId(); if (!$id) {