parent
b3beab1dbd
commit
9e01e389ea
|
@ -11,48 +11,24 @@ define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
|
||||||
define('AIRTIME_REST_VERSION', '1.1');
|
define('AIRTIME_REST_VERSION', '1.1');
|
||||||
|
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$values = load_airtime_config();
|
|
||||||
|
|
||||||
$CC_CONFIG = array(
|
$CC_CONFIG = array(
|
||||||
|
|
||||||
// Name of the web server user
|
|
||||||
'webServerUser' => $values['general']['web_server_user'],
|
|
||||||
|
|
||||||
'rabbitmq' => $values['rabbitmq'],
|
|
||||||
|
|
||||||
'baseFilesDir' => $values['general']['base_files_dir'],
|
|
||||||
// main directory for storing binary media files
|
|
||||||
'storageDir' => $values['general']['base_files_dir']."/stor",
|
|
||||||
|
|
||||||
// Database config
|
|
||||||
'dsn' => array(
|
|
||||||
'username' => $values['database']['dbuser'],
|
|
||||||
'password' => $values['database']['dbpass'],
|
|
||||||
'hostspec' => $values['database']['host'],
|
|
||||||
'phptype' => 'pgsql',
|
|
||||||
'database' => $values['database']['dbname']),
|
|
||||||
|
|
||||||
// prefix for table names in the database
|
// prefix for table names in the database
|
||||||
'tblNamePrefix' => 'cc_',
|
'tblNamePrefix' => 'cc_',
|
||||||
|
|
||||||
/* ================================================ storage configuration */
|
/* ================================================ storage configuration */
|
||||||
|
|
||||||
'apiKey' => array($values['general']['api_key']),
|
|
||||||
'apiPath' => '/api/',
|
|
||||||
|
|
||||||
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
|
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
|
||||||
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
|
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
|
||||||
|
|
||||||
'soundcloud-connection-retries' => $values['soundcloud']['connection_retries'],
|
|
||||||
'soundcloud-connection-wait' => $values['soundcloud']['time_between_retries'],
|
|
||||||
|
|
||||||
"rootDir" => __DIR__."/../..",
|
"rootDir" => __DIR__."/../..",
|
||||||
'pearPath' => dirname(__FILE__).'/../../library/pear',
|
'pearPath' => dirname(__FILE__).'/../../library/pear',
|
||||||
'zendPath' => dirname(__FILE__).'/../../library/Zend',
|
'zendPath' => dirname(__FILE__).'/../../library/Zend',
|
||||||
'phingPath' => dirname(__FILE__).'/../../library/phing',
|
'phingPath' => dirname(__FILE__).'/../../library/phing'
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$CC_CONFIG = Config::loadConfig($CC_CONFIG);
|
||||||
|
|
||||||
// Add database table names
|
// Add database table names
|
||||||
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
|
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
|
||||||
$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'].'playlistcontents';
|
$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'].'playlistcontents';
|
||||||
|
@ -83,20 +59,17 @@ set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath']
|
||||||
.PATH_SEPARATOR.$CC_CONFIG['zendPath']
|
.PATH_SEPARATOR.$CC_CONFIG['zendPath']
|
||||||
.PATH_SEPARATOR.$old_include_path);
|
.PATH_SEPARATOR.$old_include_path);
|
||||||
|
|
||||||
function load_airtime_config(){
|
|
||||||
$ini_array = parse_ini_file('/etc/airtime/airtime.conf', true);
|
|
||||||
return $ini_array;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
public static function reload_config() {
|
public static function loadConfig($CC_CONFIG) {
|
||||||
global $CC_CONFIG;
|
|
||||||
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||||
|
|
||||||
// Name of the web server user
|
// Name of the web server user
|
||||||
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
|
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
|
||||||
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
|
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
|
||||||
|
|
||||||
|
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
||||||
|
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
||||||
|
|
||||||
$CC_CONFIG['baseFilesDir'] = $values['general']['base_files_dir'];
|
$CC_CONFIG['baseFilesDir'] = $values['general']['base_files_dir'];
|
||||||
// main directory for storing binary media files
|
// main directory for storing binary media files
|
||||||
$CC_CONFIG['storageDir'] = $values['general']['base_files_dir']."/stor";
|
$CC_CONFIG['storageDir'] = $values['general']['base_files_dir']."/stor";
|
||||||
|
@ -111,5 +84,7 @@ class Config {
|
||||||
|
|
||||||
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
|
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
|
||||||
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
|
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
|
||||||
|
|
||||||
|
return $CC_CONFIG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1513,7 +1513,8 @@ class StoredFile {
|
||||||
public function getFileUrl()
|
public function getFileUrl()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
return $this->gunid.".".$this->getFileExtension();
|
return "http://$CC_CONFIG[baseUrl]:$CC_CONFIG[basePort]/".$this->gunid.".".$this->getFileExtension();
|
||||||
|
//return $CC_CONFIG["base_url"]..$this->gunid.".".$this->getFileExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,6 +16,8 @@ api_key = AAA
|
||||||
web_server_user = www-data
|
web_server_user = www-data
|
||||||
airtime_dir = x
|
airtime_dir = x
|
||||||
base_files_dir = x
|
base_files_dir = x
|
||||||
|
base_url = localhost
|
||||||
|
base_port = 80
|
||||||
|
|
||||||
[soundcloud]
|
[soundcloud]
|
||||||
connection_retries = 3
|
connection_retries = 3
|
||||||
|
|
|
@ -61,7 +61,7 @@ AirtimeInstall::InstallBinaries();
|
||||||
|
|
||||||
echo "* Initializing INI files".PHP_EOL;
|
echo "* Initializing INI files".PHP_EOL;
|
||||||
AirtimeIni::UpdateIniFiles();
|
AirtimeIni::UpdateIniFiles();
|
||||||
Config::reload_config();
|
Config::loadConfig();
|
||||||
|
|
||||||
echo "* Creating default storage directory".PHP_EOL;
|
echo "* Creating default storage directory".PHP_EOL;
|
||||||
AirtimeInstall::InstallStorageDirectory();
|
AirtimeInstall::InstallStorageDirectory();
|
||||||
|
|
|
@ -220,9 +220,9 @@ class AirTimeApiClient(ApiClientInterface):
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
src = "http://%s:%s/%s/%s" % \
|
#src = "http://%s:%s/%s/%s" % \
|
||||||
(self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["get_media_url"])
|
#(self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["get_media_url"])
|
||||||
src = src.replace("%%file%%", uri)
|
src = uri
|
||||||
logger.info("try to download from %s to %s", src, dst)
|
logger.info("try to download from %s to %s", src, dst)
|
||||||
src = src.replace("%%api_key%%", self.config["api_key"])
|
src = src.replace("%%api_key%%", self.config["api_key"])
|
||||||
# check if file exists already before downloading again
|
# check if file exists already before downloading again
|
||||||
|
|
Loading…
Reference in New Issue