diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index e02add24a..2c8cd839c 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -103,7 +103,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap * from a php init function. This will save us from having to * reinitialize them every request */ - protected function _initTranslationGlobals() { + 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 . "';"); @@ -190,9 +190,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/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index 7c808140c..c3fa239e9 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; - } + }*/ //Because uploads are done via AJAX (and we're not using Zend form for those), we manually add the CSRF //token in here. diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index e43021287..0e15dcb92 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); } diff --git a/airtime_mvc/application/models/airtime/CcFiles.php b/airtime_mvc/application/models/airtime/CcFiles.php index 148eb37c0..a7873c850 100644 --- a/airtime_mvc/application/models/airtime/CcFiles.php +++ b/airtime_mvc/application/models/airtime/CcFiles.php @@ -78,9 +78,11 @@ class CcFiles extends BaseCcFiles { */ public static function createFromUpload($fileArray) { + /*temporarily disabling disk quota until all file sizes have ben set in the database. if (Application_Model_Systemstatus::isDiskOverQuota()) { throw new OverDiskQuotaException(); } + */ /* If full_path is set, the post request came from ftp. * Users are allowed to upload folders via ftp. If this is the case 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 = {