From e0a050ac608a48c470c3463a7333dd568bd1109b Mon Sep 17 00:00:00 2001 From: drigato Date: Wed, 25 Feb 2015 15:09:02 -0500 Subject: [PATCH 1/5] Fix file deletion bug --- airtime_mvc/application/models/StoredFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 26cbea647..f7c023bb4 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -392,7 +392,7 @@ SQL; Logging::info("User ".$user->getLogin()." is deleting file: ".$this->_file->getDbTrackTitle()." - file id: ".$file_id); $filesize = $this->_file->getFileSize(); - if ($filesize <= 0) { + if ($filesize < 0) { throw new Exception("Cannot delete file with filesize ".$filesize); } From 7e167e5a47e1d695aeb7a2f599651cb831223a42 Mon Sep 17 00:00:00 2001 From: drigato Date: Wed, 25 Feb 2015 15:28:48 -0500 Subject: [PATCH 2/5] Temporarily disabling disk quota limit until all file sizes have been set --- airtime_mvc/application/controllers/PluploadController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index f1197ec2b..16ce257db 100644 --- a/airtime_mvc/application/controllers/PluploadController.php +++ b/airtime_mvc/application/controllers/PluploadController.php @@ -27,9 +27,10 @@ class PluploadController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl.'css/addmedia.css?'.$CC_CONFIG['airtime_version']); $this->view->quotaLimitReached = false; - if (Application_Model_Systemstatus::isDiskOverQuota()) { + // temporarily disabling disk quota until all file size values have been set + /*if (Application_Model_Systemstatus::isDiskOverQuota()) { $this->view->quotaLimitReached = true; - } + }*/ $csrf_namespace = new Zend_Session_Namespace('csrf_namespace'); $csrf_namespace->setExpirationSeconds(5*60*60); From 48b4e3fb623398524622f38dee851e1fc3c97676 Mon Sep 17 00:00:00 2001 From: drigato Date: Wed, 25 Feb 2015 16:11:52 -0500 Subject: [PATCH 3/5] Also need to diable disk usage in media controller --- .../application/modules/rest/controllers/MediaController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index cbe53ac30..1c18c233d 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -103,12 +103,13 @@ class Rest_MediaController extends Zend_Rest_Controller return; } - if (Application_Model_Systemstatus::isDiskOverQuota()) { + //temporarily disabling disk quota until all file sizes have ben set in the database. + /*if (Application_Model_Systemstatus::isDiskOverQuota()) { $this->getResponse() ->setHttpResponseCode(400) ->appendBody("ERROR: Disk Quota reached."); return; - } + }*/ $file = new CcFiles(); $whiteList = $this->removeBlacklistedFieldsFromRequestData($this->getRequest()->getPost()); From 93f62eaadd485888234cb416d16c37029c3095d1 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 26 Feb 2015 12:49:52 -0500 Subject: [PATCH 4/5] Added check to hide LiveChat for existing hobbyist users --- airtime_mvc/application/Bootstrap.php | 8 +++++--- airtime_mvc/application/configs/conf.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 63fd52dde..153ce672d 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -88,7 +88,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap * from a php init function. This will save us from having to * reinitialize them every request */ - private function _initTranslationGlobals($view) { + private function _initTranslationGlobals() { + $view = $this->getResource('view'); $view->headScript()->appendScript("var PRODUCT_NAME = '" . PRODUCT_NAME . "';"); $view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';"); $view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';"); @@ -174,9 +175,10 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap && strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/audio-preview') === false && strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/playlist-preview') === false && strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/block-preview') === false) { - if (Application_Model_Preference::GetLiveChatEnabled()) { + $plan_level = strval(Application_Model_Preference::GetPlanLevel()); + // Since the Hobbyist plan doesn't come with Live Chat support, don't enable it + if (Application_Model_Preference::GetLiveChatEnabled() && $plan_level !== 'hobbyist') { $client_id = strval(Application_Model_Preference::GetClientId()); - $plan_level = strval(Application_Model_Preference::GetPlanLevel()); $station_url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $view->headScript()->appendScript("var livechat_client_id = '$client_id';\n". "var livechat_plan_type = '$plan_level';\n". diff --git a/airtime_mvc/application/configs/conf.php b/airtime_mvc/application/configs/conf.php index d38a03797..6cf5f9d6c 100644 --- a/airtime_mvc/application/configs/conf.php +++ b/airtime_mvc/application/configs/conf.php @@ -92,7 +92,7 @@ class Config { public static function setAirtimeVersion() { $airtime_version = Application_Model_Preference::GetAirtimeVersion(); $uniqueid = Application_Model_Preference::GetUniqueId(); - $buildVersion = file_get_contents(self::$rootDir."/../VERSION"); + $buildVersion = @file_get_contents(self::$rootDir."/../VERSION"); self::$CC_CONFIG['airtime_version'] = md5($airtime_version.$buildVersion); } From d82f461f3580c7fb0a2f139912e00eae6289955e Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Thu, 26 Feb 2015 13:06:29 -0500 Subject: [PATCH 5/5] Fix missing filesize and md5 for WAVE imports --- .../airtime_analyzer/metadata_analyzer.py | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/python_apps/airtime_analyzer/airtime_analyzer/metadata_analyzer.py b/python_apps/airtime_analyzer/airtime_analyzer/metadata_analyzer.py index 57d278548..58fc1d56e 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/metadata_analyzer.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/metadata_analyzer.py @@ -28,6 +28,18 @@ class MetadataAnalyzer(Analyzer): #Other fields we'll want to set for Airtime: metadata["hidden"] = False + # Get file size and md5 hash of the file + metadata["filesize"] = os.path.getsize(filename) + + with open(filename, 'rb') as fh: + m = hashlib.md5() + while True: + data = fh.read(8192) + if not data: + break + m.update(data) + metadata["md5"] = m.hexdigest() + # Mutagen doesn't handle WAVE files so we use a different package mime_check = magic.from_file(filename, mime=True) metadata["mime"] = mime_check @@ -98,20 +110,6 @@ class MetadataAnalyzer(Analyzer): #If we couldn't figure out the track_number or track_total, just ignore it... pass - # Get file size and md5 hash of the file - metadata["filesize"] = os.path.getsize(filename) - - with open(filename, 'rb') as fh: - m = hashlib.md5() - while True: - data = fh.read(8192) - if not data: - break - m.update(data) - metadata["md5"] = m.hexdigest() - - - #We normalize the mutagen tags slightly here, so in case mutagen changes, #we find the mutagen_to_airtime_mapping = {