Merge branch 'airtime-2.0.x' of dev.sourcefabric.org:airtime into airtime-2.0.x
This commit is contained in:
commit
9216da7f03
|
@ -8,7 +8,9 @@
|
||||||
* that the user can customize these.
|
* that the user can customize these.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
|
|
||||||
|
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
|
$ini = parse_ini_file($configFile, true);
|
||||||
|
|
||||||
$dbhost = $ini['database']['host'];
|
$dbhost = $ini['database']['host'];
|
||||||
$dbname = $ini['database']['dbname'];
|
$dbname = $ini['database']['dbname'];
|
||||||
|
|
|
@ -23,7 +23,9 @@ $CC_CONFIG = array(
|
||||||
'phingPath' => dirname(__FILE__).'/../../library/phing'
|
'phingPath' => dirname(__FILE__).'/../../library/phing'
|
||||||
);
|
);
|
||||||
|
|
||||||
Config::loadConfig("/etc/airtime/airtime.conf");
|
|
||||||
|
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
|
Config::loadConfig($configFile);
|
||||||
|
|
||||||
// Add database table names
|
// Add database table names
|
||||||
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
|
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
|
||||||
|
|
|
@ -7,7 +7,9 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
|
||||||
if (Application_Model_RabbitMq::$doPush) {
|
if (Application_Model_RabbitMq::$doPush) {
|
||||||
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
|
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
|
||||||
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
||||||
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
|
if (!isset($_SERVER['AIRTIME_SRV'])){
|
||||||
|
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,11 +409,13 @@ class Application_Model_StoredFile {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFilePath()
|
public function getFilePath()
|
||||||
{
|
{
|
||||||
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||||
|
$directory = $music_dir->getDirectory();
|
||||||
|
|
||||||
$filepath = $this->_file->getDbFilepath();
|
$filepath = $this->_file->getDbFilepath();
|
||||||
|
|
||||||
return $music_dir->getDirectory().$filepath;
|
return $directory.$filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -877,8 +879,13 @@ class Application_Model_StoredFile {
|
||||||
|
|
||||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||||
|
|
||||||
$r = @copy($audio_file, $audio_stor);
|
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||||
$r = @unlink($audio_file);
|
|
||||||
|
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||||
|
$r = @rename($audio_file, $audio_stor);
|
||||||
|
|
||||||
|
//$r = @copy($audio_file, $audio_stor);
|
||||||
|
//$r = @unlink($audio_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFileCount()
|
public static function getFileCount()
|
||||||
|
|
|
@ -17,16 +17,17 @@ fi
|
||||||
|
|
||||||
showhelp () {
|
showhelp () {
|
||||||
echo "Usage: airtime-install [options]
|
echo "Usage: airtime-install [options]
|
||||||
--help|-h Displays usage information.
|
--help|-h Displays usage information.
|
||||||
--overwrite|-o Overwrite any existing config files.
|
--overwrite|-o Overwrite any existing config files.
|
||||||
--preserve|-p Keep any existing config files.
|
--preserve|-p Keep any existing config files.
|
||||||
--no-db|-n Turn off database install.
|
--no-db|-n Turn off database install.
|
||||||
--reinstall|-r Force a fresh install of this Airtime Version
|
--reinstall|-r Force a fresh install of this Airtime Version
|
||||||
--media-monitor|-m Install only media-monitor
|
--media-monitor|-m Install only media-monitor
|
||||||
--pypo|-p Install only pypo and liquidsoap
|
--pypo|-p Install only pypo and liquidsoap
|
||||||
--show-recorder|-s Install only show-recorder
|
--show-recorder|-s Install only show-recorder
|
||||||
--web|-w Install only files for web-server
|
--web|-w Install only files for web-server
|
||||||
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading"
|
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading
|
||||||
|
--disable-auto-start-services|-d Disable auto-starting Airtime services"
|
||||||
}
|
}
|
||||||
|
|
||||||
overwrite="f"
|
overwrite="f"
|
||||||
|
@ -38,8 +39,9 @@ pypo="f"
|
||||||
showrecorder="f"
|
showrecorder="f"
|
||||||
web="f"
|
web="f"
|
||||||
liquidsoap_keep_alive="f"
|
liquidsoap_keep_alive="f"
|
||||||
|
disable_auto_start_services="f"
|
||||||
|
|
||||||
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,show-recorder,web,liquidsoap-keep-alive "hopnrmyswl" "$@")
|
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,show-recorder,web,liquidsoap-keep-alive,disable-auto-start-services "hopnrmyswld" "$@")
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -53,6 +55,7 @@ do
|
||||||
(-s|--show-recorder) showrecorder="t";;
|
(-s|--show-recorder) showrecorder="t";;
|
||||||
(-w|--web) web="t";;
|
(-w|--web) web="t";;
|
||||||
(-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";;
|
(-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";;
|
||||||
|
(-d|--disable-auto-start-services) disable_auto_start_services="t";;
|
||||||
|
|
||||||
(--) shift; break;;
|
(--) shift; break;;
|
||||||
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
|
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
|
||||||
|
@ -107,6 +110,7 @@ export nodb
|
||||||
export overwrite
|
export overwrite
|
||||||
export preserve
|
export preserve
|
||||||
export liquidsoap_keep_alive
|
export liquidsoap_keep_alive
|
||||||
|
export disable_auto_start_services
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
test "$mediamonitor" = "t" -o "$pypo" = "t" -o "$showrecorder" = "t"
|
test "$mediamonitor" = "t" -o "$pypo" = "t" -o "$showrecorder" = "t"
|
||||||
|
|
|
@ -53,15 +53,17 @@ sleep 1
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
if [ "$mediamonitor" = "t" ]; then
|
if [ "$disable_auto_start_services" = "f" ]; then
|
||||||
monit monitor airtime-media-monitor
|
if [ "$mediamonitor" = "t" ]; then
|
||||||
fi
|
monit monitor airtime-media-monitor
|
||||||
if [ "$pypo" = "t" ]; then
|
fi
|
||||||
monit monitor airtime-playout
|
if [ "$pypo" = "t" ]; then
|
||||||
monit monitor airtime-liquidsoap
|
monit monitor airtime-playout
|
||||||
fi
|
monit monitor airtime-liquidsoap
|
||||||
if [ "$showrecorder" = "t" ]; then
|
fi
|
||||||
monit monitor airtime-show-recorder
|
if [ "$showrecorder" = "t" ]; then
|
||||||
|
monit monitor airtime-show-recorder
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
monit monitor rabbitmq-server
|
monit monitor rabbitmq-server
|
||||||
|
|
|
@ -42,8 +42,9 @@ try:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#copy monit files
|
#copy monit files
|
||||||
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
|
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
|
||||||
#create log dir
|
#create log dir
|
||||||
create_dir(config['log_dir'])
|
create_dir(config['log_dir'])
|
||||||
|
|
|
@ -6,15 +6,17 @@ if os.geteuid() != 0:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#update-rc.d init script
|
|
||||||
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
#update-rc.d init script
|
||||||
|
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
|
||||||
#Start media-monitor daemon
|
#Start media-monitor daemon
|
||||||
print "* Waiting for media-monitor processes to start..."
|
print "* Waiting for media-monitor processes to start..."
|
||||||
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
|
@ -3,8 +3,3 @@
|
||||||
|
|
||||||
set httpd port 2812
|
set httpd port 2812
|
||||||
allow admin:monit
|
allow admin:monit
|
||||||
|
|
||||||
check process rabbitmq-server
|
|
||||||
with pidfile "/var/run/rabbitmq.pid"
|
|
||||||
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; /usr/lib/airtime/utils/rabbitmq-update-pid.sh'"
|
|
||||||
stop program = "/etc/init.d/rabbitmq-server stop"
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
set daemon 10 # Poll at 5 second intervals
|
set daemon 10 # Poll at 5 second intervals
|
||||||
#set logfile syslog facility log_daemon
|
|
||||||
set logfile /var/log/monit.log
|
set logfile /var/log/monit.log
|
||||||
|
|
||||||
set httpd port 2812
|
|
||||||
allow admin:monit
|
|
||||||
|
|
||||||
check process rabbitmq-server
|
check process rabbitmq-server
|
||||||
with pidfile "/var/run/rabbitmq.pid"
|
with pidfile "/var/run/rabbitmq.pid"
|
||||||
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"
|
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; /usr/lib/airtime/utils/rabbitmq-update-pid.sh'"
|
||||||
stop program = "/etc/init.d/rabbitmq-server stop"
|
stop program = "/etc/init.d/rabbitmq-server stop"
|
||||||
|
|
|
@ -42,9 +42,11 @@ try:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#copy monit files
|
#copy monit files
|
||||||
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
|
||||||
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
shutil.copy('%s/../../monit/monit-airtime-rabbitmq-server.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
|
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
|
||||||
#create pypo log dir
|
#create pypo log dir
|
||||||
create_dir(config['pypo_log_dir'])
|
create_dir(config['pypo_log_dir'])
|
||||||
|
|
|
@ -87,10 +87,6 @@ try:
|
||||||
print "Unsupported system architecture."
|
print "Unsupported system architecture."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#initialize init.d scripts
|
|
||||||
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
#generate liquidsoap config file
|
#generate liquidsoap config file
|
||||||
#access the DB and generate liquidsoap.cfg under /etc/airtime/
|
#access the DB and generate liquidsoap.cfg under /etc/airtime/
|
||||||
ac = api_client.api_client_factory(config)
|
ac = api_client.api_client_factory(config)
|
||||||
|
@ -101,18 +97,23 @@ try:
|
||||||
else:
|
else:
|
||||||
print "Unable to connect to the Airtime server."
|
print "Unable to connect to the Airtime server."
|
||||||
|
|
||||||
#restart airtime-playout
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
print "* Waiting for pypo processes to start..."
|
#initialize init.d scripts
|
||||||
if os.environ["liquidsoap_keep_alive"] == "f":
|
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
||||||
print " * Restarting any previous Liquidsoap instances"
|
|
||||||
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
else:
|
|
||||||
print " * Keeping any previous Liquidsoap instances running"
|
#restart airtime-playout
|
||||||
p = Popen("/etc/init.d/airtime-playout pypo-stop", shell=True)
|
print "* Waiting for pypo processes to start..."
|
||||||
|
if os.environ["liquidsoap_keep_alive"] == "f":
|
||||||
|
print " * Restarting any previous Liquidsoap instances"
|
||||||
|
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
else:
|
||||||
|
print " * Keeping any previous Liquidsoap instances running"
|
||||||
|
p = Popen("/etc/init.d/airtime-playout pypo-stop", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
|
@ -41,10 +41,11 @@ try:
|
||||||
print 'Error loading config file: ', e
|
print 'Error loading config file: ', e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
#copy monit files
|
#copy monit files
|
||||||
shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
|
shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
|
||||||
#create temporary media-storage directory
|
#create temporary media-storage directory
|
||||||
#print "Creating temporary media storage directory"
|
#print "Creating temporary media storage directory"
|
||||||
|
|
|
@ -7,15 +7,16 @@ if os.geteuid() != 0:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#register init.d script
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True)
|
#register init.d script
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
#start daemon
|
|
||||||
print "* Waiting for show-recorder processes to start..."
|
#start daemon
|
||||||
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
print "* Waiting for show-recorder processes to start..."
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
||||||
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
Loading…
Reference in New Issue