Merge branch 'saas' into saas-media-refactor
Conflicts: airtime_mvc/application/Bootstrap.php airtime_mvc/application/modules/rest/controllers/MediaController.php
This commit is contained in:
commit
ab6d83f49d
|
@ -103,7 +103,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
* from a php init function. This will save us from having to
|
* from a php init function. This will save us from having to
|
||||||
* reinitialize them every request
|
* reinitialize them every request
|
||||||
*/
|
*/
|
||||||
protected function _initTranslationGlobals() {
|
private function _initTranslationGlobals() {
|
||||||
$view = $this->getResource('view');
|
$view = $this->getResource('view');
|
||||||
$view->headScript()->appendScript("var PRODUCT_NAME = '" . PRODUCT_NAME . "';");
|
$view->headScript()->appendScript("var PRODUCT_NAME = '" . PRODUCT_NAME . "';");
|
||||||
$view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';");
|
$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/audio-preview') === false
|
||||||
&& strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/playlist-preview') === false
|
&& strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/playlist-preview') === false
|
||||||
&& strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/block-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());
|
$client_id = strval(Application_Model_Preference::GetClientId());
|
||||||
$plan_level = strval(Application_Model_Preference::GetPlanLevel());
|
|
||||||
$station_url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
|
$station_url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
|
||||||
$view->headScript()->appendScript("var livechat_client_id = '$client_id';\n".
|
$view->headScript()->appendScript("var livechat_client_id = '$client_id';\n".
|
||||||
"var livechat_plan_type = '$plan_level';\n".
|
"var livechat_plan_type = '$plan_level';\n".
|
||||||
|
|
|
@ -27,9 +27,10 @@ class PluploadController extends Zend_Controller_Action
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/addmedia.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/addmedia.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
|
||||||
$this->view->quotaLimitReached = false;
|
$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;
|
$this->view->quotaLimitReached = true;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//Because uploads are done via AJAX (and we're not using Zend form for those), we manually add the CSRF
|
//Because uploads are done via AJAX (and we're not using Zend form for those), we manually add the CSRF
|
||||||
//token in here.
|
//token in here.
|
||||||
|
|
|
@ -392,7 +392,7 @@ SQL;
|
||||||
Logging::info("User ".$user->getLogin()." is deleting file: ".$this->_file->getDbTrackTitle()." - file id: ".$file_id);
|
Logging::info("User ".$user->getLogin()." is deleting file: ".$this->_file->getDbTrackTitle()." - file id: ".$file_id);
|
||||||
|
|
||||||
$filesize = $this->_file->getFileSize();
|
$filesize = $this->_file->getFileSize();
|
||||||
if ($filesize <= 0) {
|
if ($filesize < 0) {
|
||||||
throw new Exception("Cannot delete file with filesize ".$filesize);
|
throw new Exception("Cannot delete file with filesize ".$filesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,11 @@ class CcFiles extends BaseCcFiles {
|
||||||
*/
|
*/
|
||||||
public static function createFromUpload($fileArray)
|
public static function createFromUpload($fileArray)
|
||||||
{
|
{
|
||||||
|
/*temporarily disabling disk quota until all file sizes have ben set in the database.
|
||||||
if (Application_Model_Systemstatus::isDiskOverQuota()) {
|
if (Application_Model_Systemstatus::isDiskOverQuota()) {
|
||||||
throw new OverDiskQuotaException();
|
throw new OverDiskQuotaException();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* If full_path is set, the post request came from ftp.
|
/* If full_path is set, the post request came from ftp.
|
||||||
* Users are allowed to upload folders via ftp. If this is the case
|
* Users are allowed to upload folders via ftp. If this is the case
|
||||||
|
|
|
@ -28,6 +28,18 @@ class MetadataAnalyzer(Analyzer):
|
||||||
#Other fields we'll want to set for Airtime:
|
#Other fields we'll want to set for Airtime:
|
||||||
metadata["hidden"] = False
|
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
|
# Mutagen doesn't handle WAVE files so we use a different package
|
||||||
mime_check = magic.from_file(filename, mime=True)
|
mime_check = magic.from_file(filename, mime=True)
|
||||||
metadata["mime"] = mime_check
|
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...
|
#If we couldn't figure out the track_number or track_total, just ignore it...
|
||||||
pass
|
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 normalize the mutagen tags slightly here, so in case mutagen changes,
|
||||||
#we find the
|
#we find the
|
||||||
mutagen_to_airtime_mapping = {
|
mutagen_to_airtime_mapping = {
|
||||||
|
|
Loading…
Reference in New Issue