Merge branch '1.9.1' of dev.sourcefabric.org:airtime into 1.9.1
Conflicts: install_minimal/airtime-install
This commit is contained in:
commit
500fa759af
23 changed files with 664 additions and 131 deletions
4
CREDITS
4
CREDITS
|
@ -1,6 +1,10 @@
|
||||||
=======
|
=======
|
||||||
CREDITS
|
CREDITS
|
||||||
=======
|
=======
|
||||||
|
Version 1.9.4
|
||||||
|
-------------
|
||||||
|
Same as previous version.
|
||||||
|
|
||||||
Version 1.9.3
|
Version 1.9.3
|
||||||
-------------
|
-------------
|
||||||
Same as previous version.
|
Same as previous version.
|
||||||
|
|
16
Changelog
16
Changelog
|
@ -1,10 +1,24 @@
|
||||||
|
1.9.4 - Sept 13, 2011
|
||||||
|
*Improvements
|
||||||
|
-"airtime-import" command-line utility now offers better help when invalid parameters have
|
||||||
|
been passed.
|
||||||
|
*Fixes
|
||||||
|
-Fixed "Show Contents" displaying full-length of tracks, even if cue-points had been set.
|
||||||
|
-Fixed start date of show not updating after dragging and dropping.
|
||||||
|
-Fixed audio preview still playing after deleting a file in the Playlist Builder.
|
||||||
|
-Fixed uploads via the web-interface while using Internet Explorer failing when tracks contained "+" or
|
||||||
|
whitespace characters.
|
||||||
|
-Fixed issue where deleting a file from the Playlist Builder wouldn't always refresh the list to
|
||||||
|
remove the file.
|
||||||
|
-Fixed issue where upgrading from any previous Airtime would set "Toronto/America" as the default timezone
|
||||||
|
|
||||||
1.9.3 - August 26th, 2011
|
1.9.3 - August 26th, 2011
|
||||||
*Improvements
|
*Improvements
|
||||||
-It is now possible to upgrade your system while a show is playing.
|
-It is now possible to upgrade your system while a show is playing.
|
||||||
Playout will be temporarily interrupted for about 5-10 seconds and then
|
Playout will be temporarily interrupted for about 5-10 seconds and then
|
||||||
playout will resume. Previously playout would not resume until the next
|
playout will resume. Previously playout would not resume until the next
|
||||||
scheduled show.
|
scheduled show.
|
||||||
*fixes
|
*Fixes
|
||||||
-Fixed bug where playout system did not work with mono files.
|
-Fixed bug where playout system did not work with mono files.
|
||||||
-Fixed bug where sometimes audio files could be played out of order.
|
-Fixed bug where sometimes audio files could be played out of order.
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ $PORT = 5672;
|
||||||
$USER = 'guest';
|
$USER = 'guest';
|
||||||
$PASS = 'guest';
|
$PASS = 'guest';
|
||||||
$VHOST = '/';
|
$VHOST = '/';
|
||||||
$EXCHANGE = 'router';
|
$EXCHANGE = 'airtime-schedule';
|
||||||
$QUEUE = 'msgs';
|
$QUEUE = 'msgs';
|
||||||
$CONSUMER_TAG = 'consumer';
|
$CONSUMER_TAG = 'consumer';
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ $ch = $conn->channel();
|
||||||
$ch->access_request($VHOST, false, false, true, true);
|
$ch->access_request($VHOST, false, false, true, true);
|
||||||
|
|
||||||
$ch->queue_declare($QUEUE);
|
$ch->queue_declare($QUEUE);
|
||||||
$ch->exchange_declare($EXCHANGE, 'direct', false, false, false);
|
$ch->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||||
$ch->queue_bind($QUEUE, $EXCHANGE);
|
$ch->queue_bind($QUEUE, $EXCHANGE);
|
||||||
|
|
||||||
function process_message($msg) {
|
function process_message($msg) {
|
||||||
|
|
|
@ -13,15 +13,16 @@ $PORT = 5672;
|
||||||
$USER = 'guest';
|
$USER = 'guest';
|
||||||
$PASS = 'guest';
|
$PASS = 'guest';
|
||||||
$VHOST = '/';
|
$VHOST = '/';
|
||||||
$EXCHANGE = 'router';
|
$EXCHANGE = 'airtime-schedule';
|
||||||
$QUEUE = 'msgs';
|
$QUEUE = 'msgs';
|
||||||
|
|
||||||
$conn = new AMQPConnection($HOST, $PORT, $USER, $PASS);
|
$conn = new AMQPConnection($HOST, $PORT, $USER, $PASS);
|
||||||
$ch = $conn->channel();
|
$ch = $conn->channel();
|
||||||
$ch->access_request($VHOST, false, false, true, true);
|
$ch->access_request($VHOST, false, false, true, true);
|
||||||
$ch->exchange_declare($EXCHANGE, 'direct', false, false, false);
|
$ch->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||||
|
|
||||||
$msg_body = implode(' ', array_slice($argv, 1));
|
$msg_body = json_encode(array("event_type"=>"get_status", "id"=>time()));
|
||||||
|
//$msg_body = '{"schedule":{"status":{"range":{"start":"2011-09-12 20:45:22","end":"2011-09-13 20:45:22"},"version":"1.1"},"playlists":[],"check":1,"stream_metadata":{"format":"","station_name":""}},"event_type":"update_schedule"}';
|
||||||
$msg = new AMQPMessage($msg_body, array('content_type' => 'text/plain'));
|
$msg = new AMQPMessage($msg_body, array('content_type' => 'text/plain'));
|
||||||
|
|
||||||
$ch->basic_publish($msg, $EXCHANGE);
|
$ch->basic_publish($msg, $EXCHANGE);
|
||||||
|
@ -29,4 +30,5 @@ $ch->basic_publish($msg, $EXCHANGE);
|
||||||
echo "Sent message '".$msg_body."'\n";
|
echo "Sent message '".$msg_body."'\n";
|
||||||
$ch->close();
|
$ch->close();
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -7,8 +7,7 @@ exec > >(tee install_log.txt)
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "You need admin previlege to run this script"
|
echo "You need root privileges to run this script"
|
||||||
echo "Syntaxe: sudo $0"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -24,10 +23,10 @@ echo " 1. Install Packages"
|
||||||
echo "----------------------------------------------------"
|
echo "----------------------------------------------------"
|
||||||
|
|
||||||
# Updated package list
|
# Updated package list
|
||||||
sudo apt-get -y install tar gzip curl apache2 php5-pgsql libapache2-mod-php5 \
|
apt-get -y install tar gzip curl apache2 php5-pgsql libapache2-mod-php5 \
|
||||||
php-pear php5-gd postgresql odbc-postgresql python2.6 lame libsoundtouch-ocaml \
|
php-pear php5-gd postgresql odbc-postgresql python2.6 lame libsoundtouch-ocaml \
|
||||||
libvorbis-ocaml-dev libmp3lame-dev libtaglib-ocaml libao-ocaml libmad-ocaml \
|
libvorbis-ocaml-dev libmp3lame-dev libtaglib-ocaml libao-ocaml libmad-ocaml \
|
||||||
libesd0 icecast2 sudo libportaudio2 libsamplerate0 libcamomile-ocaml-dev \
|
libesd0 icecast2 libportaudio2 libsamplerate0 libcamomile-ocaml-dev \
|
||||||
ecasound php5-curl mpg123 rabbitmq-server monit python-virtualenv
|
ecasound php5-curl mpg123 rabbitmq-server monit python-virtualenv
|
||||||
|
|
||||||
if [ "$?" -ne "0" ]; then
|
if [ "$?" -ne "0" ]; then
|
||||||
|
@ -38,19 +37,19 @@ if [ "$?" -ne "0" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install phing
|
# Install phing
|
||||||
sudo pear channel-discover pear.phing.info
|
pear channel-discover pear.phing.info
|
||||||
sudo pear install phing/phing-2.4.2
|
pear install phing/phing-2.4.2
|
||||||
|
|
||||||
# Apache Config File
|
# Apache Config File
|
||||||
echo "----------------------------------------------------"
|
echo "----------------------------------------------------"
|
||||||
echo "2. Apache Config File"
|
echo "2. Apache Config File"
|
||||||
echo "----------------------------------------------------"
|
echo "----------------------------------------------------"
|
||||||
if [ ! -f /etc/apache2/sites-available/airtime ]; then
|
if [ ! -f /etc/apache2/sites-available/airtime ]; then
|
||||||
sudo cp $SCRIPTPATH/../apache/airtime-vhost /etc/apache2/sites-available/airtime
|
cp $SCRIPTPATH/../apache/airtime-vhost /etc/apache2/sites-available/airtime
|
||||||
sudo rm -rf /etc/apache2/sites-enabled/000-default
|
rm -rf /etc/apache2/sites-enabled/000-default
|
||||||
sudo ln -s /etc/apache2/sites-available/airtime /etc/apache2/sites-enabled/airtime
|
ln -s /etc/apache2/sites-available/airtime /etc/apache2/sites-enabled/airtime
|
||||||
sudo a2enmod rewrite php5
|
a2enmod rewrite php5
|
||||||
sudo service apache2 restart
|
service apache2 restart
|
||||||
else
|
else
|
||||||
echo "Apache config for Airtime already exists..."
|
echo "Apache config for Airtime already exists..."
|
||||||
fi
|
fi
|
||||||
|
@ -60,8 +59,8 @@ echo "----------------------------------------------------"
|
||||||
echo "3. Enable Icecast"
|
echo "3. Enable Icecast"
|
||||||
echo "----------------------------------------------------"
|
echo "----------------------------------------------------"
|
||||||
cd /etc/default/
|
cd /etc/default/
|
||||||
sudo sed -i 's/ENABLE=false/ENABLE=true/g' icecast2
|
sed -i 's/ENABLE=false/ENABLE=true/g' icecast2
|
||||||
sudo service icecast2 start
|
service icecast2 start
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Enable Monit
|
# Enable Monit
|
||||||
|
@ -69,22 +68,22 @@ echo "----------------------------------------------------"
|
||||||
echo "4. Enable Monit"
|
echo "4. Enable Monit"
|
||||||
echo "----------------------------------------------------"
|
echo "----------------------------------------------------"
|
||||||
cd /etc/default/
|
cd /etc/default/
|
||||||
sudo sed -i 's/startup=0/startup=1/g' monit
|
sed -i 's/startup=0/startup=1/g' monit
|
||||||
sudo cp $SCRIPTPATH/../../python_apps/monit/airtime-monit.cfg /etc/monit/conf.d
|
cp $SCRIPTPATH/../../python_apps/monit/airtime-monit.cfg /etc/monit/conf.d
|
||||||
|
|
||||||
grep -q "include /etc/monit/conf.d" /etc/monit/monitrc
|
grep -q "include /etc/monit/conf.d" /etc/monit/monitrc
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -ne 0 ] ; then
|
if [ $RETVAL -ne 0 ] ; then
|
||||||
sudo echo "include /etc/monit/conf.d/*" >> /etc/monit/monitrc
|
echo "include /etc/monit/conf.d/*" >> /etc/monit/monitrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo service monit start
|
service monit start
|
||||||
|
|
||||||
# Run Airtime Install
|
# Run Airtime Install
|
||||||
echo "----------------------------------------------------"
|
echo "----------------------------------------------------"
|
||||||
echo "5. Run Airtime Install"
|
echo "5. Run Airtime Install"
|
||||||
echo "----------------------------------------------------"
|
echo "----------------------------------------------------"
|
||||||
cd $SCRIPTPATH/../../install_minimal
|
cd $SCRIPTPATH/../../install_minimal
|
||||||
sudo ./airtime-install
|
./airtime-install
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,18 +27,18 @@ if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ $EXTRAOPTION -eq "0" ]; then
|
if [ $EXTRAOPTION -eq "0" ]; then
|
||||||
sudo virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
|
virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
|
||||||
else
|
else
|
||||||
# copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/
|
# copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/
|
||||||
# this is due to the bug in virtualenv 1.4.9
|
# this is due to the bug in virtualenv 1.4.9
|
||||||
if [ -d "$VIRTUAL_ENV_SHARE" ]; then
|
if [ -d "$VIRTUAL_ENV_SHARE" ]; then
|
||||||
cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/
|
cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/
|
||||||
fi
|
fi
|
||||||
sudo virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
|
virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n*** Installing Python Libraries ***"
|
echo -e "\n*** Installing Python Libraries ***"
|
||||||
sudo /usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle -E /usr/lib/airtime/airtime_virtualenv
|
/usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle -E /usr/lib/airtime/airtime_virtualenv
|
||||||
|
|
||||||
echo -e "\n*** Patching Python Libraries ***"
|
echo -e "\n*** Patching Python Libraries ***"
|
||||||
PACHES=${SCRIPTPATH}/patches/*
|
PACHES=${SCRIPTPATH}/patches/*
|
||||||
|
@ -47,7 +47,7 @@ if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
|
||||||
DIRNAME=$(basename $file)
|
DIRNAME=$(basename $file)
|
||||||
echo -e "\n ---Applying Patches for $DIRNAME---"
|
echo -e "\n ---Applying Patches for $DIRNAME---"
|
||||||
else
|
else
|
||||||
sudo patch -N -p0 -i $file
|
patch -N -p0 -i $file
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
|
|
@ -353,6 +353,7 @@ class AirtimeInstall
|
||||||
exec("rm -f /usr/bin/airtime-update-db-settings");
|
exec("rm -f /usr/bin/airtime-update-db-settings");
|
||||||
exec("rm -f /usr/bin/airtime-check-system");
|
exec("rm -f /usr/bin/airtime-check-system");
|
||||||
exec("rm -f /usr/bin/airtime-user");
|
exec("rm -f /usr/bin/airtime-user");
|
||||||
|
exec("rm -f /usr/bin/airtime-clean-storage ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function InstallPhpCode()
|
public static function InstallPhpCode()
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
with pidfile "/var/run/airtime-liquidsoap.pid"
|
with pidfile "/var/run/airtime-liquidsoap.pid"
|
||||||
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
||||||
stop program = "/etc/init.d/airtime-playout stop"
|
stop program = "/etc/init.d/airtime-playout stop"
|
||||||
# check process airtime-media-monitor
|
check process airtime-media-monitor
|
||||||
# with pidfile "/var/run/airtime-media-monitor.pid"
|
with pidfile "/var/run/airtime-media-monitor.pid"
|
||||||
# start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
|
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
|
||||||
# stop program = "/etc/init.d/airtime-media-monitor stop"
|
stop program = "/etc/init.d/airtime-media-monitor stop"
|
||||||
check process airtime-show-recorder
|
check process airtime-show-recorder
|
||||||
with pidfile "/var/run/airtime-show-recorder.pid"
|
with pidfile "/var/run/airtime-show-recorder.pid"
|
||||||
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
|
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
|
||||||
|
|
|
@ -67,6 +67,7 @@ class AirtimeInstall{
|
||||||
exec("rm -f /usr/bin/airtime-update-db-settings");
|
exec("rm -f /usr/bin/airtime-update-db-settings");
|
||||||
exec("rm -f /usr/bin/airtime-check-system");
|
exec("rm -f /usr/bin/airtime-check-system");
|
||||||
exec("rm -f /usr/bin/airtime-user");
|
exec("rm -f /usr/bin/airtime-user");
|
||||||
|
exec("rm -f /usr/bin/airtime-clean-storage ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function DbTableExists($p_name)
|
public static function DbTableExists($p_name)
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
with pidfile "/var/run/airtime-liquidsoap.pid"
|
with pidfile "/var/run/airtime-liquidsoap.pid"
|
||||||
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
||||||
stop program = "/etc/init.d/airtime-playout stop"
|
stop program = "/etc/init.d/airtime-playout stop"
|
||||||
# check process airtime-media-monitor
|
check process airtime-media-monitor
|
||||||
# with pidfile "/var/run/airtime-media-monitor.pid"
|
with pidfile "/var/run/airtime-media-monitor.pid"
|
||||||
# start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
|
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
|
||||||
# stop program = "/etc/init.d/airtime-media-monitor stop"
|
stop program = "/etc/init.d/airtime-media-monitor stop"
|
||||||
check process airtime-show-recorder
|
check process airtime-show-recorder
|
||||||
with pidfile "/var/run/airtime-show-recorder.pid"
|
with pidfile "/var/run/airtime-show-recorder.pid"
|
||||||
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
|
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
|
||||||
class Airtime192Upgrade{
|
class Airtime192Upgrade{
|
||||||
|
|
||||||
public static function InstallAirtimePhpServerCode($phpDir)
|
public static function InstallAirtimePhpServerCode($phpDir)
|
||||||
|
@ -121,7 +122,7 @@
|
||||||
AirtimeIni192::CONF_FILE_LIQUIDSOAP);
|
AirtimeIni192::CONF_FILE_LIQUIDSOAP);
|
||||||
|
|
||||||
// Backup the config files
|
// Backup the config files
|
||||||
$suffix = date("Ymdhis")."-1.9.0";
|
$suffix = date("Ymdhis")."-1.9.2";
|
||||||
foreach ($configFiles as $conf) {
|
foreach ($configFiles as $conf) {
|
||||||
if (file_exists($conf)) {
|
if (file_exists($conf)) {
|
||||||
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
||||||
|
@ -181,4 +182,5 @@
|
||||||
$values = parse_ini_file(AirtimeIni192::CONF_FILE_AIRTIME, true);
|
$values = parse_ini_file(AirtimeIni192::CONF_FILE_AIRTIME, true);
|
||||||
$phpDir = $values['general']['airtime_dir'];
|
$phpDir = $values['general']['airtime_dir'];
|
||||||
Airtime192Upgrade::InstallAirtimePhpServerCode($phpDir);
|
Airtime192Upgrade::InstallAirtimePhpServerCode($phpDir);
|
||||||
|
AirtimeInstall::CreateSymlinksToUtils();
|
||||||
?>
|
?>
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
|
||||||
class Airtime193Upgrade{
|
class Airtime193Upgrade{
|
||||||
|
|
||||||
public static function InstallAirtimePhpServerCode($phpDir)
|
public static function InstallAirtimePhpServerCode($phpDir)
|
||||||
|
@ -121,7 +122,7 @@
|
||||||
AirtimeIni193::CONF_FILE_LIQUIDSOAP);
|
AirtimeIni193::CONF_FILE_LIQUIDSOAP);
|
||||||
|
|
||||||
// Backup the config files
|
// Backup the config files
|
||||||
$suffix = date("Ymdhis")."-1.9.0";
|
$suffix = date("Ymdhis")."-1.9.3";
|
||||||
foreach ($configFiles as $conf) {
|
foreach ($configFiles as $conf) {
|
||||||
if (file_exists($conf)) {
|
if (file_exists($conf)) {
|
||||||
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
||||||
|
@ -172,4 +173,5 @@
|
||||||
$values = parse_ini_file(AirtimeIni193::CONF_FILE_AIRTIME, true);
|
$values = parse_ini_file(AirtimeIni193::CONF_FILE_AIRTIME, true);
|
||||||
$phpDir = $values['general']['airtime_dir'];
|
$phpDir = $values['general']['airtime_dir'];
|
||||||
Airtime193Upgrade::InstallAirtimePhpServerCode($phpDir);
|
Airtime193Upgrade::InstallAirtimePhpServerCode($phpDir);
|
||||||
|
AirtimeInstall::CreateSymlinksToUtils();
|
||||||
?>
|
?>
|
23
install_minimal/upgrades/airtime-1.9.4/airtime-monit.cfg.194
Normal file
23
install_minimal/upgrades/airtime-1.9.4/airtime-monit.cfg.194
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
set daemon 10 # Poll at 10 second intervals
|
||||||
|
set logfile syslog facility log_daemon
|
||||||
|
|
||||||
|
set httpd port 2812 and use address 127.0.0.1
|
||||||
|
allow localhost
|
||||||
|
allow admin:monit
|
||||||
|
|
||||||
|
check process airtime-playout
|
||||||
|
with pidfile "/var/run/airtime-playout.pid"
|
||||||
|
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
||||||
|
stop program = "/etc/init.d/airtime-playout stop"
|
||||||
|
check process airtime-liquidsoap
|
||||||
|
with pidfile "/var/run/airtime-liquidsoap.pid"
|
||||||
|
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
||||||
|
stop program = "/etc/init.d/airtime-playout stop"
|
||||||
|
check process airtime-media-monitor
|
||||||
|
with pidfile "/var/run/airtime-media-monitor.pid"
|
||||||
|
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
|
||||||
|
stop program = "/etc/init.d/airtime-media-monitor stop"
|
||||||
|
check process airtime-show-recorder
|
||||||
|
with pidfile "/var/run/airtime-show-recorder.pid"
|
||||||
|
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
|
||||||
|
stop program = "/etc/init.d/airtime-show-recorder stop"
|
|
@ -1,15 +1,233 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
|
||||||
class Airtime194Upgrade{
|
class Airtime194Upgrade{
|
||||||
|
|
||||||
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||||
|
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||||
const CONF_PYPO_GRP = "pypo";
|
const CONF_PYPO_GRP = "pypo";
|
||||||
|
|
||||||
public static function upgradeLiquidsoapCfgPerms(){
|
public static function upgradeLiquidsoapCfgPerms(){
|
||||||
chmod(self::CONF_FILE_LIQUIDSOAP, 0640);
|
chmod(self::CONF_FILE_LIQUIDSOAP, 0640);
|
||||||
chgrp(self::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP);
|
chgrp(self::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function InstallAirtimePhpServerCode($phpDir)
|
||||||
|
{
|
||||||
|
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
|
||||||
|
|
||||||
|
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
|
||||||
|
exec("mkdir -p ".$phpDir);
|
||||||
|
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ModifyHtAccessTimezone($phpDir){
|
||||||
|
$file = realpath($phpDir)."/public/.htaccess";
|
||||||
|
|
||||||
|
$fn = "/etc/timezone";
|
||||||
|
$handle = @fopen($fn, "r");
|
||||||
|
if ($handle){
|
||||||
|
$timezone = trim(fgets($handle, 4096));
|
||||||
|
fclose($handle);
|
||||||
|
} else {
|
||||||
|
echo "Could not open $fn";
|
||||||
|
}
|
||||||
|
|
||||||
|
$key = "php_value date.timezone";
|
||||||
|
//the best way to do this is use cli utility "sed", but I don't have time to learn this
|
||||||
|
$handle = @fopen($file, "r");
|
||||||
|
if ($handle) {
|
||||||
|
while (($buffer = fgets($handle, 4096)) !== false) {
|
||||||
|
if (strlen($key) > $buffer){
|
||||||
|
if (substr($buffer, 0, strlen($key)) == $key){
|
||||||
|
$output[] = "$key \"$timezone\"".PHP_EOL;
|
||||||
|
} else {
|
||||||
|
$output[] = $buffer;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$output[] = $buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!feof($handle)) {
|
||||||
|
echo "Error: unexpected fgets() fail\n";
|
||||||
|
}
|
||||||
|
fclose($handle);
|
||||||
|
} else {
|
||||||
|
echo "Could not open $file";
|
||||||
|
}
|
||||||
|
|
||||||
|
$handle = @fopen($file, 'w');
|
||||||
|
if ($handle) {
|
||||||
|
foreach ($output as $line){
|
||||||
|
fwrite($handle, $line);
|
||||||
|
}
|
||||||
|
fclose($handle);
|
||||||
|
} else {
|
||||||
|
echo "Could not open $file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AirtimeIni194{
|
||||||
|
|
||||||
|
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||||
|
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
|
||||||
|
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
|
||||||
|
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||||
|
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
||||||
|
const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg";
|
||||||
|
const CONF_FILE_MONIT = "/etc/monit/conf.d/airtime-monit.cfg";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function updates an INI style config file.
|
||||||
|
*
|
||||||
|
* A property and the value the property should be changed to are
|
||||||
|
* supplied. If the property is not found, then no changes are made.
|
||||||
|
*
|
||||||
|
* @param string $p_filename
|
||||||
|
* The path the to the file.
|
||||||
|
* @param string $p_property
|
||||||
|
* The property to look for in order to change its value.
|
||||||
|
* @param string $p_value
|
||||||
|
* The value the property should be changed to.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function UpdateIniValue($p_filename, $p_property, $p_value)
|
||||||
|
{
|
||||||
|
$lines = file($p_filename);
|
||||||
|
$n=count($lines);
|
||||||
|
foreach ($lines as &$line) {
|
||||||
|
if ($line[0] != "#"){
|
||||||
|
$key_value = explode("=", $line);
|
||||||
|
$key = trim($key_value[0]);
|
||||||
|
|
||||||
|
if ($key == $p_property){
|
||||||
|
$line = "$p_property = $p_value".PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp=fopen($p_filename, 'w');
|
||||||
|
for($i=0; $i<$n; $i++){
|
||||||
|
fwrite($fp, $lines[$i]);
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ReadPythonConfig($p_filename)
|
||||||
|
{
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
$lines = file($p_filename);
|
||||||
|
$n=count($lines);
|
||||||
|
for ($i=0; $i<$n; $i++) {
|
||||||
|
if (strlen($lines[$i]) && !in_array(substr($lines[$i], 0, 1), array('#', PHP_EOL))){
|
||||||
|
$info = explode("=", $lines[$i]);
|
||||||
|
$values[trim($info[0])] = trim($info[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function MergeConfigFiles($configFiles, $suffix) {
|
||||||
|
foreach ($configFiles as $conf) {
|
||||||
|
if (file_exists("$conf$suffix.bak")) {
|
||||||
|
|
||||||
|
if($conf === AirtimeIni194::CONF_FILE_AIRTIME) {
|
||||||
|
// Parse with sections
|
||||||
|
$newSettings = parse_ini_file($conf, true);
|
||||||
|
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$newSettings = AirtimeIni194::ReadPythonConfig($conf);
|
||||||
|
$oldSettings = AirtimeIni194::ReadPythonConfig("$conf$suffix.bak");
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings = array_keys($newSettings);
|
||||||
|
|
||||||
|
foreach($settings as $section) {
|
||||||
|
// skip airtim_dir as we want to use new value
|
||||||
|
if(isset($oldSettings[$section])) {
|
||||||
|
if(is_array($oldSettings[$section])) {
|
||||||
|
$sectionKeys = array_keys($newSettings[$section]);
|
||||||
|
foreach($sectionKeys as $sectionKey) {
|
||||||
|
if($sectionKey != "airtime_dir"){
|
||||||
|
if(isset($oldSettings[$section][$sectionKey])) {
|
||||||
|
AirtimeIni194::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AirtimeIni194::UpdateIniValue($conf, $section, $oldSettings[$section]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function upgradeConfigFiles(){
|
||||||
|
|
||||||
|
$configFiles = array(AirtimeIni194::CONF_FILE_AIRTIME,
|
||||||
|
AirtimeIni194::CONF_FILE_PYPO,
|
||||||
|
AirtimeIni194::CONF_FILE_RECORDER,
|
||||||
|
AirtimeIni194::CONF_FILE_LIQUIDSOAP);
|
||||||
|
|
||||||
|
// Backup the config files
|
||||||
|
$suffix = date("Ymdhis")."-1.9.4";
|
||||||
|
foreach ($configFiles as $conf) {
|
||||||
|
if (file_exists($conf)) {
|
||||||
|
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
||||||
|
copy($conf, $conf.$suffix.".bak");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$default_suffix = "194";
|
||||||
|
AirtimeIni194::CreateIniFiles($default_suffix);
|
||||||
|
AirtimeIni194::MergeConfigFiles($configFiles, $suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function creates the /etc/airtime configuration folder
|
||||||
|
* and copies the default config files to it.
|
||||||
|
*/
|
||||||
|
public static function CreateIniFiles($suffix)
|
||||||
|
{
|
||||||
|
if (!file_exists("/etc/airtime/")){
|
||||||
|
if (!mkdir("/etc/airtime/", 0755, true)){
|
||||||
|
echo "Could not create /etc/airtime/ directory. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!copy(__DIR__."/airtime.conf.$suffix", AirtimeIni194::CONF_FILE_AIRTIME)){
|
||||||
|
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/pypo.cfg.$suffix", AirtimeIni194::CONF_FILE_PYPO)){
|
||||||
|
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/recorder.cfg.$suffix", AirtimeIni194::CONF_FILE_RECORDER)){
|
||||||
|
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/liquidsoap.cfg.$suffix", AirtimeIni194::CONF_FILE_LIQUIDSOAP)){
|
||||||
|
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "* Updating configFiles\n";
|
||||||
|
AirtimeIni194::upgradeConfigFiles();
|
||||||
|
|
||||||
|
$values = parse_ini_file(Airtime194Upgrade::CONF_FILE_AIRTIME, true);
|
||||||
|
$phpDir = $values['general']['airtime_dir'];
|
||||||
|
Airtime194Upgrade::InstallAirtimePhpServerCode($phpDir);
|
||||||
|
Airtime194Upgrade::ModifyHtAccessTimezone($phpDir);
|
||||||
Airtime194Upgrade::upgradeLiquidsoapCfgPerms();
|
Airtime194Upgrade::upgradeLiquidsoapCfgPerms();
|
||||||
|
|
||||||
|
AirtimeInstall::CreateSymlinksToUtils();
|
||||||
|
|
||||||
|
|
23
install_minimal/upgrades/airtime-1.9.4/airtime.conf.194
Normal file
23
install_minimal/upgrades/airtime-1.9.4/airtime.conf.194
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
[database]
|
||||||
|
host = localhost
|
||||||
|
dbname = airtime
|
||||||
|
dbuser = airtime
|
||||||
|
dbpass = airtime
|
||||||
|
|
||||||
|
[rabbitmq]
|
||||||
|
host = 127.0.0.1
|
||||||
|
port = 5672
|
||||||
|
user = guest
|
||||||
|
password = guest
|
||||||
|
vhost = /
|
||||||
|
|
||||||
|
[general]
|
||||||
|
api_key = AAA
|
||||||
|
web_server_user = www-data
|
||||||
|
airtime_dir = /usr/share/airtime/
|
||||||
|
base_url = localhost
|
||||||
|
base_port = 80
|
||||||
|
|
||||||
|
[soundcloud]
|
||||||
|
connection_retries = 3
|
||||||
|
time_between_retries = 60
|
110
install_minimal/upgrades/airtime-1.9.4/api_client.cfg.194
Normal file
110
install_minimal/upgrades/airtime-1.9.4/api_client.cfg.194
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
bin_dir = "/usr/lib/airtime/api_clients"
|
||||||
|
|
||||||
|
#############################
|
||||||
|
## Common
|
||||||
|
#############################
|
||||||
|
|
||||||
|
# Value needed to access the API
|
||||||
|
api_key = 'AAA'
|
||||||
|
|
||||||
|
# Path to the base of the API
|
||||||
|
api_base = 'api'
|
||||||
|
|
||||||
|
# URL to get the version number of the server API
|
||||||
|
version_url = 'version/api_key/%%api_key%%'
|
||||||
|
|
||||||
|
# Hostname
|
||||||
|
base_url = 'localhost'
|
||||||
|
base_port = 80
|
||||||
|
|
||||||
|
#############################
|
||||||
|
## Config for Media Monitor
|
||||||
|
#############################
|
||||||
|
|
||||||
|
# URL to setup the media monitor
|
||||||
|
media_setup_url = 'media-monitor-setup/format/json/api_key/%%api_key%%'
|
||||||
|
|
||||||
|
# Tell Airtime the file id associated with a show instance.
|
||||||
|
upload_recorded = 'upload-recorded/format/json/api_key/%%api_key%%/fileid/%%fileid%%/showinstanceid/%%showinstanceid%%'
|
||||||
|
|
||||||
|
# URL to tell Airtime to update file's meta data
|
||||||
|
update_media_url = 'reload-metadata/format/json/api_key/%%api_key%%/mode/%%mode%%'
|
||||||
|
|
||||||
|
# URL to tell Airtime we want a listing of all files it knows about
|
||||||
|
list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%'
|
||||||
|
|
||||||
|
# URL to tell Airtime we want a listing of all dirs its watching (including the stor dir)
|
||||||
|
list_all_watched_dirs = 'list-all-watched-dirs/format/json/api_key/%%api_key%%'
|
||||||
|
|
||||||
|
# URL to tell Airtime we want to add watched directory
|
||||||
|
add_watched_dir = 'add-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||||
|
|
||||||
|
# URL to tell Airtime we want to add watched directory
|
||||||
|
remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||||
|
|
||||||
|
# URL to tell Airtime we want to add watched directory
|
||||||
|
set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||||
|
|
||||||
|
|
||||||
|
#############################
|
||||||
|
## Config for Recorder
|
||||||
|
#############################
|
||||||
|
|
||||||
|
# URL to get the schedule of shows set to record
|
||||||
|
show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%'
|
||||||
|
|
||||||
|
# URL to upload the recorded show's file to Airtime
|
||||||
|
upload_file_url = 'upload-file/format/json/api_key/%%api_key%%'
|
||||||
|
|
||||||
|
#number of retries to upload file if connection problem
|
||||||
|
upload_retries = 3
|
||||||
|
|
||||||
|
#time to wait between attempts to upload file if connection problem (in seconds)
|
||||||
|
upload_wait = 60
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Uncomment *one of the sets* of values from the API clients below, and comment
|
||||||
|
# out all the others.
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
#############################
|
||||||
|
## Config for Pypo
|
||||||
|
#############################
|
||||||
|
|
||||||
|
# Schedule export path.
|
||||||
|
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
|
||||||
|
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
|
||||||
|
export_url = 'schedule/api_key/%%api_key%%'
|
||||||
|
|
||||||
|
get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%'
|
||||||
|
|
||||||
|
# Update whether a schedule group has begun playing.
|
||||||
|
update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%'
|
||||||
|
|
||||||
|
# Update whether an audio clip is currently playing.
|
||||||
|
update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'
|
||||||
|
|
||||||
|
# ???
|
||||||
|
generate_range_url = 'generate_range_dp.php'
|
||||||
|
|
||||||
|
|
||||||
|
##############
|
||||||
|
# OBP config #
|
||||||
|
##############
|
||||||
|
|
||||||
|
# URL to get the version number of the server API
|
||||||
|
#version_url = 'api/pypo/status/json'
|
||||||
|
|
||||||
|
# Schedule export path.
|
||||||
|
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
|
||||||
|
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
|
||||||
|
|
||||||
|
# Update whether an item has been played.
|
||||||
|
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
|
||||||
|
|
||||||
|
# Update whether an item is currently playing.
|
||||||
|
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
|
||||||
|
|
||||||
|
# ???
|
||||||
|
#generate_range_url = 'api/pypo/generate_range_dp/'
|
||||||
|
|
55
install_minimal/upgrades/airtime-1.9.4/liquidsoap.cfg.194
Normal file
55
install_minimal/upgrades/airtime-1.9.4/liquidsoap.cfg.194
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
###########################################
|
||||||
|
# Liquidsoap config file #
|
||||||
|
###########################################
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
# Output settings #
|
||||||
|
###########################################
|
||||||
|
output_sound_device = false
|
||||||
|
output_icecast_vorbis = true
|
||||||
|
output_icecast_mp3 = false
|
||||||
|
output_shoutcast = false
|
||||||
|
|
||||||
|
#output_bitrate = 128
|
||||||
|
#output_samplerate = 44100
|
||||||
|
#output_stereo = true
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
# Logging settings #
|
||||||
|
###########################################
|
||||||
|
log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"
|
||||||
|
#log_level = 3
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
# Icecast Stream settings #
|
||||||
|
###########################################
|
||||||
|
icecast_host = "127.0.0.1"
|
||||||
|
icecast_port = 8000
|
||||||
|
icecast_pass = "hackme"
|
||||||
|
|
||||||
|
# Icecast mountpoint names
|
||||||
|
mount_point_mp3 = "airtime.mp3"
|
||||||
|
mount_point_vorbis = "airtime.ogg"
|
||||||
|
|
||||||
|
# Webstream metadata settings
|
||||||
|
icecast_url = "http://airtime.sourcefabric.org"
|
||||||
|
icecast_description = "Airtime Radio!"
|
||||||
|
icecast_genre = "genre"
|
||||||
|
|
||||||
|
# Audio stream metadata for vorbis/ogg is disabled by default
|
||||||
|
# due to a number of client media players that disconnect
|
||||||
|
# when the metadata changes to a new track. Some versions of
|
||||||
|
# mplayer and VLC have this problem. Enable this option at your
|
||||||
|
# own risk!
|
||||||
|
output_icecast_vorbis_metadata = false
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
# Shoutcast Stream settings #
|
||||||
|
###########################################
|
||||||
|
shoutcast_host = "127.0.0.1"
|
||||||
|
shoutcast_port = 9000
|
||||||
|
shoutcast_pass = "testing"
|
||||||
|
|
||||||
|
# Webstream metadata settings
|
||||||
|
shoutcast_url = "http://airtime.sourcefabric.org"
|
||||||
|
shoutcast_genre = "genre"
|
21
install_minimal/upgrades/airtime-1.9.4/media-monitor.cfg.194
Normal file
21
install_minimal/upgrades/airtime-1.9.4/media-monitor.cfg.194
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
api_client = "airtime"
|
||||||
|
|
||||||
|
# where the binary files live
|
||||||
|
bin_dir = '/usr/lib/airtime/media-monitor'
|
||||||
|
|
||||||
|
# where the logging files live
|
||||||
|
log_dir = '/var/log/airtime/media-monitor'
|
||||||
|
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# RabbitMQ settings #
|
||||||
|
############################################
|
||||||
|
rabbitmq_host = 'localhost'
|
||||||
|
rabbitmq_user = 'guest'
|
||||||
|
rabbitmq_password = 'guest'
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Media-Monitor preferences #
|
||||||
|
############################################
|
||||||
|
check_filesystem_events = 5 #how long to queue up events performed on the files themselves.
|
||||||
|
check_airtime_events = 30 #how long to queue metadata input from airtime.
|
72
install_minimal/upgrades/airtime-1.9.4/pypo.cfg.194
Normal file
72
install_minimal/upgrades/airtime-1.9.4/pypo.cfg.194
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
############################################
|
||||||
|
# pypo - configuration #
|
||||||
|
############################################
|
||||||
|
|
||||||
|
# Set the type of client you are using.
|
||||||
|
# Currently supported types:
|
||||||
|
# 1) "obp" = Open Broadcast Platform
|
||||||
|
# 2) "airtime"
|
||||||
|
#
|
||||||
|
api_client = "airtime"
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# 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 #
|
||||||
|
# Do *not* include trailing slash !! #
|
||||||
|
############################################
|
||||||
|
cache_base_dir = '/var/tmp/airtime/pypo'
|
||||||
|
bin_dir = '/usr/lib/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 #
|
||||||
|
############################################
|
||||||
|
ls_host = '127.0.0.1'
|
||||||
|
ls_port = '1234'
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# RabbitMQ settings #
|
||||||
|
############################################
|
||||||
|
rabbitmq_host = 'localhost'
|
||||||
|
rabbitmq_user = 'guest'
|
||||||
|
rabbitmq_password = 'guest'
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# pypo preferences #
|
||||||
|
############################################
|
||||||
|
prepare_ahead = 24 #in hours
|
||||||
|
cache_for = 24 #how long to hold the cache, in hours
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
poll_interval = 3600 # in seconds.
|
||||||
|
|
||||||
|
|
||||||
|
# Push interval in seconds.
|
||||||
|
#
|
||||||
|
# This is how often the push script checks whether it has something new to
|
||||||
|
# push to liquidsoap.
|
||||||
|
#
|
||||||
|
# It's hard to imagine a situation where this should be more than 1 second.
|
||||||
|
#
|
||||||
|
push_interval = 1 # in seconds
|
||||||
|
|
||||||
|
# 'pre' or 'otf'. 'pre' cues while playlist preparation
|
||||||
|
# while 'otf' (on the fly) cues while loading into ls
|
||||||
|
# (needs the post_processor patch)
|
||||||
|
cue_style = 'pre'
|
26
install_minimal/upgrades/airtime-1.9.4/recorder.cfg.194
Normal file
26
install_minimal/upgrades/airtime-1.9.4/recorder.cfg.194
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
api_client = "airtime"
|
||||||
|
|
||||||
|
# where the binary files live
|
||||||
|
bin_dir = '/usr/lib/airtime/show-recorder'
|
||||||
|
|
||||||
|
# base path to store recordered shows at
|
||||||
|
base_recorded_files = '/var/tmp/airtime/show-recorder/'
|
||||||
|
|
||||||
|
# where the logging files live
|
||||||
|
log_dir = '/var/log/airtime/show-recorder'
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# RabbitMQ settings #
|
||||||
|
############################################
|
||||||
|
rabbitmq_host = 'localhost'
|
||||||
|
rabbitmq_user = 'guest'
|
||||||
|
rabbitmq_password = 'guest'
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Recorded Audio settings #
|
||||||
|
############################################
|
||||||
|
record_bitrate = 256
|
||||||
|
record_samplerate = 44100
|
||||||
|
record_channels = 2
|
||||||
|
record_sample_size = 16
|
||||||
|
|
|
@ -178,7 +178,7 @@ class PypoFetch(Thread):
|
||||||
scheduled_data = dict()
|
scheduled_data = dict()
|
||||||
scheduled_data['liquidsoap_playlists'] = liquidsoap_playlists
|
scheduled_data['liquidsoap_playlists'] = liquidsoap_playlists
|
||||||
scheduled_data['schedule'] = playlists
|
scheduled_data['schedule'] = playlists
|
||||||
scheduled_data['stream_metadata'] = schedule_data["stream_metadata"]
|
scheduled_data['stream_metadata'] = schedule_data["stream_metadata"]
|
||||||
self.queue.put(scheduled_data)
|
self.queue.put(scheduled_data)
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
|
|
|
@ -41,13 +41,7 @@ class PypoPush(Thread):
|
||||||
self.playlists = dict()
|
self.playlists = dict()
|
||||||
self.stream_metadata = dict()
|
self.stream_metadata = dict()
|
||||||
|
|
||||||
"""
|
|
||||||
push_ahead2 MUST be < push_ahead. The difference in these two values
|
|
||||||
gives the number of seconds of the window of opportunity for the scheduler
|
|
||||||
to catch when a playlist is to be played.
|
|
||||||
"""
|
|
||||||
self.push_ahead = 10
|
self.push_ahead = 10
|
||||||
self.push_ahead2 = self.push_ahead -5
|
|
||||||
|
|
||||||
#toggle between "stop" and "play". Keeps track of the state of
|
#toggle between "stop" and "play". Keeps track of the state of
|
||||||
#liquidsoap
|
#liquidsoap
|
||||||
|
@ -82,26 +76,17 @@ class PypoPush(Thread):
|
||||||
|
|
||||||
currently_on_air = False
|
currently_on_air = False
|
||||||
if schedule:
|
if schedule:
|
||||||
playedItems = self.load_schedule_tracker()
|
|
||||||
|
|
||||||
timenow = time.time()
|
timenow = time.time()
|
||||||
tcoming = time.localtime(timenow + self.push_ahead)
|
tcoming = time.localtime(timenow + self.push_ahead)
|
||||||
str_tcoming_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming[0], tcoming[1], tcoming[2], tcoming[3], tcoming[4], tcoming[5])
|
str_tcoming_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming[0], tcoming[1], tcoming[2], tcoming[3], tcoming[4], tcoming[5])
|
||||||
|
|
||||||
tcoming2 = time.localtime(timenow + self.push_ahead2)
|
|
||||||
str_tcoming2_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming2[0], tcoming2[1], tcoming2[2], tcoming2[3], tcoming2[4], tcoming2[5])
|
|
||||||
|
|
||||||
tnow = time.localtime(timenow)
|
tnow = time.localtime(timenow)
|
||||||
str_tnow_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tnow[0], tnow[1], tnow[2], tnow[3], tnow[4], tnow[5])
|
str_tnow_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tnow[0], tnow[1], tnow[2], tnow[3], tnow[4], tnow[5])
|
||||||
|
|
||||||
for pkey in schedule:
|
for pkey in schedule:
|
||||||
plstart = schedule[pkey]['start'][0:19]
|
plstart = schedule[pkey]['start'][0:19]
|
||||||
#plstart = pkey[0:19]
|
|
||||||
|
|
||||||
#playedFlag = (pkey in playedItems) and playedItems[pkey].get("played", 0)
|
if str_tnow_s <= plstart and plstart < str_tcoming_s:
|
||||||
playedFlag = False
|
|
||||||
|
|
||||||
if plstart == str_tcoming_s or (plstart < str_tcoming_s and plstart > str_tcoming2_s and not playedFlag):
|
|
||||||
logger.debug('Preparing to push playlist scheduled at: %s', pkey)
|
logger.debug('Preparing to push playlist scheduled at: %s', pkey)
|
||||||
playlist = schedule[pkey]
|
playlist = schedule[pkey]
|
||||||
|
|
||||||
|
@ -111,14 +96,6 @@ class PypoPush(Thread):
|
||||||
# force liquidsoap to refresh.
|
# force liquidsoap to refresh.
|
||||||
if (self.push_liquidsoap(pkey, schedule, playlists) == 1):
|
if (self.push_liquidsoap(pkey, schedule, playlists) == 1):
|
||||||
logger.debug("Pushed to liquidsoap, updating 'played' status.")
|
logger.debug("Pushed to liquidsoap, updating 'played' status.")
|
||||||
# Marked the current playlist as 'played' in the schedule tracker
|
|
||||||
# so it is not called again in the next push loop.
|
|
||||||
# Write changes back to tracker file.
|
|
||||||
playedItems[pkey] = playlist
|
|
||||||
playedItems[pkey]['played'] = 1
|
|
||||||
schedule_tracker = open(self.schedule_tracker_file, "w")
|
|
||||||
pickle.dump(playedItems, schedule_tracker)
|
|
||||||
schedule_tracker.close()
|
|
||||||
|
|
||||||
# Call API to update schedule states
|
# Call API to update schedule states
|
||||||
logger.debug("Doing callback to server to update 'played' status.")
|
logger.debug("Doing callback to server to update 'played' status.")
|
||||||
|
@ -129,8 +106,6 @@ class PypoPush(Thread):
|
||||||
|
|
||||||
if show_start <= str_tnow_s and str_tnow_s < show_end:
|
if show_start <= str_tnow_s and str_tnow_s < show_end:
|
||||||
currently_on_air = True
|
currently_on_air = True
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if not currently_on_air and self.liquidsoap_state_play:
|
if not currently_on_air and self.liquidsoap_state_play:
|
||||||
logger.debug('Notifying Liquidsoap to stop playback.')
|
logger.debug('Notifying Liquidsoap to stop playback.')
|
||||||
|
@ -202,29 +177,6 @@ class PypoPush(Thread):
|
||||||
status = 0
|
status = 0
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def load_schedule_tracker(self):
|
|
||||||
logger = logging.getLogger('push')
|
|
||||||
playedItems = dict()
|
|
||||||
|
|
||||||
# create the file if it doesnt exist
|
|
||||||
if (not os.path.exists(self.schedule_tracker_file)):
|
|
||||||
try:
|
|
||||||
logger.debug('creating file ' + self.schedule_tracker_file)
|
|
||||||
schedule_tracker = open(self.schedule_tracker_file, 'w')
|
|
||||||
pickle.dump(playedItems, schedule_tracker)
|
|
||||||
schedule_tracker.close()
|
|
||||||
except Exception, e:
|
|
||||||
logger.error('Error creating schedule tracker file: %s', e)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
schedule_tracker = open(self.schedule_tracker_file, "r")
|
|
||||||
playedItems = pickle.load(schedule_tracker)
|
|
||||||
schedule_tracker.close()
|
|
||||||
except Exception, e:
|
|
||||||
logger.error('Unable to load schedule tracker file: %s', e)
|
|
||||||
|
|
||||||
return playedItems
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
loops = 0
|
loops = 0
|
||||||
heartbeat_period = math.floor(30/PUSH_INTERVAL)
|
heartbeat_period = math.floor(30/PUSH_INTERVAL)
|
||||||
|
|
|
@ -31,34 +31,37 @@ api_client = apc.api_client_factory(config)
|
||||||
# copy or move files
|
# copy or move files
|
||||||
# flag should be 'copy' or 'move'
|
# flag should be 'copy' or 'move'
|
||||||
def copy_or_move_files_to(paths, dest, flag):
|
def copy_or_move_files_to(paths, dest, flag):
|
||||||
for path in paths:
|
try:
|
||||||
if (path[0] == "/" or path[0] == "~"):
|
for path in paths:
|
||||||
path = os.path.realpath(path)
|
if (path[0] == "/" or path[0] == "~"):
|
||||||
else:
|
path = os.path.realpath(path)
|
||||||
path = currentDir+path
|
else:
|
||||||
path = apc.encode_to(path, 'utf-8')
|
path = currentDir+path
|
||||||
dest = apc.encode_to(dest, 'utf-8')
|
path = apc.encode_to(path, 'utf-8')
|
||||||
if(os.path.exists(path)):
|
dest = apc.encode_to(dest, 'utf-8')
|
||||||
if(os.path.isdir(path)):
|
if(os.path.exists(path)):
|
||||||
path = format_dir_string(path)
|
if(os.path.isdir(path)):
|
||||||
#construct full path
|
path = format_dir_string(path)
|
||||||
sub_path = []
|
#construct full path
|
||||||
for temp in os.listdir(path):
|
sub_path = []
|
||||||
sub_path.append(path+temp)
|
for temp in os.listdir(path):
|
||||||
copy_or_move_files_to(sub_path, dest, flag)
|
sub_path.append(path+temp)
|
||||||
elif(os.path.isfile(path)):
|
copy_or_move_files_to(sub_path, dest, flag)
|
||||||
#copy file to dest
|
elif(os.path.isfile(path)):
|
||||||
ext = os.path.splitext(path)[1]
|
#copy file to dest
|
||||||
if( 'mp3' in ext or 'ogg' in ext ):
|
ext = os.path.splitext(path)[1]
|
||||||
destfile = dest+os.path.basename(path)
|
if( 'mp3' in ext or 'ogg' in ext ):
|
||||||
if(flag == 'copy'):
|
destfile = dest+os.path.basename(path)
|
||||||
print "Copying %(src)s to %(dest)s..." % {'src':path, 'dest':destfile}
|
if(flag == 'copy'):
|
||||||
shutil.copyfile(path, destfile)
|
print "Copying %(src)s to %(dest)s..." % {'src':path, 'dest':destfile}
|
||||||
elif(flag == 'move'):
|
shutil.copyfile(path, destfile)
|
||||||
print "Moving %(src)s to %(dest)s..." % {'src':path, 'dest':destfile}
|
elif(flag == 'move'):
|
||||||
shutil.move(path, destfile)
|
print "Moving %(src)s to %(dest)s..." % {'src':path, 'dest':destfile}
|
||||||
else:
|
shutil.move(path, destfile)
|
||||||
print "Cannot find file or path: %s" % path
|
else:
|
||||||
|
print "Cannot find file or path: %s" % path
|
||||||
|
except Exception as e:
|
||||||
|
print "Error: ", e
|
||||||
|
|
||||||
def format_dir_string(path):
|
def format_dir_string(path):
|
||||||
if(path[-1] != '/'):
|
if(path[-1] != '/'):
|
||||||
|
@ -84,10 +87,8 @@ def checkOtherOption(args):
|
||||||
def errorIfMultipleOption(args, msg=''):
|
def errorIfMultipleOption(args, msg=''):
|
||||||
if(checkOtherOption(args)):
|
if(checkOtherOption(args)):
|
||||||
if(msg != ''):
|
if(msg != ''):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError(msg)
|
raise OptionValueError(msg)
|
||||||
else:
|
else:
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("This option cannot be combined with other options")
|
raise OptionValueError("This option cannot be combined with other options")
|
||||||
|
|
||||||
def printHelp():
|
def printHelp():
|
||||||
|
@ -123,18 +124,17 @@ There are two ways to import audio files into Airtime:
|
||||||
def CopyAction(option, opt, value, parser):
|
def CopyAction(option, opt, value, parser):
|
||||||
errorIfMultipleOption(parser.rargs)
|
errorIfMultipleOption(parser.rargs)
|
||||||
if(len(parser.rargs) == 0 ):
|
if(len(parser.rargs) == 0 ):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("No argument found. This option requires at least one argument.")
|
raise OptionValueError("No argument found. This option requires at least one argument.")
|
||||||
stor = helper_get_stor_dir()
|
stor = helper_get_stor_dir()
|
||||||
if(stor is None):
|
if(stor is None):
|
||||||
exit("Unable to connect to the Airtime server.")
|
print "Unable to connect to the Airtime server."
|
||||||
|
return
|
||||||
dest = stor+"organize/"
|
dest = stor+"organize/"
|
||||||
copy_or_move_files_to(parser.rargs, dest, 'copy')
|
copy_or_move_files_to(parser.rargs, dest, 'copy')
|
||||||
|
|
||||||
def MoveAction(option, opt, value, parser):
|
def MoveAction(option, opt, value, parser):
|
||||||
errorIfMultipleOption(parser.rargs)
|
errorIfMultipleOption(parser.rargs)
|
||||||
if(len(parser.rargs) == 0 ):
|
if(len(parser.rargs) == 0 ):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("No argument found. This option requires at least one argument.")
|
raise OptionValueError("No argument found. This option requires at least one argument.")
|
||||||
stor = helper_get_stor_dir()
|
stor = helper_get_stor_dir()
|
||||||
if(stor is None):
|
if(stor is None):
|
||||||
|
@ -145,10 +145,8 @@ def MoveAction(option, opt, value, parser):
|
||||||
def WatchAddAction(option, opt, value, parser):
|
def WatchAddAction(option, opt, value, parser):
|
||||||
errorIfMultipleOption(parser.rargs)
|
errorIfMultipleOption(parser.rargs)
|
||||||
if(len(parser.rargs) > 1):
|
if(len(parser.rargs) > 1):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
||||||
elif(len(parser.rargs) == 0 ):
|
elif(len(parser.rargs) == 0 ):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
||||||
path = parser.rargs[0]
|
path = parser.rargs[0]
|
||||||
if (path[0] == "/" or path[0] == "~"):
|
if (path[0] == "/" or path[0] == "~"):
|
||||||
|
@ -171,7 +169,6 @@ def WatchAddAction(option, opt, value, parser):
|
||||||
def WatchListAction(option, opt, value, parser):
|
def WatchListAction(option, opt, value, parser):
|
||||||
errorIfMultipleOption(parser.rargs)
|
errorIfMultipleOption(parser.rargs)
|
||||||
if(len(parser.rargs) > 0):
|
if(len(parser.rargs) > 0):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("This option doesn't take any arguments.")
|
raise OptionValueError("This option doesn't take any arguments.")
|
||||||
res = api_client.list_all_watched_dirs()
|
res = api_client.list_all_watched_dirs()
|
||||||
if(res is None):
|
if(res is None):
|
||||||
|
@ -188,10 +185,8 @@ def WatchListAction(option, opt, value, parser):
|
||||||
def WatchRemoveAction(option, opt, value, parser):
|
def WatchRemoveAction(option, opt, value, parser):
|
||||||
errorIfMultipleOption(parser.rargs)
|
errorIfMultipleOption(parser.rargs)
|
||||||
if(len(parser.rargs) > 1):
|
if(len(parser.rargs) > 1):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
||||||
elif(len(parser.rargs) == 0 ):
|
elif(len(parser.rargs) == 0 ):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
||||||
path = parser.rargs[0]
|
path = parser.rargs[0]
|
||||||
if (path[0] == "/" or path[0] == "~"):
|
if (path[0] == "/" or path[0] == "~"):
|
||||||
|
@ -234,10 +229,8 @@ def StorageSetAction(option, opt, value, parser):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if(len(parser.rargs) > 1):
|
if(len(parser.rargs) > 1):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
||||||
elif(len(parser.rargs) == 0 ):
|
elif(len(parser.rargs) == 0 ):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
||||||
|
|
||||||
path = parser.rargs[0]
|
path = parser.rargs[0]
|
||||||
|
@ -261,10 +254,13 @@ def StorageSetAction(option, opt, value, parser):
|
||||||
def StorageGetAction(option, opt, value, parser):
|
def StorageGetAction(option, opt, value, parser):
|
||||||
errorIfMultipleOption(parser.rargs)
|
errorIfMultipleOption(parser.rargs)
|
||||||
if(len(parser.rargs) > 0):
|
if(len(parser.rargs) > 0):
|
||||||
printHelp()
|
|
||||||
raise OptionValueError("This option does not take any arguments.")
|
raise OptionValueError("This option does not take any arguments.")
|
||||||
print helper_get_stor_dir()
|
print helper_get_stor_dir()
|
||||||
|
|
||||||
|
class OptionValueError(RuntimeError):
|
||||||
|
def __init__(self, msg):
|
||||||
|
self.msg = msg
|
||||||
|
|
||||||
usage = """[-c|--copy FILE/DIR [FILE/DIR...]] [-m|--move FILE/DIR [FILE/DIR...]]
|
usage = """[-c|--copy FILE/DIR [FILE/DIR...]] [-m|--move FILE/DIR [FILE/DIR...]]
|
||||||
[--watch-add DIR] [--watch-list] [--watch-remove DIR]
|
[--watch-add DIR] [--watch-list] [--watch-remove DIR]
|
||||||
[--storage-dir-set DIR] [--storage-dir-get]"""
|
[--storage-dir-set DIR] [--storage-dir-get]"""
|
||||||
|
@ -294,7 +290,19 @@ if(len(sys.argv) == 1 or '-' not in sys.argv[1]):
|
||||||
printHelp()
|
printHelp()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
(option, args) = parser.parse_args()
|
try:
|
||||||
|
(option, args) = parser.parse_args()
|
||||||
|
except Exception, e:
|
||||||
|
printHelp()
|
||||||
|
if hasattr(e, 'msg'):
|
||||||
|
print "Error: "+e.msg
|
||||||
|
else:
|
||||||
|
print "Error: ",e
|
||||||
|
sys.exit()
|
||||||
|
except SystemExit:
|
||||||
|
printHelp()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
if option.help:
|
if option.help:
|
||||||
printHelp()
|
printHelp()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue