2011-09-22 17:47:24 +02:00
|
|
|
<?php
|
2012-10-25 18:25:02 +02:00
|
|
|
date_default_timezone_set("UTC");
|
|
|
|
|
2011-09-22 17:47:24 +02:00
|
|
|
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
|
|
|
|
|
|
|
// Name of the web server user
|
|
|
|
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
|
|
|
|
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
|
|
|
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
|
|
|
|
|
|
|
|
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
|
|
|
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
|
|
|
|
|
|
|
// Database config
|
|
|
|
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
|
|
|
|
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
|
|
|
|
$CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
|
|
|
|
$CC_CONFIG['dsn']['phptype'] = 'pgsql';
|
|
|
|
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
|
|
|
|
|
|
|
|
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
|
|
|
|
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
|
|
|
|
|
|
|
|
require_once($CC_CONFIG['phpDir'].'/application/configs/constants.php');
|
|
|
|
require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
|
|
|
|
|
2011-09-22 21:53:21 +02:00
|
|
|
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
2011-09-22 17:47:24 +02:00
|
|
|
|
2012-09-17 20:17:22 +02:00
|
|
|
// Ensure library/ is on include_path
|
|
|
|
set_include_path(implode(PATH_SEPARATOR, array(
|
|
|
|
get_include_path(),
|
|
|
|
realpath($CC_CONFIG['phpDir'] . '/library')
|
|
|
|
)));
|
2012-04-05 08:22:21 +02:00
|
|
|
|
2013-05-27 23:02:34 +02:00
|
|
|
require_once($CC_CONFIG['phpDir'].'/application/common/Database.php');
|
2011-09-22 17:47:24 +02:00
|
|
|
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
|
|
|
|
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
|
|
|
|
require_once($CC_CONFIG['phpDir'].'/application/models/MusicDir.php');
|
2012-09-17 21:24:02 +02:00
|
|
|
require_once($CC_CONFIG['phpDir'].'/application/common/OsPath.php');
|
2011-09-22 17:47:24 +02:00
|
|
|
|
|
|
|
set_include_path($CC_CONFIG['phpDir'].'/library' . PATH_SEPARATOR . get_include_path());
|
|
|
|
require_once($CC_CONFIG['phpDir'].'/application/models/Soundcloud.php');
|
|
|
|
|
|
|
|
set_include_path($CC_CONFIG['phpDir']."/application/models" . PATH_SEPARATOR . get_include_path());
|
|
|
|
require_once($CC_CONFIG['phpDir']."/library/propel/runtime/lib/Propel.php");
|
|
|
|
Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf.php");
|
|
|
|
|
2012-04-05 08:22:21 +02:00
|
|
|
require_once 'propel/runtime/lib/Propel.php';
|
|
|
|
Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf-production.php");
|
2011-09-22 17:47:24 +02:00
|
|
|
|
|
|
|
if(count($argv) != 2){
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$id = $argv[1];
|
2013-05-27 23:02:34 +02:00
|
|
|
|
|
|
|
$file = Application_Model_StoredFile::RecallById($id);
|
2011-09-22 17:47:24 +02:00
|
|
|
// set id with -2 which is indicator for processing
|
2011-09-29 16:30:40 +02:00
|
|
|
$file->setSoundCloudFileId(SOUNDCLOUD_PROGRESS);
|
2011-09-22 17:47:24 +02:00
|
|
|
$file->uploadToSoundCloud();
|
|
|
|
|