Fixes for code review https://github.com/sourcefabric/Airtime/pull/84
This commit is contained in:
parent
b144a92c4d
commit
791466b023
|
@ -21,6 +21,7 @@ require_once "Timezone.php";
|
|||
require_once "Auth.php";
|
||||
require_once __DIR__ . '/forms/helpers/ValidationTypes.php';
|
||||
require_once __DIR__ . '/controllers/plugins/RabbitMqPlugin.php';
|
||||
require_once __DIR__ . '/upgrade/Upgrades.php';
|
||||
|
||||
require_once (APPLICATION_PATH . "logging/Logging.php");
|
||||
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 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()
|
||||
{
|
||||
|
|
|
@ -38,9 +38,6 @@ class Config {
|
|||
|
||||
$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
|
||||
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
|
||||
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
|
||||
|
|
|
@ -20,35 +20,25 @@ class UpgradeController extends Zend_Controller_Action
|
|||
array_push($upgraders, new AirtimeUpgrader254());
|
||||
*/
|
||||
$didWePerformAnUpgrade = false;
|
||||
try
|
||||
{
|
||||
for ($i = 0; $i < count($upgraders); $i++)
|
||||
{
|
||||
$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.
|
||||
}
|
||||
}
|
||||
try {
|
||||
$upgradeManager = new UpgradeManager();
|
||||
$didWePerformAnUpgrade = $upgradeManager->runUpgrades($upgraders, __DIR__);
|
||||
|
||||
if (!$didWePerformAnUpgrade)
|
||||
{
|
||||
if (!$didWePerformAnUpgrade) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody("No upgrade was performed. The current Airtime version is " . AirtimeUpgrader::getCurrentVersion() . ".<br>");
|
||||
->setHttpResponseCode(200)
|
||||
->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)
|
||||
{
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
->appendBody($e->getMessage());
|
||||
->setHttpResponseCode(400)
|
||||
->appendBody($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,4 +28,10 @@ class Cache
|
|||
//$cacheKey = self::createCacheKey($key, $isUserValue, $userId);
|
||||
return false; //apc_fetch($cacheKey);
|
||||
}
|
||||
|
||||
public static function clear() {
|
||||
// Disabled on SaaS
|
||||
// apc_clear_cache('user');
|
||||
// apc_clear_cache();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,15 +6,15 @@ class Application_Model_Systemstatus
|
|||
public static function GetMonitStatus($p_ip)
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$monit_user = $CC_CONFIG['monit_user'];
|
||||
$monit_password = $CC_CONFIG['monit_password'];
|
||||
// $monit_user = $CC_CONFIG['monit_user'];
|
||||
// $monit_password = $CC_CONFIG['monit_password'];
|
||||
|
||||
$url = "http://$p_ip:2812/_status?format=xml";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
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
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
|
||||
$result = curl_exec($ch);
|
||||
|
|
|
@ -1,5 +1,32 @@
|
|||
<?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
|
||||
{
|
||||
/** Versions that this upgrader class can upgrade from (an array of version strings). */
|
||||
|
|
|
@ -16,25 +16,25 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label" for="dbUser">Username</label>
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="dbPass">Password</label>
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="dbName">Name</label>
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="dbHost">Host</label>
|
||||
<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>
|
||||
</div>
|
||||
<input class="form-control" type="hidden" name="dbErr" id="dbErr" aria-describedby="helpBlock"/>
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
$tempConfigPath = "/etc/airtime/airtime.conf.tmp";
|
||||
if (file_exists($tempConfigPath)) {
|
||||
rename($tempConfigPath, "/etc/airtime/airtime.conf.bak");
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="#" role="form" id="finishSettingsForm">
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label" for="rmqUser">Username</label>
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="rmqPass">Password</label>
|
||||
<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 id="rmqHelpBlock" class="help-block">
|
||||
You probably want to change this!
|
||||
|
@ -40,19 +40,19 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label" for="rmqHost">Host</label>
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="rmqPort">Port</label>
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="rmqVHost">Virtual Host</label>
|
||||
<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>
|
||||
</div>
|
||||
<input class="form-control" type="hidden" name="rmqErr" id="rmqErr" aria-describedby="helpBlock"/>
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
# ----------------------------------------------------------------------
|
||||
# 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
|
||||
# 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
|
||||
# to 'airtime.conf'.
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
; ----------------------------------------------------------------------
|
||||
; 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
|
||||
; 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
|
||||
; to 'airtime.conf'.
|
||||
;
|
||||
; ----------------------------------------------------------------------
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# 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
|
||||
# for general-purpose properties.
|
||||
#
|
||||
# api_key: The API key for your Airtime installation.
|
||||
# The value is generated the first time you use Airtime.
|
||||
#
|
||||
# web_server_user: The default webserver user.
|
||||
# The default is www-data.
|
||||
#
|
||||
# base_url: The host name for your webserver.
|
||||
# The default is localhost.
|
||||
#
|
||||
# base_port: The port for your webserver.
|
||||
# The default is 80.
|
||||
#
|
||||
# base_dir: The root directory for your Airtime installation
|
||||
# on your webserver, relative to the base_url.
|
||||
# The default is /.
|
||||
#
|
||||
# cache_ahead_hours: How many hours ahead of time the Airtime playout
|
||||
# engine (pypo) should cache scheduled media files.
|
||||
# The default is 1.
|
||||
#
|
||||
; ----------------------------------------------------------------------
|
||||
; 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
|
||||
; for general-purpose properties.
|
||||
;
|
||||
; api_key: The API key for your Airtime installation.
|
||||
; The value is generated the first time you use Airtime.
|
||||
;
|
||||
; web_server_user: The default webserver user.
|
||||
; The default is www-data.
|
||||
;
|
||||
; base_url: The host name for your webserver.
|
||||
; The default is localhost.
|
||||
;
|
||||
; base_port: The port for your webserver.
|
||||
; The default is 80.
|
||||
;
|
||||
; base_dir: The root directory for your Airtime installation
|
||||
; on your webserver, relative to the base_url.
|
||||
; The default is /.
|
||||
;
|
||||
; cache_ahead_hours: How many hours ahead of time the Airtime playout
|
||||
; engine (pypo) should cache scheduled media files.
|
||||
; The default is 1.
|
||||
;
|
||||
[general]
|
||||
api_key =
|
||||
web_server_user = www-data
|
||||
|
@ -44,99 +44,99 @@ base_url = localhost
|
|||
base_port = 80
|
||||
base_dir = /
|
||||
cache_ahead_hours = 1
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
;
|
||||
; ----------------------------------------------------------------------
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# D A T A B A S E
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
# These settings are used to configure your database connection.
|
||||
#
|
||||
# host: The hostname of the database server.
|
||||
# On a default Airtime installation, set this to localhost.
|
||||
#
|
||||
# dbname: The name of the Airtime database.
|
||||
# The default is airtime.
|
||||
#
|
||||
# dbuser: The username for the Airtime database user.
|
||||
# The default is airtime.
|
||||
#
|
||||
# dbpass: The password for the Airtime database user.
|
||||
# The default is airtime.
|
||||
#
|
||||
; ----------------------------------------------------------------------
|
||||
; D A T A B A S E
|
||||
; ----------------------------------------------------------------------
|
||||
;
|
||||
; These settings are used to configure your database connection.
|
||||
;
|
||||
; host: The hostname of the database server.
|
||||
; On a default Airtime installation, set this to localhost.
|
||||
;
|
||||
; dbname: The name of the Airtime database.
|
||||
; The default is airtime.
|
||||
;
|
||||
; dbuser: The username for the Airtime database user.
|
||||
; The default is airtime.
|
||||
;
|
||||
; dbpass: The password for the Airtime database user.
|
||||
; The default is airtime.
|
||||
;
|
||||
[database]
|
||||
host = localhost
|
||||
dbname = airtime
|
||||
dbuser = airtime
|
||||
dbpass = airtime
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
;
|
||||
; ----------------------------------------------------------------------
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# R A B B I T M Q
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
# These settings are used to configure the RabbitMQ messaging
|
||||
# configuration for your Airtime installation.
|
||||
#
|
||||
# host: The IP address for the RabbitMQ service.
|
||||
# The default is 127.0.0.1.
|
||||
#
|
||||
# port: The port for the RabbitMQ service.
|
||||
# The default is 5672.
|
||||
#
|
||||
# user: The username for the RabbitMQ user.
|
||||
# The default is airtime.
|
||||
#
|
||||
# password: The password for the RabbitMQ user.
|
||||
# The default is airtime.
|
||||
#
|
||||
# vhost: The virtual host for the RabbitMQ service database.
|
||||
# The default is /airtime.
|
||||
#
|
||||
; ----------------------------------------------------------------------
|
||||
; R A B B I T M Q
|
||||
; ----------------------------------------------------------------------
|
||||
;
|
||||
; These settings are used to configure the RabbitMQ messaging
|
||||
; configuration for your Airtime installation.
|
||||
;
|
||||
; host: The IP address for the RabbitMQ service.
|
||||
; The default is 127.0.0.1.
|
||||
;
|
||||
; port: The port for the RabbitMQ service.
|
||||
; The default is 5672.
|
||||
;
|
||||
; user: The username for the RabbitMQ user.
|
||||
; The default is airtime.
|
||||
;
|
||||
; password: The password for the RabbitMQ user.
|
||||
; The default is airtime.
|
||||
;
|
||||
; vhost: The virtual host for the RabbitMQ service database.
|
||||
; The default is /airtime.
|
||||
;
|
||||
[rabbitmq]
|
||||
host = 127.0.0.1
|
||||
port = 5672
|
||||
user = airtime
|
||||
password = airtime
|
||||
vhost = /airtime
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
;
|
||||
; ----------------------------------------------------------------------
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# M E D I A M O N I T O R
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
# check_filesystem_events: How long to queue up events performed on the
|
||||
# files themselves, in seconds
|
||||
# The default is 5
|
||||
#
|
||||
# check_airtime_events: How long to queue metadata input from airtime,
|
||||
# in seconds
|
||||
# The default is 30
|
||||
#
|
||||
# touch_interval:
|
||||
# The default is 5
|
||||
#
|
||||
# chunking_number:
|
||||
# The default is 450
|
||||
#
|
||||
# request_max_wait: The maximum request wait time, in seconds
|
||||
# The default is 3.0
|
||||
#
|
||||
# rmq_event_wait: The RabbitMQ event wait time, in seconds
|
||||
# The default is 0.1
|
||||
#
|
||||
# logpath: The media monitor log file path
|
||||
# The default is '/var/log/airtime/media-monitor/media-monitor.log'
|
||||
#
|
||||
# index_path: The media monitor index path
|
||||
# The default is '/var/tmp/airtime/media-monitor/last_index'
|
||||
#
|
||||
; ----------------------------------------------------------------------
|
||||
; M E D I A M O N I T O R
|
||||
; ----------------------------------------------------------------------
|
||||
;
|
||||
; check_filesystem_events: How long to queue up events performed on the
|
||||
; files themselves, in seconds
|
||||
; The default is 5
|
||||
;
|
||||
; check_airtime_events: How long to queue metadata input from airtime,
|
||||
; in seconds
|
||||
; The default is 30
|
||||
;
|
||||
; touch_interval:
|
||||
; The default is 5
|
||||
;
|
||||
; chunking_number:
|
||||
; The default is 450
|
||||
;
|
||||
; request_max_wait: The maximum request wait time, in seconds
|
||||
; The default is 3.0
|
||||
;
|
||||
; rmq_event_wait: The RabbitMQ event wait time, in seconds
|
||||
; The default is 0.1
|
||||
;
|
||||
; logpath: The media monitor log file path
|
||||
; The default is '/var/log/airtime/media-monitor/media-monitor.log'
|
||||
;
|
||||
; index_path: The media monitor index path
|
||||
; The default is '/var/tmp/airtime/media-monitor/last_index'
|
||||
;
|
||||
[media-monitor]
|
||||
check_filesystem_events = 5
|
||||
check_airtime_events = 30
|
||||
|
@ -146,129 +146,129 @@ request_max_wait = 3.0
|
|||
rmq_event_wait = 0.1
|
||||
logpath = '/var/log/airtime/media-monitor/media-monitor.log'
|
||||
index_path = '/var/tmp/airtime/media-monitor/last_index'
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
;
|
||||
; ----------------------------------------------------------------------
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# P Y P O
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
# api_client: Set the type of client you are using.
|
||||
# Currently supported types:
|
||||
# 1) 'obp' = Open Broadcast Platform
|
||||
# 2) 'airtime'
|
||||
# The default is 'airtime'
|
||||
#
|
||||
# cache_dir: The directory for pypo cache files
|
||||
# The default is '/var/tmp/airtime/pypo/cache/'
|
||||
#
|
||||
# file_dir: The directory for pypo media files
|
||||
# The default is '/var/tmp/airtime/pypo/files/'
|
||||
#
|
||||
# tmp_dir: The directory for pypo temp files
|
||||
# The default is '/var/tmp/airtime/pypo/tmp/'
|
||||
#
|
||||
# cache_base_dir: The pypo base cache directory
|
||||
# The default is '/var/tmp/airtime/pypo/'
|
||||
#
|
||||
# log_base_dir: The base directory for Airtime log files
|
||||
# The default is '/var/log/airtime'
|
||||
#
|
||||
# pypo_log_dir: The directory for pypo log files
|
||||
# The default is '/var/log/airtime/pypo'
|
||||
#
|
||||
# liquidsoap_log_dir: The directory for liquidsoap log files
|
||||
# The default is '/var/log/airtime/pypo-liquidsoap'
|
||||
#
|
||||
# ls_host: Liquidsoap connection host
|
||||
# The default is '127.0.0.1'
|
||||
#
|
||||
# ls_port: Liquidsoap connection port
|
||||
# The default is '1234'
|
||||
#
|
||||
# poll_interval: Poll interval in seconds
|
||||
#
|
||||
# This will rarely need to be changed because any schedule
|
||||
# changes are automatically sent to pypo immediately
|
||||
# This is how often the poll script downloads new schedules
|
||||
# and files from the server in the event that no changes
|
||||
# are made to the schedule
|
||||
# The default is 3600
|
||||
#
|
||||
# push_interval: Push interval in seconds
|
||||
#
|
||||
# This is how often the push script checks whether it has
|
||||
# something new to push to liquidsoap
|
||||
# The default is 1
|
||||
#
|
||||
# cue_style: Can be set to 'pre' or 'otf'
|
||||
# 'pre' cues while playlist preparation
|
||||
# 'otf' (on the fly) cues while loading into ls
|
||||
# (needs the post_processor patch)
|
||||
# The default is 'pre'
|
||||
#
|
||||
# record_bitrate: The bitrate for recordings
|
||||
# The default is 256
|
||||
#
|
||||
# record_samplerate: The samplerate for recordings
|
||||
# The default is 44100
|
||||
#
|
||||
# record_channels: The number of channels for recordings
|
||||
# The default is 2
|
||||
#
|
||||
# record_sample_size: The sample size for recordings
|
||||
# The default is 16
|
||||
#
|
||||
# record_file_type: Can be either ogg|mp3, mp3 recording requires
|
||||
# installation of the package "lame"
|
||||
# The default is ogg
|
||||
#
|
||||
# base_recorded_files: Base path to store recordered shows at
|
||||
# The default is '/var/tmp/airtime/show-recorder/'
|
||||
#
|
||||
; ----------------------------------------------------------------------
|
||||
; P Y P O
|
||||
; ----------------------------------------------------------------------
|
||||
;
|
||||
; api_client: Set the type of client you are using.
|
||||
; Currently supported types:
|
||||
; 1) 'obp' = Open Broadcast Platform
|
||||
; 2) 'airtime'
|
||||
; The default is 'airtime'
|
||||
;
|
||||
; cache_dir: The directory for pypo cache files
|
||||
; The default is '/var/tmp/airtime/pypo/cache/'
|
||||
;
|
||||
; file_dir: The directory for pypo media files
|
||||
; The default is '/var/tmp/airtime/pypo/files/'
|
||||
;
|
||||
; tmp_dir: The directory for pypo temp files
|
||||
; The default is '/var/tmp/airtime/pypo/tmp/'
|
||||
;
|
||||
; cache_base_dir: The pypo base cache directory
|
||||
; The default is '/var/tmp/airtime/pypo/'
|
||||
;
|
||||
; log_base_dir: The base directory for Airtime log files
|
||||
; The default is '/var/log/airtime'
|
||||
;
|
||||
; pypo_log_dir: The directory for pypo log files
|
||||
; The default is '/var/log/airtime/pypo'
|
||||
;
|
||||
; liquidsoap_log_dir: The directory for liquidsoap log files
|
||||
; The default is '/var/log/airtime/pypo-liquidsoap'
|
||||
;
|
||||
; ls_host: Liquidsoap connection host
|
||||
; The default is '127.0.0.1'
|
||||
;
|
||||
; ls_port: Liquidsoap connection port
|
||||
; The default is '1234'
|
||||
;
|
||||
; poll_interval: Poll interval in seconds
|
||||
;
|
||||
; This will rarely need to be changed because any schedule
|
||||
; changes are automatically sent to pypo immediately
|
||||
; This is how often the poll script downloads new schedules
|
||||
; and files from the server in the event that no changes
|
||||
; are made to the schedule
|
||||
; The default is 3600
|
||||
;
|
||||
; push_interval: Push interval in seconds
|
||||
;
|
||||
; This is how often the push script checks whether it has
|
||||
; something new to push to liquidsoap
|
||||
; The default is 1
|
||||
;
|
||||
; cue_style: Can be set to 'pre' or 'otf'
|
||||
; 'pre' cues while playlist preparation
|
||||
; 'otf' (on the fly) cues while loading into ls
|
||||
; (needs the post_processor patch)
|
||||
; The default is 'pre'
|
||||
;
|
||||
; record_bitrate: The bitrate for recordings
|
||||
; The default is 256
|
||||
;
|
||||
; record_samplerate: The samplerate for recordings
|
||||
; The default is 44100
|
||||
;
|
||||
; record_channels: The number of channels for recordings
|
||||
; The default is 2
|
||||
;
|
||||
; record_sample_size: The sample size for recordings
|
||||
; The default is 16
|
||||
;
|
||||
; record_file_type: Can be either ogg|mp3, mp3 recording requires
|
||||
; installation of the package "lame"
|
||||
; The default is ogg
|
||||
;
|
||||
; base_recorded_files: Base path to store recordered shows at
|
||||
; The default is '/var/tmp/airtime/show-recorder/'
|
||||
;
|
||||
[pypo]
|
||||
api_client = 'airtime'
|
||||
# ---------- Cache directories - !! Include trailing slash !! ----------
|
||||
; ---------- Cache directories - !! Include trailing slash !! ----------
|
||||
cache_dir = '/var/tmp/airtime/pypo/cache/'
|
||||
file_dir = '/var/tmp/airtime/pypo/files/'
|
||||
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'
|
||||
log_base_dir = '/var/log/airtime'
|
||||
pypo_log_dir = '/var/log/airtime/pypo'
|
||||
liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap'
|
||||
# ------------------------ Liquidsoap Settings -------------------------
|
||||
; ------------------------ Liquidsoap Settings -------------------------
|
||||
ls_host = '127.0.0.1'
|
||||
ls_port = '1234'
|
||||
# -------------------------- Pypo Preferences --------------------------
|
||||
; -------------------------- Pypo Preferences --------------------------
|
||||
poll_interval = 3600
|
||||
push_interval = 1
|
||||
cue_style = 'pre'
|
||||
# ---------------------- Recorded Audio Settings -----------------------
|
||||
; ---------------------- Recorded Audio Settings -----------------------
|
||||
record_bitrate = 256
|
||||
record_samplerate = 44100
|
||||
record_channels = 2
|
||||
record_sample_size = 16
|
||||
record_file_type = 'ogg'
|
||||
base_recorded_files = '/var/tmp/airtime/show-recorder/'
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
;
|
||||
; ----------------------------------------------------------------------
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# S O U N D C L O U D
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
# connection_retries: The number of times to retry the connection to
|
||||
# Soundcloud.
|
||||
# The default is 3.
|
||||
#
|
||||
# time_between_retries: The time between connection retries, in seconds.
|
||||
# The default is 60.
|
||||
#
|
||||
; ----------------------------------------------------------------------
|
||||
; S O U N D C L O U D
|
||||
; ----------------------------------------------------------------------
|
||||
;
|
||||
; connection_retries: The number of times to retry the connection to
|
||||
; Soundcloud.
|
||||
; The default is 3.
|
||||
;
|
||||
; time_between_retries: The time between connection retries, in seconds.
|
||||
; The default is 60.
|
||||
;
|
||||
[soundcloud]
|
||||
connection_retries = 3
|
||||
time_between_retries = 60
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
;
|
||||
; ----------------------------------------------------------------------
|
|
@ -15,7 +15,7 @@ require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/om/BaseCc
|
|||
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcMusicDirsPeer.php");
|
||||
|
||||
/**
|
||||
* User: sourcefabric
|
||||
* Author: sourcefabric
|
||||
* Date: 08/12/14
|
||||
*
|
||||
* Class MediaSetup
|
||||
|
@ -65,6 +65,15 @@ class MediaSetup extends Setup {
|
|||
$message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!";
|
||||
$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 {
|
||||
$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
|
||||
$errors[] = "ERR";
|
||||
|
|
|
@ -18,7 +18,7 @@ if [ "$1" = "--enable" ]; then
|
|||
|
||||
echo "Changing ownership to user $1"
|
||||
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/
|
||||
chmod -v a+r /etc/airtime/api_client.cfg
|
||||
elif [ "$1" = "--disable" ]; then
|
||||
|
@ -26,7 +26,7 @@ elif [ "$1" = "--disable" ]; then
|
|||
user="pypo"
|
||||
|
||||
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/
|
||||
chmod -v a+r /etc/airtime/api_client.cfg
|
||||
|
||||
|
|
11
install
11
install
|
@ -406,6 +406,7 @@ verbose "...Done"
|
|||
for i in /etc/init/airtime*; do
|
||||
chmod 644 $i
|
||||
sed -i "s/WEB_USER/${web_user}/g" $i
|
||||
mv $i ${i%.template}
|
||||
done
|
||||
|
||||
initctl reload-configuration
|
||||
|
@ -414,18 +415,8 @@ if [ ! -d /var/log/airtime ]; then
|
|||
loud "\n-----------------------------------------------------"
|
||||
loud " * Installing Log Files * "
|
||||
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..."
|
||||
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/
|
||||
|
||||
verbose "\n * Copying logrotate files..."
|
||||
|
|
|
@ -11,7 +11,6 @@ libtaglib-ocaml
|
|||
libao-ocaml
|
||||
libmad-ocaml
|
||||
ecasound
|
||||
libesd0
|
||||
libportaudio2
|
||||
libsamplerate0
|
||||
libvo-aacenc0
|
||||
|
@ -34,11 +33,9 @@ pwgen
|
|||
libfaad2
|
||||
php-apc
|
||||
|
||||
libmp3lame-dev
|
||||
lame
|
||||
|
||||
coreutils
|
||||
|
||||
sourcefabric-keyring
|
||||
silan
|
||||
libopus0
|
|
@ -11,7 +11,6 @@ libtaglib-ocaml
|
|||
libao-ocaml
|
||||
libmad-ocaml
|
||||
ecasound
|
||||
libesd0
|
||||
libportaudio2
|
||||
libsamplerate0
|
||||
|
||||
|
@ -33,7 +32,6 @@ pwgen
|
|||
libfaad2
|
||||
php-apc
|
||||
|
||||
libmp3lame-dev
|
||||
lame
|
||||
|
||||
libzend-framework-php
|
||||
|
@ -56,6 +54,5 @@ liquidsoap-plugin-taglib
|
|||
liquidsoap-plugin-voaacenc
|
||||
liquidsoap-plugin-vorbis
|
||||
|
||||
sourcefabric-keyring
|
||||
silan
|
||||
libopus0
|
|
@ -11,7 +11,6 @@ libtaglib-ocaml
|
|||
libao-ocaml
|
||||
libmad-ocaml
|
||||
ecasound
|
||||
libesd0
|
||||
libportaudio2
|
||||
libsamplerate0
|
||||
|
||||
|
@ -33,7 +32,6 @@ pwgen
|
|||
libfaad2
|
||||
php-apc
|
||||
|
||||
libmp3lame-dev
|
||||
lame
|
||||
|
||||
libzend-framework-php
|
||||
|
@ -54,6 +52,5 @@ liquidsoap-plugin-taglib
|
|||
liquidsoap-plugin-voaacenc
|
||||
liquidsoap-plugin-vorbis
|
||||
|
||||
sourcefabric-keyring
|
||||
silan
|
||||
libopus0
|
|
@ -21,7 +21,7 @@ class AirtimeInstance(object):
|
|||
def root_make(cls, name, root):
|
||||
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)
|
||||
|
||||
|
|
|
@ -12,7 +12,20 @@ if '--no-init-script' in sys.argv:
|
|||
data_files = []
|
||||
sys.argv.remove('--no-init-script') # super hax
|
||||
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
|
||||
|
||||
setup(name='airtime-media-monitor',
|
||||
|
|
|
@ -3,9 +3,9 @@ import telnetlib
|
|||
import sys
|
||||
|
||||
try:
|
||||
config = ConfigObj('/etc/airtime/pypo.cfg')
|
||||
LS_HOST = config['ls_host']
|
||||
LS_PORT = config['ls_port']
|
||||
config = ConfigObj('/etc/airtime/airtime.conf')
|
||||
LS_HOST = config['pypo']['ls_host']
|
||||
LS_PORT = config['pypo']['ls_port']
|
||||
|
||||
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||
tn.write("master_harbor.stop\n")
|
||||
|
@ -14,6 +14,6 @@ try:
|
|||
tn.read_all()
|
||||
|
||||
except Exception, e:
|
||||
print 'Error loading config file: %s' % e
|
||||
print('Error loading config file: %s', e)
|
||||
sys.exit()
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ LogWriter.override_std_err(logger)
|
|||
|
||||
# loading config file
|
||||
try:
|
||||
config = ConfigObj('/etc/airtime/pypo.cfg')
|
||||
config = ConfigObj('/etc/airtime/airtime.conf')
|
||||
|
||||
except Exception, e:
|
||||
logger.error('Error loading config file: %s', e)
|
||||
|
|
|
@ -34,7 +34,7 @@ def api_client(logger):
|
|||
|
||||
# loading config file
|
||||
try:
|
||||
config = ConfigObj('/etc/airtime/pypo.cfg')
|
||||
config = ConfigObj('/etc/airtime/airtime.conf')
|
||||
except Exception, e:
|
||||
print ('Error loading config file: %s', e)
|
||||
sys.exit()
|
||||
|
@ -73,18 +73,18 @@ class ShowRecorder(Thread):
|
|||
filename = self.start_time
|
||||
filename = filename.replace(" ", "-")
|
||||
|
||||
if config["record_file_type"] in ["mp3", "ogg"]:
|
||||
filetype = config["record_file_type"]
|
||||
if config["pypo"]["record_file_type"] in ["mp3", "ogg"]:
|
||||
filetype = config["pypo"]["record_file_type"]
|
||||
else:
|
||||
filetype = "ogg";
|
||||
|
||||
joined_path = os.path.join(config["base_recorded_files"], filename)
|
||||
filepath = "%s.%s" % (joined_path, filetype)
|
||||
|
||||
br = config["record_bitrate"]
|
||||
sr = config["record_samplerate"]
|
||||
c = config["record_channels"]
|
||||
ss = config["record_sample_size"]
|
||||
br = config["pypo"]["record_bitrate"]
|
||||
sr = config["pypo"]["record_samplerate"]
|
||||
c = config["pypo"]["record_channels"]
|
||||
ss = config["pypo"]["record_sample_size"]
|
||||
|
||||
#-f:16,2,44100
|
||||
#-b:256
|
||||
|
|
|
@ -12,7 +12,21 @@ if '--no-init-script' in sys.argv:
|
|||
data_files = []
|
||||
sys.argv.remove('--no-init-script') # super hax
|
||||
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
|
||||
|
||||
setup(name='airtime-playout',
|
||||
|
|
28
uninstall
28
uninstall
|
@ -52,14 +52,16 @@ FILES=(
|
|||
"/etc/init/airtime*"
|
||||
"/usr/bin/airtime*"
|
||||
"/etc/apache2/sites-available/airtime*"
|
||||
"pip airtime-playout"
|
||||
"pip airtime-media-monitor"
|
||||
"/etc/apache2/sites-enabled/airtime*"
|
||||
)
|
||||
|
||||
echo -e "The following files, directories, and services will be removed:\n"
|
||||
for i in ${FILES[*]}; do
|
||||
echo $i
|
||||
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 "\nThis will *permanently* remove Airtime and all related files from your computer. \
|
||||
|
@ -84,19 +86,17 @@ if [ -f /etc/airtime/airtime.conf ]; then
|
|||
removeRabbitmqAirtimeSettings
|
||||
fi
|
||||
|
||||
rm -rf /etc/airtime
|
||||
rm -rf /var/log/airtime/
|
||||
rm -rf /usr/lib/airtime/
|
||||
for i in ${FILES[*]}; do
|
||||
rm -rf $i
|
||||
done
|
||||
|
||||
rm -rf /usr/share/airtime
|
||||
|
||||
rm -f /etc/init/airtime*
|
||||
rm -f /usr/bin/airtime*
|
||||
|
||||
rm -f /etc/apache2/sites-enabled/airtime*
|
||||
rm -f /etc/apache2/sites-available/airtime*
|
||||
|
||||
dropAirtimeDatabase
|
||||
echo -e "\Do you want to drop your current Airtime database? (Y/n): \c"
|
||||
read IN
|
||||
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
||||
echo -e "\nDropping Airtime database..."
|
||||
dropAirtimeDatabase
|
||||
fi
|
||||
|
||||
pip uninstall -y airtime-playout airtime-media-monitor
|
||||
service apache2 restart
|
||||
echo "...Done"
|
Loading…
Reference in New Issue