This commit is contained in:
Duncan Sommerville 2015-01-15 16:33:33 -05:00
parent b144a92c4d
commit 791466b023
26 changed files with 347 additions and 304 deletions

View File

@ -21,6 +21,7 @@ require_once "Timezone.php";
require_once "Auth.php"; require_once "Auth.php";
require_once __DIR__ . '/forms/helpers/ValidationTypes.php'; require_once __DIR__ . '/forms/helpers/ValidationTypes.php';
require_once __DIR__ . '/controllers/plugins/RabbitMqPlugin.php'; require_once __DIR__ . '/controllers/plugins/RabbitMqPlugin.php';
require_once __DIR__ . '/upgrade/Upgrades.php';
require_once (APPLICATION_PATH . "logging/Logging.php"); require_once (APPLICATION_PATH . "logging/Logging.php");
Logging::setLogPath('/var/log/airtime/zendphp.log'); Logging::setLogPath('/var/log/airtime/zendphp.log');
@ -76,6 +77,14 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';"); $view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';");
$view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';"); $view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';");
} }
protected function _initUpgrade() {
Logging::info("Checking if upgrade is needed...");
if (AIRTIME_CODE_VERSION > Application_Model_Preference::GetAirtimeVersion()) {
$upgradeManager = new UpgradeManager();
$upgradeManager->runUpgrades(array(new AirtimeUpgrader252()), (__DIR__ . "/controllers"));
}
}
protected function _initHeadLink() protected function _initHeadLink()
{ {

View File

@ -38,9 +38,6 @@ class Config {
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours']; $CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
$CC_CONFIG['monit_user'] = $values['monit']['monit_user'];
$CC_CONFIG['monit_password'] = $values['monit']['monit_password'];
// Database config // Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser']; $CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass']; $CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];

View File

@ -20,35 +20,25 @@ class UpgradeController extends Zend_Controller_Action
array_push($upgraders, new AirtimeUpgrader254()); array_push($upgraders, new AirtimeUpgrader254());
*/ */
$didWePerformAnUpgrade = false; $didWePerformAnUpgrade = false;
try try {
{ $upgradeManager = new UpgradeManager();
for ($i = 0; $i < count($upgraders); $i++) $didWePerformAnUpgrade = $upgradeManager->runUpgrades($upgraders, __DIR__);
{
$upgrader = $upgraders[$i];
if ($upgrader->checkIfUpgradeSupported())
{
// pass __DIR__ to the upgrades, since __DIR__ returns parent dir of file, not executor
$upgrader->upgrade(__DIR__); //This will throw an exception if the upgrade fails.
$didWePerformAnUpgrade = true;
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("Upgrade to Airtime " . $upgrader->getNewVersion() . " OK<br>");
$i = 0; //Start over, in case the upgrade handlers are not in ascending order.
}
}
if (!$didWePerformAnUpgrade) if (!$didWePerformAnUpgrade) {
{
$this->getResponse() $this->getResponse()
->setHttpResponseCode(200) ->setHttpResponseCode(200)
->appendBody("No upgrade was performed. The current Airtime version is " . AirtimeUpgrader::getCurrentVersion() . ".<br>"); ->appendBody("No upgrade was performed. The current Airtime version is " . AirtimeUpgrader::getCurrentVersion() . ".<br>");
} else {
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("Upgrade to Airtime " . $upgrader->getNewVersion() . " OK<br>");
} }
} }
catch (Exception $e) catch (Exception $e)
{ {
$this->getResponse() $this->getResponse()
->setHttpResponseCode(400) ->setHttpResponseCode(400)
->appendBody($e->getMessage()); ->appendBody($e->getMessage());
} }
} }

View File

@ -28,4 +28,10 @@ class Cache
//$cacheKey = self::createCacheKey($key, $isUserValue, $userId); //$cacheKey = self::createCacheKey($key, $isUserValue, $userId);
return false; //apc_fetch($cacheKey); return false; //apc_fetch($cacheKey);
} }
public static function clear() {
// Disabled on SaaS
// apc_clear_cache('user');
// apc_clear_cache();
}
} }

View File

@ -6,15 +6,15 @@ class Application_Model_Systemstatus
public static function GetMonitStatus($p_ip) public static function GetMonitStatus($p_ip)
{ {
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
$monit_user = $CC_CONFIG['monit_user']; // $monit_user = $CC_CONFIG['monit_user'];
$monit_password = $CC_CONFIG['monit_password']; // $monit_password = $CC_CONFIG['monit_password'];
$url = "http://$p_ip:2812/_status?format=xml"; $url = "http://$p_ip:2812/_status?format=xml";
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password"); // curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password");
//wait a max of 3 seconds before aborting connection attempt //wait a max of 3 seconds before aborting connection attempt
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
$result = curl_exec($ch); $result = curl_exec($ch);

View File

@ -1,5 +1,32 @@
<?php <?php
class UpgradeManager {
/**
* Run a given set of upgrades
*
* @param array $upgraders the upgrades to perform
* @param string $dir the directory containing the upgrade sql
* @return boolean whether or not an upgrade was performed
*/
public function runUpgrades($upgraders, $dir) {
$upgradePerformed;
for($i = 0; $i < count($upgraders); $i++) {
$upgrader = $upgraders[$i];
if ($upgrader->checkIfUpgradeSupported()) {
// pass the given directory to the upgrades, since __DIR__ returns parent dir of file, not executor
$upgrader->upgrade($dir); // This will throw an exception if the upgrade fails.
$upgradePerformed = true;
$i = 0; // Start over, in case the upgrade handlers are not in ascending order.
}
}
return $upgradePerformed;
}
}
abstract class AirtimeUpgrader abstract class AirtimeUpgrader
{ {
/** Versions that this upgrader class can upgrade from (an array of version strings). */ /** Versions that this upgrader class can upgrade from (an array of version strings). */

View File

@ -16,25 +16,25 @@
<div class="form-group"> <div class="form-group">
<label class="control-label" for="dbUser">Username</label> <label class="control-label" for="dbUser">Username</label>
<input required class="form-control" type="text" name="dbUser" id="dbUser" placeholder="Username" <input required class="form-control" type="text" name="dbUser" id="dbUser" placeholder="Username"
value=<?php echo (isset($db) ? $db["dbuser"] : "airtime"); ?>/> value="<?php echo (isset($db) ? $db["dbuser"] : "airtime"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="dbPass">Password</label> <label class="control-label" for="dbPass">Password</label>
<input required class="form-control" type="password" name="dbPass" id="dbPass" placeholder="Password" <input required class="form-control" type="password" name="dbPass" id="dbPass" placeholder="Password"
value=<?php echo (isset($db) ? $db["dbpass"] : "airtime"); ?>/> value="<?php echo (isset($db) ? $db["dbpass"] : "airtime"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="dbName">Name</label> <label class="control-label" for="dbName">Name</label>
<input required class="form-control" type="text" name="dbName" id="dbName" placeholder="Name" <input required class="form-control" type="text" name="dbName" id="dbName" placeholder="Name"
value=<?php echo (isset($db) ? $db["dbname"] : "airtime"); ?>/> value="<?php echo (isset($db) ? $db["dbname"] : "airtime"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="dbHost">Host</label> <label class="control-label" for="dbHost">Host</label>
<input required class="form-control" type="text" name="dbHost" id="dbHost" placeholder="Host" <input required class="form-control" type="text" name="dbHost" id="dbHost" placeholder="Host"
value=<?php echo (isset($db) ? $db["host"] : "localhost"); ?>/> value="<?php echo (isset($db) ? $db["host"] : "localhost"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div> </div>
<input class="form-control" type="hidden" name="dbErr" id="dbErr" aria-describedby="helpBlock"/> <input class="form-control" type="hidden" name="dbErr" id="dbErr" aria-describedby="helpBlock"/>

View File

@ -1,8 +1,4 @@
<?php <?php
$tempConfigPath = "/etc/airtime/airtime.conf.tmp";
if (file_exists($tempConfigPath)) {
rename($tempConfigPath, "/etc/airtime/airtime.conf.bak");
}
?> ?>
<form action="#" role="form" id="finishSettingsForm"> <form action="#" role="form" id="finishSettingsForm">

View File

@ -25,13 +25,13 @@
<div class="form-group"> <div class="form-group">
<label class="control-label" for="rmqUser">Username</label> <label class="control-label" for="rmqUser">Username</label>
<input required class="form-control" type="text" name="rmqUser" id="rmqUser" placeholder="Username" <input required class="form-control" type="text" name="rmqUser" id="rmqUser" placeholder="Username"
value=<?php echo (isset($rmq) ? $rmq["user"] : "airtime"); ?>/> value="<?php echo (isset($rmq) ? $rmq["user"] : "airtime"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="rmqPass">Password</label> <label class="control-label" for="rmqPass">Password</label>
<input class="form-control" type="password" name="rmqPass" id="rmqPass" placeholder="Password" <input class="form-control" type="password" name="rmqPass" id="rmqPass" placeholder="Password"
value=<?php echo (isset($rmq) ? $rmq["password"] : "airtime"); ?>/> value="<?php echo (isset($rmq) ? $rmq["password"] : "airtime"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
<span id="rmqHelpBlock" class="help-block"> <span id="rmqHelpBlock" class="help-block">
You probably want to change this! You probably want to change this!
@ -40,19 +40,19 @@
<div class="form-group"> <div class="form-group">
<label class="control-label" for="rmqHost">Host</label> <label class="control-label" for="rmqHost">Host</label>
<input required class="form-control" type="text" name="rmqHost" id="rmqHost" placeholder="Host" <input required class="form-control" type="text" name="rmqHost" id="rmqHost" placeholder="Host"
value=<?php echo (isset($rmq) ? $rmq["host"] : "127.0.0.1"); ?>/> value="<?php echo (isset($rmq) ? $rmq["host"] : "127.0.0.1"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="rmqPort">Port</label> <label class="control-label" for="rmqPort">Port</label>
<input required class="form-control" type="text" name="rmqPort" id="rmqPort" placeholder="Port" <input required class="form-control" type="text" name="rmqPort" id="rmqPort" placeholder="Port"
value=<?php echo (isset($rmq) ? $rmq["port"] : "5672"); ?>/> value="<?php echo (isset($rmq) ? $rmq["port"] : "5672"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="rmqVHost">Virtual Host</label> <label class="control-label" for="rmqVHost">Virtual Host</label>
<input required class="form-control" type="text" name="rmqVHost" id="rmqVHost" placeholder="VHost" <input required class="form-control" type="text" name="rmqVHost" id="rmqVHost" placeholder="VHost"
value=<?php echo (isset($rmq) ? $rmq["vhost"] : "/airtime"); ?>/> value="<?php echo (isset($rmq) ? $rmq["vhost"] : "/airtime"); ?>" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span> <span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div> </div>
<input class="form-control" type="hidden" name="rmqErr" id="rmqErr" aria-describedby="helpBlock"/> <input class="form-control" type="hidden" name="rmqErr" id="rmqErr" aria-describedby="helpBlock"/>

View File

@ -1,42 +1,42 @@
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# A I R T I M E C O N F I G U R A T I O N ; A I R T I M E C O N F I G U R A T I O N
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ;
# This is an example configuration for Airtime. If you just want to ; This is an example configuration for Airtime. If you just want to
# get started with a basic Airtime setup, or don't know if you should ; get started with a basic Airtime setup, or don't know if you should
# be reconfiguring any of the following values, just rename this file ; be reconfiguring any of the following values, just rename this file
# to 'airtime.conf'. ; to 'airtime.conf'.
# ;
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# G E N E R A L S E T T I N G S ; G E N E R A L S E T T I N G S
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ;
# These settings are used for Airtime's webserver configuration, and ; These settings are used for Airtime's webserver configuration, and
# for general-purpose properties. ; for general-purpose properties.
# ;
# api_key: The API key for your Airtime installation. ; api_key: The API key for your Airtime installation.
# The value is generated the first time you use Airtime. ; The value is generated the first time you use Airtime.
# ;
# web_server_user: The default webserver user. ; web_server_user: The default webserver user.
# The default is www-data. ; The default is www-data.
# ;
# base_url: The host name for your webserver. ; base_url: The host name for your webserver.
# The default is localhost. ; The default is localhost.
# ;
# base_port: The port for your webserver. ; base_port: The port for your webserver.
# The default is 80. ; The default is 80.
# ;
# base_dir: The root directory for your Airtime installation ; base_dir: The root directory for your Airtime installation
# on your webserver, relative to the base_url. ; on your webserver, relative to the base_url.
# The default is /. ; The default is /.
# ;
# cache_ahead_hours: How many hours ahead of time the Airtime playout ; cache_ahead_hours: How many hours ahead of time the Airtime playout
# engine (pypo) should cache scheduled media files. ; engine (pypo) should cache scheduled media files.
# The default is 1. ; The default is 1.
# ;
[general] [general]
api_key = api_key =
web_server_user = www-data web_server_user = www-data
@ -44,99 +44,99 @@ base_url = localhost
base_port = 80 base_port = 80
base_dir = / base_dir = /
cache_ahead_hours = 1 cache_ahead_hours = 1
# ;
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# D A T A B A S E ; D A T A B A S E
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ;
# These settings are used to configure your database connection. ; These settings are used to configure your database connection.
# ;
# host: The hostname of the database server. ; host: The hostname of the database server.
# On a default Airtime installation, set this to localhost. ; On a default Airtime installation, set this to localhost.
# ;
# dbname: The name of the Airtime database. ; dbname: The name of the Airtime database.
# The default is airtime. ; The default is airtime.
# ;
# dbuser: The username for the Airtime database user. ; dbuser: The username for the Airtime database user.
# The default is airtime. ; The default is airtime.
# ;
# dbpass: The password for the Airtime database user. ; dbpass: The password for the Airtime database user.
# The default is airtime. ; The default is airtime.
# ;
[database] [database]
host = localhost host = localhost
dbname = airtime dbname = airtime
dbuser = airtime dbuser = airtime
dbpass = airtime dbpass = airtime
# ;
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# R A B B I T M Q ; R A B B I T M Q
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ;
# These settings are used to configure the RabbitMQ messaging ; These settings are used to configure the RabbitMQ messaging
# configuration for your Airtime installation. ; configuration for your Airtime installation.
# ;
# host: The IP address for the RabbitMQ service. ; host: The IP address for the RabbitMQ service.
# The default is 127.0.0.1. ; The default is 127.0.0.1.
# ;
# port: The port for the RabbitMQ service. ; port: The port for the RabbitMQ service.
# The default is 5672. ; The default is 5672.
# ;
# user: The username for the RabbitMQ user. ; user: The username for the RabbitMQ user.
# The default is airtime. ; The default is airtime.
# ;
# password: The password for the RabbitMQ user. ; password: The password for the RabbitMQ user.
# The default is airtime. ; The default is airtime.
# ;
# vhost: The virtual host for the RabbitMQ service database. ; vhost: The virtual host for the RabbitMQ service database.
# The default is /airtime. ; The default is /airtime.
# ;
[rabbitmq] [rabbitmq]
host = 127.0.0.1 host = 127.0.0.1
port = 5672 port = 5672
user = airtime user = airtime
password = airtime password = airtime
vhost = /airtime vhost = /airtime
# ;
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# M E D I A M O N I T O R ; M E D I A M O N I T O R
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ;
# check_filesystem_events: How long to queue up events performed on the ; check_filesystem_events: How long to queue up events performed on the
# files themselves, in seconds ; files themselves, in seconds
# The default is 5 ; The default is 5
# ;
# check_airtime_events: How long to queue metadata input from airtime, ; check_airtime_events: How long to queue metadata input from airtime,
# in seconds ; in seconds
# The default is 30 ; The default is 30
# ;
# touch_interval: ; touch_interval:
# The default is 5 ; The default is 5
# ;
# chunking_number: ; chunking_number:
# The default is 450 ; The default is 450
# ;
# request_max_wait: The maximum request wait time, in seconds ; request_max_wait: The maximum request wait time, in seconds
# The default is 3.0 ; The default is 3.0
# ;
# rmq_event_wait: The RabbitMQ event wait time, in seconds ; rmq_event_wait: The RabbitMQ event wait time, in seconds
# The default is 0.1 ; The default is 0.1
# ;
# logpath: The media monitor log file path ; logpath: The media monitor log file path
# The default is '/var/log/airtime/media-monitor/media-monitor.log' ; The default is '/var/log/airtime/media-monitor/media-monitor.log'
# ;
# index_path: The media monitor index path ; index_path: The media monitor index path
# The default is '/var/tmp/airtime/media-monitor/last_index' ; The default is '/var/tmp/airtime/media-monitor/last_index'
# ;
[media-monitor] [media-monitor]
check_filesystem_events = 5 check_filesystem_events = 5
check_airtime_events = 30 check_airtime_events = 30
@ -146,129 +146,129 @@ request_max_wait = 3.0
rmq_event_wait = 0.1 rmq_event_wait = 0.1
logpath = '/var/log/airtime/media-monitor/media-monitor.log' logpath = '/var/log/airtime/media-monitor/media-monitor.log'
index_path = '/var/tmp/airtime/media-monitor/last_index' index_path = '/var/tmp/airtime/media-monitor/last_index'
# ;
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# P Y P O ; P Y P O
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ;
# api_client: Set the type of client you are using. ; api_client: Set the type of client you are using.
# Currently supported types: ; Currently supported types:
# 1) 'obp' = Open Broadcast Platform ; 1) 'obp' = Open Broadcast Platform
# 2) 'airtime' ; 2) 'airtime'
# The default is 'airtime' ; The default is 'airtime'
# ;
# cache_dir: The directory for pypo cache files ; cache_dir: The directory for pypo cache files
# The default is '/var/tmp/airtime/pypo/cache/' ; The default is '/var/tmp/airtime/pypo/cache/'
# ;
# file_dir: The directory for pypo media files ; file_dir: The directory for pypo media files
# The default is '/var/tmp/airtime/pypo/files/' ; The default is '/var/tmp/airtime/pypo/files/'
# ;
# tmp_dir: The directory for pypo temp files ; tmp_dir: The directory for pypo temp files
# The default is '/var/tmp/airtime/pypo/tmp/' ; The default is '/var/tmp/airtime/pypo/tmp/'
# ;
# cache_base_dir: The pypo base cache directory ; cache_base_dir: The pypo base cache directory
# The default is '/var/tmp/airtime/pypo/' ; The default is '/var/tmp/airtime/pypo/'
# ;
# log_base_dir: The base directory for Airtime log files ; log_base_dir: The base directory for Airtime log files
# The default is '/var/log/airtime' ; The default is '/var/log/airtime'
# ;
# pypo_log_dir: The directory for pypo log files ; pypo_log_dir: The directory for pypo log files
# The default is '/var/log/airtime/pypo' ; The default is '/var/log/airtime/pypo'
# ;
# liquidsoap_log_dir: The directory for liquidsoap log files ; liquidsoap_log_dir: The directory for liquidsoap log files
# The default is '/var/log/airtime/pypo-liquidsoap' ; The default is '/var/log/airtime/pypo-liquidsoap'
# ;
# ls_host: Liquidsoap connection host ; ls_host: Liquidsoap connection host
# The default is '127.0.0.1' ; The default is '127.0.0.1'
# ;
# ls_port: Liquidsoap connection port ; ls_port: Liquidsoap connection port
# The default is '1234' ; The default is '1234'
# ;
# poll_interval: Poll interval in seconds ; poll_interval: Poll interval in seconds
# ;
# This will rarely need to be changed because any schedule ; This will rarely need to be changed because any schedule
# changes are automatically sent to pypo immediately ; changes are automatically sent to pypo immediately
# This is how often the poll script downloads new schedules ; This is how often the poll script downloads new schedules
# and files from the server in the event that no changes ; and files from the server in the event that no changes
# are made to the schedule ; are made to the schedule
# The default is 3600 ; The default is 3600
# ;
# push_interval: Push interval in seconds ; push_interval: Push interval in seconds
# ;
# This is how often the push script checks whether it has ; This is how often the push script checks whether it has
# something new to push to liquidsoap ; something new to push to liquidsoap
# The default is 1 ; The default is 1
# ;
# cue_style: Can be set to 'pre' or 'otf' ; cue_style: Can be set to 'pre' or 'otf'
# 'pre' cues while playlist preparation ; 'pre' cues while playlist preparation
# 'otf' (on the fly) cues while loading into ls ; 'otf' (on the fly) cues while loading into ls
# (needs the post_processor patch) ; (needs the post_processor patch)
# The default is 'pre' ; The default is 'pre'
# ;
# record_bitrate: The bitrate for recordings ; record_bitrate: The bitrate for recordings
# The default is 256 ; The default is 256
# ;
# record_samplerate: The samplerate for recordings ; record_samplerate: The samplerate for recordings
# The default is 44100 ; The default is 44100
# ;
# record_channels: The number of channels for recordings ; record_channels: The number of channels for recordings
# The default is 2 ; The default is 2
# ;
# record_sample_size: The sample size for recordings ; record_sample_size: The sample size for recordings
# The default is 16 ; The default is 16
# ;
# record_file_type: Can be either ogg|mp3, mp3 recording requires ; record_file_type: Can be either ogg|mp3, mp3 recording requires
# installation of the package "lame" ; installation of the package "lame"
# The default is ogg ; The default is ogg
# ;
# base_recorded_files: Base path to store recordered shows at ; base_recorded_files: Base path to store recordered shows at
# The default is '/var/tmp/airtime/show-recorder/' ; The default is '/var/tmp/airtime/show-recorder/'
# ;
[pypo] [pypo]
api_client = 'airtime' api_client = 'airtime'
# ---------- Cache directories - !! Include trailing slash !! ---------- ; ---------- Cache directories - !! Include trailing slash !! ----------
cache_dir = '/var/tmp/airtime/pypo/cache/' cache_dir = '/var/tmp/airtime/pypo/cache/'
file_dir = '/var/tmp/airtime/pypo/files/' file_dir = '/var/tmp/airtime/pypo/files/'
tmp_dir = '/var/tmp/airtime/pypo/tmp/' tmp_dir = '/var/tmp/airtime/pypo/tmp/'
# ------- Setup directories - !! Don't include trailing slash !! ------- ; ------- Setup directories - !! Don't include trailing slash !! -------
cache_base_dir = '/var/tmp/airtime/pypo' cache_base_dir = '/var/tmp/airtime/pypo'
log_base_dir = '/var/log/airtime' log_base_dir = '/var/log/airtime'
pypo_log_dir = '/var/log/airtime/pypo' pypo_log_dir = '/var/log/airtime/pypo'
liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap' liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap'
# ------------------------ Liquidsoap Settings ------------------------- ; ------------------------ Liquidsoap Settings -------------------------
ls_host = '127.0.0.1' ls_host = '127.0.0.1'
ls_port = '1234' ls_port = '1234'
# -------------------------- Pypo Preferences -------------------------- ; -------------------------- Pypo Preferences --------------------------
poll_interval = 3600 poll_interval = 3600
push_interval = 1 push_interval = 1
cue_style = 'pre' cue_style = 'pre'
# ---------------------- Recorded Audio Settings ----------------------- ; ---------------------- Recorded Audio Settings -----------------------
record_bitrate = 256 record_bitrate = 256
record_samplerate = 44100 record_samplerate = 44100
record_channels = 2 record_channels = 2
record_sample_size = 16 record_sample_size = 16
record_file_type = 'ogg' record_file_type = 'ogg'
base_recorded_files = '/var/tmp/airtime/show-recorder/' base_recorded_files = '/var/tmp/airtime/show-recorder/'
# ;
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# S O U N D C L O U D ; S O U N D C L O U D
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
# ;
# connection_retries: The number of times to retry the connection to ; connection_retries: The number of times to retry the connection to
# Soundcloud. ; Soundcloud.
# The default is 3. ; The default is 3.
# ;
# time_between_retries: The time between connection retries, in seconds. ; time_between_retries: The time between connection retries, in seconds.
# The default is 60. ; The default is 60.
# ;
[soundcloud] [soundcloud]
connection_retries = 3 connection_retries = 3
time_between_retries = 60 time_between_retries = 60
# ;
# ---------------------------------------------------------------------- ; ----------------------------------------------------------------------

View File

@ -15,7 +15,7 @@ require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/om/BaseCc
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcMusicDirsPeer.php"); require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcMusicDirsPeer.php");
/** /**
* User: sourcefabric * Author: sourcefabric
* Date: 08/12/14 * Date: 08/12/14
* *
* Class MediaSetup * Class MediaSetup
@ -65,6 +65,15 @@ class MediaSetup extends Setup {
$message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!"; $message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!";
$errors[] = "ERR"; $errors[] = "ERR";
} }
/*
* If we're upgrading from an old Airtime instance (pre-2.5.2) we rename their old
* airtime.conf to airtime.conf.tmp during the setup process. Now that we're done,
* we can rename it to airtime.conf.bak to avoid confusion.
*/
if (file_exists(self::AIRTIME_CONF_PATH . ".tmp")) {
rename(self::AIRTIME_CONF_PATH . ".tmp", self::AIRTIME_CONF_PATH . ".bak");
}
} else { } else {
$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!"; $message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
$errors[] = "ERR"; $errors[] = "ERR";

View File

@ -18,7 +18,7 @@ if [ "$1" = "--enable" ]; then
echo "Changing ownership to user $1" echo "Changing ownership to user $1"
chmod -R a+rw /var/log/airtime/pypo chmod -R a+rw /var/log/airtime/pypo
chmod a+r /etc/airtime/pypo.cfg chmod a+r /etc/airtime/airtime.conf
chown -Rv $user:$user /var/tmp/airtime/pypo/ chown -Rv $user:$user /var/tmp/airtime/pypo/
chmod -v a+r /etc/airtime/api_client.cfg chmod -v a+r /etc/airtime/api_client.cfg
elif [ "$1" = "--disable" ]; then elif [ "$1" = "--disable" ]; then
@ -26,7 +26,7 @@ elif [ "$1" = "--disable" ]; then
user="pypo" user="pypo"
echo "Changing ownership to user $1" echo "Changing ownership to user $1"
chmod 644 /etc/airtime/pypo.cfg chmod 644 /etc/airtime/airtime.conf
chown -Rv $user:$user /var/tmp/airtime/pypo/ chown -Rv $user:$user /var/tmp/airtime/pypo/
chmod -v a+r /etc/airtime/api_client.cfg chmod -v a+r /etc/airtime/api_client.cfg

11
install
View File

@ -406,6 +406,7 @@ verbose "...Done"
for i in /etc/init/airtime*; do for i in /etc/init/airtime*; do
chmod 644 $i chmod 644 $i
sed -i "s/WEB_USER/${web_user}/g" $i sed -i "s/WEB_USER/${web_user}/g" $i
mv $i ${i%.template}
done done
initctl reload-configuration initctl reload-configuration
@ -414,18 +415,8 @@ if [ ! -d /var/log/airtime ]; then
loud "\n-----------------------------------------------------" loud "\n-----------------------------------------------------"
loud " * Installing Log Files * " loud " * Installing Log Files * "
loud "-----------------------------------------------------" loud "-----------------------------------------------------"
verbose "\n * Creating /var/log/airtime..."
mkdir -p /var/log/airtime
mkdir -p /var/log/airtime/media-monitor
mkdir -p /var/log/airtime/pypo
mkdir -p /var/log/airtime/pypo-liquidsoap
verbose "\n * Creating /var/tmp/airtime..." verbose "\n * Creating /var/tmp/airtime..."
mkdir -p /var/tmp/airtime/media-monitor
mkdir -p /var/tmp/airtime/pypo/cache/
mkdir -p /var/tmp/airtime/pypo/files/
mkdir -p /var/tmp/airtime/pypo/tmp/
mkdir -p /var/tmp/airtime/show-recorder/ mkdir -p /var/tmp/airtime/show-recorder/
verbose "\n * Copying logrotate files..." verbose "\n * Copying logrotate files..."

View File

@ -11,7 +11,6 @@ libtaglib-ocaml
libao-ocaml libao-ocaml
libmad-ocaml libmad-ocaml
ecasound ecasound
libesd0
libportaudio2 libportaudio2
libsamplerate0 libsamplerate0
libvo-aacenc0 libvo-aacenc0
@ -34,11 +33,9 @@ pwgen
libfaad2 libfaad2
php-apc php-apc
libmp3lame-dev
lame lame
coreutils coreutils
sourcefabric-keyring
silan silan
libopus0 libopus0

View File

@ -11,7 +11,6 @@ libtaglib-ocaml
libao-ocaml libao-ocaml
libmad-ocaml libmad-ocaml
ecasound ecasound
libesd0
libportaudio2 libportaudio2
libsamplerate0 libsamplerate0
@ -33,7 +32,6 @@ pwgen
libfaad2 libfaad2
php-apc php-apc
libmp3lame-dev
lame lame
libzend-framework-php libzend-framework-php
@ -56,6 +54,5 @@ liquidsoap-plugin-taglib
liquidsoap-plugin-voaacenc liquidsoap-plugin-voaacenc
liquidsoap-plugin-vorbis liquidsoap-plugin-vorbis
sourcefabric-keyring
silan silan
libopus0 libopus0

View File

@ -11,7 +11,6 @@ libtaglib-ocaml
libao-ocaml libao-ocaml
libmad-ocaml libmad-ocaml
ecasound ecasound
libesd0
libportaudio2 libportaudio2
libsamplerate0 libsamplerate0
@ -33,7 +32,6 @@ pwgen
libfaad2 libfaad2
php-apc php-apc
libmp3lame-dev
lame lame
libzend-framework-php libzend-framework-php
@ -54,6 +52,5 @@ liquidsoap-plugin-taglib
liquidsoap-plugin-voaacenc liquidsoap-plugin-voaacenc
liquidsoap-plugin-vorbis liquidsoap-plugin-vorbis
sourcefabric-keyring
silan silan
libopus0 libopus0

View File

@ -21,7 +21,7 @@ class AirtimeInstance(object):
def root_make(cls, name, root): def root_make(cls, name, root):
cfg = { cfg = {
'api_client' : join(root, 'etc/airtime/api_client.cfg'), 'api_client' : join(root, 'etc/airtime/api_client.cfg'),
'media_monitor' : join(root, 'etc/airtime/media-monitor.cfg'), 'media_monitor' : join(root, 'etc/airtime/airtime.conf'),
} }
return cls(name, root, cfg) return cls(name, root, cfg)

View File

@ -12,7 +12,20 @@ if '--no-init-script' in sys.argv:
data_files = [] data_files = []
sys.argv.remove('--no-init-script') # super hax sys.argv.remove('--no-init-script') # super hax
else: else:
data_files = [('/etc/init', ['install/airtime-media-monitor.conf'])] media_monitor_files = []
mm2_files = []
for root, dirnames, filenames in os.walk('media-monitor'):
for filename in filenames:
media_monitor_files.append(os.path.join(root, filename))
for root, dirnames, filenames in os.walk('media-monitor2'):
for filename in filenames:
mm2_files.append(os.path.join(root, filename))
data_files = [
('/etc/init', ['install/airtime-media-monitor.conf.template']),
('/var/log/airtime/media-monitor', []),
('/var/tmp/airtime/media-monitor', []),
]
print data_files print data_files
setup(name='airtime-media-monitor', setup(name='airtime-media-monitor',

View File

@ -3,9 +3,9 @@ import telnetlib
import sys import sys
try: try:
config = ConfigObj('/etc/airtime/pypo.cfg') config = ConfigObj('/etc/airtime/airtime.conf')
LS_HOST = config['ls_host'] LS_HOST = config['pypo']['ls_host']
LS_PORT = config['ls_port'] LS_PORT = config['pypo']['ls_port']
tn = telnetlib.Telnet(LS_HOST, LS_PORT) tn = telnetlib.Telnet(LS_HOST, LS_PORT)
tn.write("master_harbor.stop\n") tn.write("master_harbor.stop\n")
@ -14,6 +14,6 @@ try:
tn.read_all() tn.read_all()
except Exception, e: except Exception, e:
print 'Error loading config file: %s' % e print('Error loading config file: %s', e)
sys.exit() sys.exit()

View File

@ -59,7 +59,7 @@ LogWriter.override_std_err(logger)
# loading config file # loading config file
try: try:
config = ConfigObj('/etc/airtime/pypo.cfg') config = ConfigObj('/etc/airtime/airtime.conf')
except Exception, e: except Exception, e:
logger.error('Error loading config file: %s', e) logger.error('Error loading config file: %s', e)

View File

@ -34,7 +34,7 @@ def api_client(logger):
# loading config file # loading config file
try: try:
config = ConfigObj('/etc/airtime/pypo.cfg') config = ConfigObj('/etc/airtime/airtime.conf')
except Exception, e: except Exception, e:
print ('Error loading config file: %s', e) print ('Error loading config file: %s', e)
sys.exit() sys.exit()
@ -73,18 +73,18 @@ class ShowRecorder(Thread):
filename = self.start_time filename = self.start_time
filename = filename.replace(" ", "-") filename = filename.replace(" ", "-")
if config["record_file_type"] in ["mp3", "ogg"]: if config["pypo"]["record_file_type"] in ["mp3", "ogg"]:
filetype = config["record_file_type"] filetype = config["pypo"]["record_file_type"]
else: else:
filetype = "ogg"; filetype = "ogg";
joined_path = os.path.join(config["base_recorded_files"], filename) joined_path = os.path.join(config["base_recorded_files"], filename)
filepath = "%s.%s" % (joined_path, filetype) filepath = "%s.%s" % (joined_path, filetype)
br = config["record_bitrate"] br = config["pypo"]["record_bitrate"]
sr = config["record_samplerate"] sr = config["pypo"]["record_samplerate"]
c = config["record_channels"] c = config["pypo"]["record_channels"]
ss = config["record_sample_size"] ss = config["pypo"]["record_sample_size"]
#-f:16,2,44100 #-f:16,2,44100
#-b:256 #-b:256

View File

@ -12,7 +12,21 @@ if '--no-init-script' in sys.argv:
data_files = [] data_files = []
sys.argv.remove('--no-init-script') # super hax sys.argv.remove('--no-init-script') # super hax
else: else:
data_files = [('/etc/init', ['install/airtime-playout.conf', 'install/airtime-liquidsoap.conf'])] pypo_files = []
for root, dirnames, filenames in os.walk('pypo'):
for filename in filenames:
pypo_files.append(os.path.join(root, filename))
data_files = [
('/etc/init', ['install/airtime-playout.conf.template']),
('/etc/init', ['install/airtime-liquidsoap.conf.template']),
('/var/log/airtime/pypo', []),
('/var/log/airtime/pypo/liquidsoap', []),
('/var/tmp/airtime/pypo', []),
('/var/tmp/airtime/pypo/cache', []),
('/var/tmp/airtime/pypo/files', []),
('/var/tmp/airtime/pypo/tmp', []),
]
print data_files print data_files
setup(name='airtime-playout', setup(name='airtime-playout',

View File

@ -52,14 +52,16 @@ FILES=(
"/etc/init/airtime*" "/etc/init/airtime*"
"/usr/bin/airtime*" "/usr/bin/airtime*"
"/etc/apache2/sites-available/airtime*" "/etc/apache2/sites-available/airtime*"
"pip airtime-playout" "/etc/apache2/sites-enabled/airtime*"
"pip airtime-media-monitor"
) )
echo -e "The following files, directories, and services will be removed:\n" echo -e "The following files, directories, and services will be removed:\n"
for i in ${FILES[*]}; do for i in ${FILES[*]}; do
echo $i echo $i
done done
echo "pip airtime-playout"
echo "pip airtime-media-monitor"
echo -e "\nIf your web root is not listed, you will need to manually remove it." echo -e "\nIf your web root is not listed, you will need to manually remove it."
echo -e "\nThis will *permanently* remove Airtime and all related files from your computer. \ echo -e "\nThis will *permanently* remove Airtime and all related files from your computer. \
@ -84,19 +86,17 @@ if [ -f /etc/airtime/airtime.conf ]; then
removeRabbitmqAirtimeSettings removeRabbitmqAirtimeSettings
fi fi
rm -rf /etc/airtime for i in ${FILES[*]}; do
rm -rf /var/log/airtime/ rm -rf $i
rm -rf /usr/lib/airtime/ done
rm -rf /usr/share/airtime echo -e "\Do you want to drop your current Airtime database? (Y/n): \c"
read IN
rm -f /etc/init/airtime* if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
rm -f /usr/bin/airtime* echo -e "\nDropping Airtime database..."
dropAirtimeDatabase
rm -f /etc/apache2/sites-enabled/airtime* fi
rm -f /etc/apache2/sites-available/airtime*
dropAirtimeDatabase
pip uninstall -y airtime-playout airtime-media-monitor pip uninstall -y airtime-playout airtime-media-monitor
service apache2 restart
echo "...Done" echo "...Done"