Merge branch 'saas' into saas-store-file-size-and-hash-in-db
This commit is contained in:
commit
6ef085f460
|
@ -17,6 +17,12 @@ class FileDataHelper {
|
||||||
// If the track number isn't numeric, this will return 0
|
// If the track number isn't numeric, this will return 0
|
||||||
$data["year"] = intval($data["year"]);
|
$data["year"] = intval($data["year"]);
|
||||||
}
|
}
|
||||||
|
if (array_key_exists("bpm", $data)) {
|
||||||
|
//Some BPM tags are silly and include the word "BPM". Let's strip that...
|
||||||
|
$data["year"] = str_ireplace("BPM", "", $data["year"]);
|
||||||
|
// This will convert floats to ints too.
|
||||||
|
$data["year"] = intval($data["year"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,14 +8,17 @@
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
private static $CC_CONFIG = null;
|
private static $CC_CONFIG = null;
|
||||||
|
private static $rootDir;
|
||||||
public static function loadConfig() {
|
public static function loadConfig() {
|
||||||
|
|
||||||
|
self::$rootDir = __DIR__."/../..";
|
||||||
$CC_CONFIG = array(
|
$CC_CONFIG = array(
|
||||||
/* ================================================ storage configuration */
|
/* ================================================ storage configuration */
|
||||||
|
|
||||||
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
|
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
|
||||||
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
|
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
|
||||||
|
|
||||||
"rootDir" => __DIR__."/../.."
|
"rootDir" => self::$rootDir
|
||||||
);
|
);
|
||||||
|
|
||||||
//In the unit testing environment, we always want to use our local airtime.conf in airtime_mvc/application/test:
|
//In the unit testing environment, we always want to use our local airtime.conf in airtime_mvc/application/test:
|
||||||
|
@ -89,7 +92,8 @@ class Config {
|
||||||
public static function setAirtimeVersion() {
|
public static function setAirtimeVersion() {
|
||||||
$airtime_version = Application_Model_Preference::GetAirtimeVersion();
|
$airtime_version = Application_Model_Preference::GetAirtimeVersion();
|
||||||
$uniqueid = Application_Model_Preference::GetUniqueId();
|
$uniqueid = Application_Model_Preference::GetUniqueId();
|
||||||
self::$CC_CONFIG['airtime_version'] = md5($airtime_version.$uniqueid);
|
$buildVersion = file_get_contents(self::$rootDir."/../VERSION");
|
||||||
|
self::$CC_CONFIG['airtime_version'] = md5($airtime_version.$buildVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getConfig() {
|
public static function getConfig() {
|
||||||
|
|
|
@ -204,10 +204,14 @@ class AudiopreviewController extends Zend_Controller_Action
|
||||||
$elementMap['element_mp3'] = $track['item_id'];
|
$elementMap['element_mp3'] = $track['item_id'];
|
||||||
} elseif (strtolower($mime) === 'audio/ogg') {
|
} elseif (strtolower($mime) === 'audio/ogg') {
|
||||||
$elementMap['element_oga'] = $track['item_id'];
|
$elementMap['element_oga'] = $track['item_id'];
|
||||||
|
} elseif (strtolower($mime) === 'audio/vorbis') {
|
||||||
|
$elementMap['element_oga'] = $track['item_id'];
|
||||||
} elseif (strtolower($mime) === 'audio/mp4') {
|
} elseif (strtolower($mime) === 'audio/mp4') {
|
||||||
$elementMap['element_m4a'] = $track['item_id'];
|
$elementMap['element_m4a'] = $track['item_id'];
|
||||||
} elseif (strtolower($mime) === 'audio/wav') {
|
} elseif (strtolower($mime) === 'audio/wav') {
|
||||||
$elementMap['element_wav'] = $track['item_id'];
|
$elementMap['element_wav'] = $track['item_id'];
|
||||||
|
} elseif (strtolower($mime) === 'audio/x-wav') {
|
||||||
|
$elementMap['element_wav'] = $track['item_id'];
|
||||||
} elseif (strtolower($mime) === 'audio/x-flac') {
|
} elseif (strtolower($mime) === 'audio/x-flac') {
|
||||||
$elementMap['element_flac'] = $track['item_id'];
|
$elementMap['element_flac'] = $track['item_id'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -289,10 +293,14 @@ class AudiopreviewController extends Zend_Controller_Action
|
||||||
$elementMap['element_mp3'] = $track['item_id'];
|
$elementMap['element_mp3'] = $track['item_id'];
|
||||||
} elseif (strtolower($mime) === 'audio/ogg') {
|
} elseif (strtolower($mime) === 'audio/ogg') {
|
||||||
$elementMap['element_oga'] = $track['item_id'];
|
$elementMap['element_oga'] = $track['item_id'];
|
||||||
|
} elseif (strtolower($mime) === 'audio/vorbis') {
|
||||||
|
$elementMap['element_oga'] = $track['item_id'];
|
||||||
} elseif (strtolower($mime) === 'audio/mp4') {
|
} elseif (strtolower($mime) === 'audio/mp4') {
|
||||||
$elementMap['element_m4a'] = $track['item_id'];
|
$elementMap['element_m4a'] = $track['item_id'];
|
||||||
} elseif (strtolower($mime) === 'audio/wav') {
|
} elseif (strtolower($mime) === 'audio/wav') {
|
||||||
$elementMap['element_wav'] = $track['item_id'];
|
$elementMap['element_wav'] = $track['item_id'];
|
||||||
|
} elseif (strtolower($mime) === 'audio/x-wav') {
|
||||||
|
$elementMap['element_wav'] = $track['item_id'];
|
||||||
} elseif (strtolower($mime) === 'audio/x-flac') {
|
} elseif (strtolower($mime) === 'audio/x-flac') {
|
||||||
$elementMap['element_flac'] = $track['item_id'];
|
$elementMap['element_flac'] = $track['item_id'];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
composer install
|
||||||
|
|
||||||
|
git rev-parse HEAD > VERSION
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from nose.tools import *
|
from nose.tools import *
|
||||||
|
from ConfigParser import SafeConfigParser
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
@ -21,8 +22,11 @@ def teardown():
|
||||||
def test_basic():
|
def test_basic():
|
||||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||||
q = multiprocessing.Queue()
|
q = multiprocessing.Queue()
|
||||||
cloud_storage_config_path = '/etc/airtime-saas/production/cloud_storage.conf'
|
#cloud_storage_config_path = '/etc/airtime-saas/production/cloud_storage.conf'
|
||||||
cloud_storage_config = config_file.read_config_file(cloud_storage_config_path)
|
#cloud_storage_config = config_file.read_config_file(cloud_storage_config_path)
|
||||||
|
cloud_storage_config = SafeConfigParser()
|
||||||
|
cloud_storage_config.add_section("current_backend")
|
||||||
|
cloud_storage_config.set("current_backend", "storage_backend", "file")
|
||||||
file_prefix = u''
|
file_prefix = u''
|
||||||
#This actually imports the file into the "./Test Artist" directory.
|
#This actually imports the file into the "./Test Artist" directory.
|
||||||
AnalyzerPipeline.run_analysis(q, DEFAULT_AUDIO_FILE, u'.', filename, file_prefix, cloud_storage_config)
|
AnalyzerPipeline.run_analysis(q, DEFAULT_AUDIO_FILE, u'.', filename, file_prefix, cloud_storage_config)
|
||||||
|
|
Loading…
Reference in New Issue