Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
963976b87e
|
@ -329,7 +329,7 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSystemInfo($returnArray=false){
|
public static function GetSystemInfo($returnArray=false){
|
||||||
exec('/usr/bin/airtime-check-system', $output);
|
exec('/usr/bin/airtime-check-system --no-color', $output);
|
||||||
|
|
||||||
$output = preg_replace('/\s+/', ' ', $output);
|
$output = preg_replace('/\s+/', ' ', $output);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class CcFilesTableMap extends TableMap {
|
||||||
$this->addColumn('SOUNDCLOUD_ID', 'DbSoundcloudId', 'INTEGER', false, null, null);
|
$this->addColumn('SOUNDCLOUD_ID', 'DbSoundcloudId', 'INTEGER', false, null, null);
|
||||||
$this->addColumn('SOUNDCLOUD_ERROR_CODE', 'DbSoundcloudErrorCode', 'INTEGER', false, null, null);
|
$this->addColumn('SOUNDCLOUD_ERROR_CODE', 'DbSoundcloudErrorCode', 'INTEGER', false, null, null);
|
||||||
$this->addColumn('SOUNDCLOUD_ERROR_MSG', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null);
|
$this->addColumn('SOUNDCLOUD_ERROR_MSG', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null);
|
||||||
$this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 512, null);
|
$this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
<column name="soundcloud_id" phpName="DbSoundcloudId" type="Integer" required="false"/>
|
<column name="soundcloud_id" phpName="DbSoundcloudId" type="Integer" required="false"/>
|
||||||
<column name="soundcloud_error_code" phpName="DbSoundcloudErrorCode" type="Integer" required="false"/>
|
<column name="soundcloud_error_code" phpName="DbSoundcloudErrorCode" type="Integer" required="false"/>
|
||||||
<column name="soundcloud_error_msg" phpName="DbSoundcloudErrorMsg" type="VARCHAR" size="512" required="false"/>
|
<column name="soundcloud_error_msg" phpName="DbSoundcloudErrorMsg" type="VARCHAR" size="512" required="false"/>
|
||||||
<column name="soundcloud_link_to_file" phpName="DbSoundcloudLinkToFile" type="VARCHAR" size="512" required="false"/>
|
<column name="soundcloud_link_to_file" phpName="DbSoundcloudLinkToFile" type="VARCHAR" size="4096" required="false"/>
|
||||||
<foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">
|
<foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">
|
||||||
<reference local="editedby" foreign="id"/>
|
<reference local="editedby" foreign="id"/>
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
|
|
|
@ -117,7 +117,7 @@ CREATE TABLE "cc_files"
|
||||||
"soundcloud_id" INTEGER,
|
"soundcloud_id" INTEGER,
|
||||||
"soundcloud_error_code" INTEGER,
|
"soundcloud_error_code" INTEGER,
|
||||||
"soundcloud_error_msg" VARCHAR(512),
|
"soundcloud_error_msg" VARCHAR(512),
|
||||||
"soundcloud_link_to_file" VARCHAR(512),
|
"soundcloud_link_to_file" VARCHAR(4096),
|
||||||
PRIMARY KEY ("id"),
|
PRIMARY KEY ("id"),
|
||||||
CONSTRAINT "cc_files_gunid_idx" UNIQUE ("gunid")
|
CONSTRAINT "cc_files_gunid_idx" UNIQUE ("gunid")
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
$command = "php $dir/../airtime_mvc/library/doctrine/migrations/doctrine-migrations.phar --configuration=$dir/../install_minimal/DoctrineMigrations/migrations.xml --db-configuration=$dir/../airtime_mvc/library/doctrine/migrations/migrations-db.php --no-interaction migrations:generate";
|
$command = "php --php-ini $dir/../install_minimal/airtime-php.ini $dir/../airtime_mvc/library/doctrine/migrations/doctrine-migrations.phar --configuration=$dir/../install_minimal/DoctrineMigrations/migrations.xml --db-configuration=$dir/../airtime_mvc/library/doctrine/migrations/migrations-db.php --no-interaction migrations:generate";
|
||||||
system($command);
|
system($command);
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||||
|
Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
|
class Version20111102142811 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(Schema $schema)
|
||||||
|
{
|
||||||
|
// change 'soundcloud_upload' -> 'soundcloud_auto_upload_recorded_show' CC-2928
|
||||||
|
$this->_addSql("UPDATE cc_pref SET keystr = 'soundcloud_auto_upload_recorded_show'
|
||||||
|
WHERE keystr = 'soundcloud_upload'");
|
||||||
|
|
||||||
|
// add soundcloud_link_to_file
|
||||||
|
$cc_files = $schema->getTable('cc_files');
|
||||||
|
$cc_files->addColumn('soundcloud_link_to_file', 'string', array('length' => 4096, 'notnull' => 0, 'default'=> NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||||
|
Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
|
class Version20111103141311 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(Schema $schema)
|
||||||
|
{
|
||||||
|
// add timezone column to cc_show_days
|
||||||
|
$cc_subjs = $schema->getTable('cc_show_days');
|
||||||
|
$cc_subjs->addColumn('timezone', 'string', array('required' => true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,12 +36,19 @@ echo -e "\n******************************** Install Begin **********************
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=`readlink -f $0`
|
||||||
# Absolute path this script is in, thus /home/user/bin
|
# Absolute path this script is in, thus /home/user/bin
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=`dirname $SCRIPT`
|
||||||
|
AIRTIMEROOT=$SCRIPTPATH/../
|
||||||
|
|
||||||
python $SCRIPTPATH/../python_apps/create-pypo-user.py
|
rm -rf "/usr/lib/airtime"
|
||||||
|
$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh
|
||||||
|
python $AIRTIMEROOT/python_apps/create-pypo-user.py
|
||||||
|
|
||||||
$SCRIPTPATH/include/airtime-copy-files.sh
|
$SCRIPTPATH/include/airtime-copy-files.sh
|
||||||
$SCRIPTPATH/include/airtime-initialize.sh $@
|
$SCRIPTPATH/include/airtime-initialize.sh $@
|
||||||
|
|
||||||
|
#Hack to parse rabbitmq pid and place it into the correct directory. This is also
|
||||||
|
#done in our rabbitmq init.d script, but placing it here so that monit recognizes
|
||||||
|
# it faster (in time for the airtime-check-system)
|
||||||
|
sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid
|
||||||
|
|
||||||
echo -e "\n*** Verifying your system environment, running airtime-check-system ***"
|
echo -e "\n*** Verifying your system environment, running airtime-check-system ***"
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
#-e Causes bash script to exit if any of the installers
|
|
||||||
#return with a non-zero return value.
|
|
||||||
|
|
||||||
if [ `whoami` != 'root' ]; then
|
|
||||||
echo "Please run as root user."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set +e
|
|
||||||
DEB=$(dpkg -s airtime 2> /dev/null | grep Status)
|
|
||||||
set -e
|
|
||||||
if [[ "$DEB" = "Status: install ok installed" ]]; then
|
|
||||||
echo -e "\nDebian package of Airtime detected. Please use the debian package to upgrade.\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#Check whether version of virtualenv is <= 1.4.8. If so exit install.
|
|
||||||
BAD_VERSION="1.4.8"
|
|
||||||
VERSION=$(virtualenv --version)
|
|
||||||
NEWEST_VERSION=$(echo -e "$BAD_VERSION\n$VERSION\n'" | sort -t '.' -g | tail -n 1)
|
|
||||||
echo -n "Ensuring python-virtualenv version > $BAD_VERSION..."
|
|
||||||
if [[ "$NEWEST_VERSION" = "$BAD_VERSION" ]]; then
|
|
||||||
URL="http://apt.sourcefabric.org/pool/main/p/python-virtualenv/python-virtualenv_1.4.9-3_all.deb"
|
|
||||||
echo "Failed!"
|
|
||||||
echo "You have version $BAD_VERSION or older installed. Please install package at $URL first and then try installing Airtime again."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Success!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "\n******************************** Install Begin *********************************"
|
|
||||||
|
|
||||||
# Absolute path to this script
|
|
||||||
SCRIPT=`readlink -f $0`
|
|
||||||
# Absolute directory this script is in
|
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
|
||||||
|
|
||||||
${SCRIPTPATH}/../python_apps/python-virtualenv/virtualenv-install.sh
|
|
||||||
|
|
||||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
|
||||||
. ${virtualenv_bin}activate
|
|
||||||
|
|
||||||
echo -e "\n*** Creating Pypo User ***"
|
|
||||||
python ${SCRIPTPATH}/../python_apps/create-pypo-user.py
|
|
||||||
|
|
||||||
set +e
|
|
||||||
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-install.php $@
|
|
||||||
result=$?
|
|
||||||
|
|
||||||
if [ "$result" -ne "0" ]; then
|
|
||||||
#There was an error, exit with error code.
|
|
||||||
echo "There was an error during upgrade. Exit code $result"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo -e "\n*** API Client Installation ***"
|
|
||||||
python ${SCRIPTPATH}/../python_apps/api_clients/install/api_client_install.py
|
|
||||||
|
|
||||||
echo -e "\n*** Pypo Installation ***"
|
|
||||||
python ${SCRIPTPATH}/../python_apps/pypo/install/pypo-install.py
|
|
||||||
|
|
||||||
echo -e "\n*** Recorder Installation ***"
|
|
||||||
python ${SCRIPTPATH}/../python_apps/show-recorder/install/recorder-install.py
|
|
||||||
|
|
||||||
echo -e "\n*** Media Monitor Installation ***"
|
|
||||||
python ${SCRIPTPATH}/../python_apps/media-monitor/install/media-monitor-install.py
|
|
||||||
|
|
||||||
python ${SCRIPTPATH}/../python_apps/icecast2/install/icecast2-install.py
|
|
||||||
|
|
||||||
# Start monit if it is not running, or restart if it is.
|
|
||||||
# Need to ensure monit is running before Airtime daemons are run. This is
|
|
||||||
# so we can ensure they can register with monit to monitor them when they start.
|
|
||||||
# If monit is already running, this step is still useful as we need monit to
|
|
||||||
# reload its config files.
|
|
||||||
/etc/init.d/monit restart
|
|
||||||
|
|
||||||
#give monit some time to boot-up before issuing commands
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
set +e
|
|
||||||
monit monitor airtime-media-monitor
|
|
||||||
monit monitor airtime-liquidsoap
|
|
||||||
monit monitor airtime-playout
|
|
||||||
monit monitor airtime-show-recorder
|
|
||||||
monit monitor rabbitmq-server
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo -e "\n*** Verifying your system environment ***"
|
|
||||||
sleep 10
|
|
||||||
airtime-check-system
|
|
||||||
|
|
||||||
echo -e "\n******************************* Install Complete *******************************"
|
|
|
@ -6,6 +6,8 @@ if [ `whoami` != 'root' ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -e "\n******************************* Uninstall Begin ********************************"
|
||||||
|
|
||||||
# Absolute path to this script, e.g. /home/user/bin/foo.sh
|
# Absolute path to this script, e.g. /home/user/bin/foo.sh
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=`readlink -f $0`
|
||||||
# Absolute path this script is in, thus /home/user/bin
|
# Absolute path this script is in, thus /home/user/bin
|
||||||
|
@ -19,3 +21,5 @@ $SCRIPTPATH/include/airtime-remove-files.sh
|
||||||
|
|
||||||
#Remove pypo user
|
#Remove pypo user
|
||||||
python $SCRIPTPATH/../python_apps/remove-pypo-user.py
|
python $SCRIPTPATH/../python_apps/remove-pypo-user.py
|
||||||
|
|
||||||
|
echo -e "\n****************************** Uninstall Complete *******************************"
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ `whoami` != 'root' ]; then
|
|
||||||
echo "Please run as root user."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
VIRTUAL_ENV_DIR="/usr/lib/airtime/airtime_virtualenv"
|
|
||||||
if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
|
|
||||||
echo -e "\nAirtime is not installed, cannot uninstall.\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
|
||||||
. ${virtualenv_bin}activate
|
|
||||||
|
|
||||||
#Cause bash script to exit if any of the installers
|
|
||||||
#return with a non-zero return value.
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Absolute path to this script
|
|
||||||
SCRIPT=`readlink -f $0`
|
|
||||||
# Absolute directory this script is in
|
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
|
||||||
|
|
||||||
echo -e "\n******************************* Uninstall Begin ********************************"
|
|
||||||
|
|
||||||
set +e
|
|
||||||
monit unmonitor rabbitmq-server >/dev/null 2>&1
|
|
||||||
set -e
|
|
||||||
|
|
||||||
$SCRIPTPATH/include/airtime-uninitialize.sh
|
|
||||||
$SCRIPTPATH/include/airtime-remove-files.sh
|
|
||||||
|
|
||||||
#echo -e "\n*** Uninstalling Pypo ***"
|
|
||||||
#python ${SCRIPTPATH}/../python_apps/pypo/install/pypo-uninstall.py
|
|
||||||
|
|
||||||
#echo -e "\n*** Uninstalling Show Recorder ***"
|
|
||||||
#python ${SCRIPTPATH}/../python_apps/show-recorder/install/recorder-uninstall.py
|
|
||||||
|
|
||||||
#echo -e "\n*** Uninstalling Media Monitor ***"
|
|
||||||
#python ${SCRIPTPATH}/../python_apps/media-monitor/install/media-monitor-uninstall.py
|
|
||||||
|
|
||||||
#echo -e "\n*** Uninstalling API Client ***"
|
|
||||||
#python ${SCRIPTPATH}/../python_apps/api_clients/install/api_client_uninstall.py
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "\n*** Removing Pypo User ***"
|
|
||||||
python ${SCRIPTPATH}/../python_apps/remove-pypo-user.py
|
|
||||||
|
|
||||||
#php ${SCRIPTPATH}/include/airtime-uninstall.php
|
|
||||||
|
|
||||||
echo -e "\n****************************** Uninstall Complete ******************************\n"
|
|
||||||
echo "NOTE: To fully remove all Airtime files, you will also have to manually delete"
|
|
||||||
echo " the directories '/srv/airtime'(default storage location of media files)"
|
|
||||||
echo -e " and '/etc/airtime'(where the config files are stored).\n"
|
|
|
@ -43,7 +43,7 @@ class AirtimeInstall
|
||||||
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "New Airtime Install.".PHP_EOL;
|
//echo "New Airtime Install.".PHP_EOL;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class AirtimeInstall
|
||||||
|
|
||||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
||||||
if (PEAR::isError($CC_DBC)) {
|
if (PEAR::isError($CC_DBC)) {
|
||||||
echo "New Airtime Install.".PHP_EOL;
|
//echo "New Airtime Install.".PHP_EOL;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -431,8 +431,6 @@ class AirtimeInstall
|
||||||
public static function CreateZendPhpLogFile(){
|
public static function CreateZendPhpLogFile(){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
echo "* Creating logs directory ".AirtimeInstall::CONF_DIR_LOG.PHP_EOL;
|
|
||||||
|
|
||||||
$path = AirtimeInstall::CONF_DIR_LOG;
|
$path = AirtimeInstall::CONF_DIR_LOG;
|
||||||
$file = $path.'/zendphp.log';
|
$file = $path.'/zendphp.log';
|
||||||
if (!file_exists($path)){
|
if (!file_exists($path)){
|
||||||
|
|
|
@ -33,39 +33,64 @@ SCRIPTPATH=`dirname $SCRIPT`
|
||||||
|
|
||||||
AIRTIMEROOT=$SCRIPTPATH/../../
|
AIRTIMEROOT=$SCRIPTPATH/../../
|
||||||
|
|
||||||
|
echo "* Creating /etc/airtime"
|
||||||
mkdir -p /etc/airtime
|
mkdir -p /etc/airtime
|
||||||
|
if [ ! -e /etc/airtime/airtime.conf ]; then
|
||||||
cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime
|
cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime
|
||||||
cp $AIRTIMEROOT/python_apps/api_clients/api_client.cfg /etc/airtime
|
fi
|
||||||
cp $AIRTIMEROOT/python_apps/show-recorder/recorder.cfg /etc/airtime
|
|
||||||
cp $AIRTIMEROOT/python_apps/media-monitor/media-monitor.cfg /etc/airtime
|
|
||||||
cp $AIRTIMEROOT/python_apps/pypo/pypo.cfg /etc/airtime
|
|
||||||
cp $AIRTIMEROOT/python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg /etc/airtime
|
|
||||||
|
|
||||||
|
if [ ! -e /etc/airtime/api_client.cfg ]; then
|
||||||
|
cp $AIRTIMEROOT/python_apps/api_clients/api_client.cfg /etc/airtime
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e /etc/airtime/recorder.cfg ]; then
|
||||||
|
cp $AIRTIMEROOT/python_apps/show-recorder/recorder.cfg /etc/airtime
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e /etc/airtime/media-monitor.cfg ]; then
|
||||||
|
cp $AIRTIMEROOT/python_apps/media-monitor/media-monitor.cfg /etc/airtime
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e /etc/airtime/pypo.cfg ]; then
|
||||||
|
cp $AIRTIMEROOT/python_apps/pypo/pypo.cfg /etc/airtime
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e /etc/airtime/liquidsoap.cfg ]; then
|
||||||
|
cp $AIRTIMEROOT/python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg /etc/airtime
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "* Creating /etc/cron.d/airtime-crons"
|
||||||
HOUR=$(($RANDOM%24))
|
HOUR=$(($RANDOM%24))
|
||||||
MIN=$(($RANDOM%60))
|
MIN=$(($RANDOM%60))
|
||||||
echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons
|
echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons
|
||||||
|
|
||||||
$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh
|
|
||||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
. ${virtualenv_bin}activate
|
. ${virtualenv_bin}activate
|
||||||
|
|
||||||
|
echo "* Creating /usr/lib/airtime"
|
||||||
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py
|
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py
|
||||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-install-files.py
|
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
|
||||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-install-files.py
|
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-copy-files.py
|
||||||
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-install-files.py
|
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py
|
||||||
|
|
||||||
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
|
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
|
||||||
|
|
||||||
|
echo "* Creating symbolic links in /usr/bin"
|
||||||
#create symbolic links
|
#create symbolic links
|
||||||
ln -sf /usr/lib/airtime/utils/airtime-import/airtime-import /usr/bin/airtime-import
|
ln -sf /usr/lib/airtime/utils/airtime-import/airtime-import /usr/bin/airtime-import
|
||||||
ln -sf /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update-db-settings
|
ln -sf /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update-db-settings
|
||||||
ln -sf /usr/lib/airtime/utils/airtime-check-system /usr/bin/airtime-check-system
|
ln -sf /usr/lib/airtime/utils/airtime-check-system /usr/bin/airtime-check-system
|
||||||
ln -sf /usr/lib/airtime/utils/airtime-log /usr/bin/airtime-log
|
ln -sf /usr/lib/airtime/utils/airtime-log /usr/bin/airtime-log
|
||||||
|
|
||||||
|
echo "* Creating /usr/share/airtime"
|
||||||
|
rm -rf "/usr/share/airtime"
|
||||||
mkdir -p /usr/share/airtime
|
mkdir -p /usr/share/airtime
|
||||||
cp -R $AIRTIMEROOT/airtime_mvc/* /usr/share/airtime/
|
cp -R $AIRTIMEROOT/airtime_mvc/* /usr/share/airtime/
|
||||||
|
|
||||||
|
echo "* Creating /var/log/airtime"
|
||||||
mkdir -p /var/log/airtime
|
mkdir -p /var/log/airtime
|
||||||
|
|
||||||
|
echo "* Creating /var/tmp/airtime"
|
||||||
mkdir -p /var/tmp/airtime
|
mkdir -p /var/tmp/airtime
|
||||||
|
|
||||||
#Finished copying files
|
#Finished copying files
|
||||||
|
|
|
@ -13,7 +13,7 @@ require_once(__DIR__.'/airtime-constants.php');
|
||||||
|
|
||||||
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
||||||
|
|
||||||
echo PHP_EOL."*** Database Installation ***".PHP_EOL;
|
echo PHP_EOL."* Database Installation".PHP_EOL;
|
||||||
|
|
||||||
AirtimeInstall::CreateDatabaseUser();
|
AirtimeInstall::CreateDatabaseUser();
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ SCRIPTPATH=`dirname $SCRIPT`
|
||||||
|
|
||||||
AIRTIMEROOT=$SCRIPTPATH/../../
|
AIRTIMEROOT=$SCRIPTPATH/../../
|
||||||
|
|
||||||
$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh
|
|
||||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
. ${virtualenv_bin}activate
|
. ${virtualenv_bin}activate
|
||||||
|
|
||||||
|
@ -48,5 +47,5 @@ monit monitor airtime-media-monitor
|
||||||
monit monitor airtime-liquidsoap
|
monit monitor airtime-liquidsoap
|
||||||
monit monitor airtime-playout
|
monit monitor airtime-playout
|
||||||
monit monitor airtime-show-recorder
|
monit monitor airtime-show-recorder
|
||||||
#monit monitor rabbitmq-server
|
monit monitor rabbitmq-server
|
||||||
set -e
|
set -e
|
||||||
|
|
|
@ -29,7 +29,6 @@ AIRTIMEROOT=$SCRIPTPATH/../../
|
||||||
|
|
||||||
rm -f /etc/cron.d/airtime-crons
|
rm -f /etc/cron.d/airtime-crons
|
||||||
|
|
||||||
$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh
|
|
||||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
. ${virtualenv_bin}activate
|
. ${virtualenv_bin}activate
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ monit unmonitor airtime-show-recorder >/dev/null 2>&1
|
||||||
#monit unmonitor rabbitmq-server
|
#monit unmonitor rabbitmq-server
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
|
. ${virtualenv_bin}activate
|
||||||
|
|
||||||
#uninitialize Airtime services
|
#uninitialize Airtime services
|
||||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-uninitialize.py
|
python $AIRTIMEROOT/python_apps/pypo/install/pypo-uninitialize.py
|
||||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-uninitialize.py
|
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-uninitialize.py
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
set_include_path(__DIR__.'/../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
||||||
|
require_once('DB.php');
|
||||||
|
|
||||||
/* These are helper functions that are common to each upgrade such as
|
/* These are helper functions that are common to each upgrade such as
|
||||||
* creating connections to a database, backing up config files etc.
|
* creating connections to a database, backing up config files etc.
|
||||||
*/
|
*/
|
||||||
|
@ -13,6 +16,27 @@ class UpgradeCommon{
|
||||||
|
|
||||||
const CONF_PYPO_GRP = "pypo";
|
const CONF_PYPO_GRP = "pypo";
|
||||||
const CONF_WWW_DATA_GRP = "www-data";
|
const CONF_WWW_DATA_GRP = "www-data";
|
||||||
|
const CONF_BACKUP_SUFFIX = "200";
|
||||||
|
const VERSION_NUMBER = "2.0";
|
||||||
|
|
||||||
|
public static function connectToDatabase($p_exitOnError = true)
|
||||||
|
{
|
||||||
|
global $CC_DBC, $CC_CONFIG;
|
||||||
|
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
||||||
|
if (PEAR::isError($CC_DBC)) {
|
||||||
|
echo $CC_DBC->getMessage().PHP_EOL;
|
||||||
|
echo $CC_DBC->getUserInfo().PHP_EOL;
|
||||||
|
echo "Database connection problem.".PHP_EOL;
|
||||||
|
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
|
||||||
|
" with corresponding permissions.".PHP_EOL;
|
||||||
|
if ($p_exitOnError) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function DbTableExists($p_name)
|
public static function DbTableExists($p_name)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +57,8 @@ class UpgradeCommon{
|
||||||
public static function MigrateTablesToVersion($dir, $version)
|
public static function MigrateTablesToVersion($dir, $version)
|
||||||
{
|
{
|
||||||
$appDir = self::GetAirtimeSrcDir();
|
$appDir = self::GetAirtimeSrcDir();
|
||||||
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
$command = "php --php-ini $dir/../../airtime-php.ini ".
|
||||||
|
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
"--no-interaction migrations:migrate $version";
|
"--no-interaction migrations:migrate $version";
|
||||||
|
@ -43,7 +68,8 @@ class UpgradeCommon{
|
||||||
public static function BypassMigrations($dir, $version)
|
public static function BypassMigrations($dir, $version)
|
||||||
{
|
{
|
||||||
$appDir = self::GetAirtimeSrcDir();
|
$appDir = self::GetAirtimeSrcDir();
|
||||||
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
$command = "php --php-ini $dir/../../airtime-php.ini ".
|
||||||
|
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
"--no-interaction --add migrations:version $version";
|
"--no-interaction --add migrations:version $version";
|
||||||
|
@ -60,7 +86,7 @@ class UpgradeCommon{
|
||||||
UpgradeCommon::CONF_FILE_API_CLIENT);
|
UpgradeCommon::CONF_FILE_API_CLIENT);
|
||||||
|
|
||||||
// Backup the config files
|
// Backup the config files
|
||||||
$suffix = date("Ymdhis")."-".VERSION_NUMBER;
|
$suffix = date("Ymdhis")."-".UpgradeCommon::VERSION_NUMBER;
|
||||||
foreach ($configFiles as $conf) {
|
foreach ($configFiles as $conf) {
|
||||||
// do not back up monit cfg
|
// do not back up monit cfg
|
||||||
if (file_exists($conf)) {
|
if (file_exists($conf)) {
|
||||||
|
@ -70,8 +96,7 @@ class UpgradeCommon{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$default_suffix = "200";
|
self::CreateIniFiles(UpgradeCommon::CONF_BACKUP_SUFFIX);
|
||||||
self::CreateIniFiles($default_suffix);
|
|
||||||
self::MergeConfigFiles($configFiles, $suffix);
|
self::MergeConfigFiles($configFiles, $suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,10 @@
|
||||||
* format, and that's what this upgrade script will be for.
|
* format, and that's what this upgrade script will be for.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const VERSION_NUMBER = "2.0";
|
|
||||||
|
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
||||||
require_once 'conf.php';
|
require_once 'conf.php';
|
||||||
require_once 'DB.php';
|
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
||||||
|
|
||||||
|
@ -34,6 +30,8 @@ require_once 'UpgradeCommon.php';
|
||||||
class AirtimeDatabaseUpgrade{
|
class AirtimeDatabaseUpgrade{
|
||||||
|
|
||||||
public static function start(){
|
public static function start(){
|
||||||
|
self::doDbMigration();
|
||||||
|
|
||||||
self::SetDefaultTimezone();
|
self::SetDefaultTimezone();
|
||||||
self::setPhpDefaultTimeZoneToSystemTimezone();
|
self::setPhpDefaultTimeZoneToSystemTimezone();
|
||||||
self::convert_cc_playlist();
|
self::convert_cc_playlist();
|
||||||
|
@ -41,7 +39,6 @@ class AirtimeDatabaseUpgrade{
|
||||||
self::convert_cc_show_days();
|
self::convert_cc_show_days();
|
||||||
self::convert_cc_show_instances();
|
self::convert_cc_show_instances();
|
||||||
|
|
||||||
self::doDbMigration();
|
|
||||||
self::SetDefaultStreamSetting();
|
self::SetDefaultStreamSetting();
|
||||||
self::GetOldLiquidsoapCfgAndUpdate();
|
self::GetOldLiquidsoapCfgAndUpdate();
|
||||||
}
|
}
|
||||||
|
@ -144,7 +141,7 @@ class AirtimeDatabaseUpgrade{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20110929184401');
|
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20111103141311');
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function SetDefaultStreamSetting()
|
private static function SetDefaultStreamSetting()
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
set_include_path(__DIR__.'/../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
||||||
|
require_once('DB.php');
|
||||||
|
|
||||||
/* These are helper functions that are common to each upgrade such as
|
/* These are helper functions that are common to each upgrade such as
|
||||||
* creating connections to a database, backing up config files etc.
|
* creating connections to a database, backing up config files etc.
|
||||||
*/
|
*/
|
||||||
|
@ -13,6 +16,27 @@ class UpgradeCommon{
|
||||||
|
|
||||||
const CONF_PYPO_GRP = "pypo";
|
const CONF_PYPO_GRP = "pypo";
|
||||||
const CONF_WWW_DATA_GRP = "www-data";
|
const CONF_WWW_DATA_GRP = "www-data";
|
||||||
|
const CONF_BACKUP_SUFFIX = "200";
|
||||||
|
const VERSION_NUMBER = "2.0.0";
|
||||||
|
|
||||||
|
public static function connectToDatabase($p_exitOnError = true)
|
||||||
|
{
|
||||||
|
global $CC_DBC, $CC_CONFIG;
|
||||||
|
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
||||||
|
if (PEAR::isError($CC_DBC)) {
|
||||||
|
echo $CC_DBC->getMessage().PHP_EOL;
|
||||||
|
echo $CC_DBC->getUserInfo().PHP_EOL;
|
||||||
|
echo "Database connection problem.".PHP_EOL;
|
||||||
|
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
|
||||||
|
" with corresponding permissions.".PHP_EOL;
|
||||||
|
if ($p_exitOnError) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function DbTableExists($p_name)
|
public static function DbTableExists($p_name)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +57,8 @@ class UpgradeCommon{
|
||||||
public static function MigrateTablesToVersion($dir, $version)
|
public static function MigrateTablesToVersion($dir, $version)
|
||||||
{
|
{
|
||||||
$appDir = self::GetAirtimeSrcDir();
|
$appDir = self::GetAirtimeSrcDir();
|
||||||
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
$command = "php --php-ini $dir/../../airtime-php.ini ".
|
||||||
|
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
"--no-interaction migrations:migrate $version";
|
"--no-interaction migrations:migrate $version";
|
||||||
|
@ -43,7 +68,8 @@ class UpgradeCommon{
|
||||||
public static function BypassMigrations($dir, $version)
|
public static function BypassMigrations($dir, $version)
|
||||||
{
|
{
|
||||||
$appDir = self::GetAirtimeSrcDir();
|
$appDir = self::GetAirtimeSrcDir();
|
||||||
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
$command = "php --php-ini $dir/../../airtime-php.ini ".
|
||||||
|
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
"--no-interaction --add migrations:version $version";
|
"--no-interaction --add migrations:version $version";
|
||||||
|
@ -60,7 +86,7 @@ class UpgradeCommon{
|
||||||
UpgradeCommon::CONF_FILE_API_CLIENT);
|
UpgradeCommon::CONF_FILE_API_CLIENT);
|
||||||
|
|
||||||
// Backup the config files
|
// Backup the config files
|
||||||
$suffix = date("Ymdhis")."-".VERSION_NUMBER;
|
$suffix = date("Ymdhis")."-".UpgradeCommon::VERSION_NUMBER;
|
||||||
foreach ($configFiles as $conf) {
|
foreach ($configFiles as $conf) {
|
||||||
// do not back up monit cfg
|
// do not back up monit cfg
|
||||||
if (file_exists($conf)) {
|
if (file_exists($conf)) {
|
||||||
|
@ -70,8 +96,7 @@ class UpgradeCommon{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$default_suffix = CONF_BACKUP_SUFFIX;
|
self::CreateIniFiles(UpgradeCommon::CONF_BACKUP_SUFFIX);
|
||||||
self::CreateIniFiles($default_suffix);
|
|
||||||
self::MergeConfigFiles($configFiles, $suffix);
|
self::MergeConfigFiles($configFiles, $suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,10 @@
|
||||||
* format, and that's what this upgrade script will be for.
|
* format, and that's what this upgrade script will be for.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const VERSION_NUMBER = "2.0.0";
|
|
||||||
const CONF_BACKUP_SUFFIX = "200";
|
|
||||||
|
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
||||||
require_once 'conf.php';
|
require_once 'conf.php';
|
||||||
require_once 'DB.php';
|
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
||||||
|
|
||||||
|
@ -79,7 +74,7 @@ class AirtimeMiscUpgrade{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeCommonFunctions::connectToDatabase();
|
UpgradeCommon::connectToDatabase();
|
||||||
|
|
||||||
AirtimeDatabaseUpgrade::start();
|
AirtimeDatabaseUpgrade::start();
|
||||||
AirtimeStorWatchedDirsUpgrade::start();
|
AirtimeStorWatchedDirsUpgrade::start();
|
||||||
|
|
|
@ -10,7 +10,7 @@ def copy_dir(src_dir, dest_dir):
|
||||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
shutil.rmtree(dest_dir)
|
shutil.rmtree(dest_dir)
|
||||||
if not (os.path.exists(dest_dir)):
|
if not (os.path.exists(dest_dir)):
|
||||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||||
shutil.copytree(src_dir, dest_dir)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
current_script_dir = get_current_script_dir()
|
current_script_dir = get_current_script_dir()
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
#-e Causes bash script to exit if any of the installers
|
|
||||||
#return with a non-zero return value.
|
|
||||||
|
|
||||||
if [ `whoami` != 'root' ]; then
|
|
||||||
echo "Please run as root user."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Absolute path to this script, e.g. /home/user/bin/foo.sh
|
|
||||||
SCRIPT=`readlink -f $0`
|
|
||||||
# Absolute path this script is in, thus /home/user/bin
|
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
|
||||||
|
|
||||||
BIN_DIR=/usr/lib/airtime/api_clients
|
|
||||||
|
|
||||||
#copy api_client files
|
|
||||||
cp -R $SCRIPTPATH/../../api_clients $BIN_DIR
|
|
|
@ -17,5 +17,5 @@ except Exception, e:
|
||||||
print 'Error loading config file: ', e
|
print 'Error loading config file: ', e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print "Removing API Client files"
|
print " * Removing API Client files"
|
||||||
remove_path(config["bin_dir"])
|
remove_path(config["bin_dir"])
|
||||||
|
|
|
@ -3,14 +3,14 @@ import sys
|
||||||
from subprocess import Popen, PIPE, STDOUT
|
from subprocess import Popen, PIPE, STDOUT
|
||||||
|
|
||||||
def create_user(username):
|
def create_user(username):
|
||||||
print "Checking for user "+username
|
print "* Checking for user "+username
|
||||||
|
|
||||||
p = Popen('id '+username, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
p = Popen('id '+username, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||||
output = p.stdout.read()
|
output = p.stdout.read()
|
||||||
|
|
||||||
if (output[0:3] != "uid"):
|
if (output[0:3] != "uid"):
|
||||||
# Make the pypo user
|
# Make the pypo user
|
||||||
print "Creating user "+username
|
print " * Creating user "+username
|
||||||
os.system("adduser --system --quiet --group --shell /bin/bash "+username)
|
os.system("adduser --system --quiet --group --shell /bin/bash "+username)
|
||||||
|
|
||||||
#set pypo password
|
#set pypo password
|
||||||
|
|
|
@ -65,7 +65,7 @@ try:
|
||||||
bootstrap = AirtimeMediaMonitorBootstrap(logger, pe, api_client, mmc)
|
bootstrap = AirtimeMediaMonitorBootstrap(logger, pe, api_client, mmc)
|
||||||
bootstrap.scan()
|
bootstrap.scan()
|
||||||
|
|
||||||
notifier = AirtimeNotifier(wm, pe, read_freq=0.1, timeout=0, airtime_config=config, api_client=api_client, bootstrap=bootstrap, mmc=mmc)
|
notifier = AirtimeNotifier(wm, pe, read_freq=0, timeout=0, airtime_config=config, api_client=api_client, bootstrap=bootstrap, mmc=mmc)
|
||||||
notifier.coalesce_events()
|
notifier.coalesce_events()
|
||||||
|
|
||||||
#create 5 worker threads
|
#create 5 worker threads
|
||||||
|
|
|
@ -166,9 +166,9 @@ class AirtimeMetadata:
|
||||||
#check if file has any metadata
|
#check if file has any metadata
|
||||||
if file_info is not None:
|
if file_info is not None:
|
||||||
for key in file_info.keys() :
|
for key in file_info.keys() :
|
||||||
if key in self.mutagen2airtime :
|
if key in self.mutagen2airtime and len(file_info[key]) > 0:
|
||||||
info = file_info[key][0]
|
info = file_info[key][0]
|
||||||
while 1:
|
while True:
|
||||||
temp = re.search(u"[\x80-\x9f]", info)
|
temp = re.search(u"[\x80-\x9f]", info)
|
||||||
if temp is not None:
|
if temp is not None:
|
||||||
s = temp.group(0)
|
s = temp.group(0)
|
||||||
|
@ -197,9 +197,9 @@ class AirtimeMetadata:
|
||||||
if isinstance(md['MDATA_KEY_TRACKNUMBER'], basestring):
|
if isinstance(md['MDATA_KEY_TRACKNUMBER'], basestring):
|
||||||
match = re.search('^(\d*/\d*)?', md['MDATA_KEY_TRACKNUMBER'])
|
match = re.search('^(\d*/\d*)?', md['MDATA_KEY_TRACKNUMBER'])
|
||||||
|
|
||||||
if match.group(0) is not u'':
|
try:
|
||||||
md['MDATA_KEY_TRACKNUMBER'] = int(md['MDATA_KEY_TRACKNUMBER'].split("/")[0])
|
md['MDATA_KEY_TRACKNUMBER'] = int(md['MDATA_KEY_TRACKNUMBER'].split("/")[0], 10)
|
||||||
else:
|
except Exception, e:
|
||||||
del md['MDATA_KEY_TRACKNUMBER']
|
del md['MDATA_KEY_TRACKNUMBER']
|
||||||
|
|
||||||
#make sure bpm is valid, need to check more types of formats for this tag to assure correct parsing.
|
#make sure bpm is valid, need to check more types of formats for this tag to assure correct parsing.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import socket
|
import socket
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
|
|
||||||
import pyinotify
|
import pyinotify
|
||||||
from pyinotify import ProcessEvent
|
from pyinotify import ProcessEvent
|
||||||
|
@ -90,6 +91,7 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
|
|
||||||
def process_IN_CREATE(self, event):
|
def process_IN_CREATE(self, event):
|
||||||
self.logger.info("event: %s", event)
|
self.logger.info("event: %s", event)
|
||||||
|
if not event.dir:
|
||||||
# record the timestamp of the time on IN_CREATE event
|
# record the timestamp of the time on IN_CREATE event
|
||||||
self.create_dict[event.pathname] = time.time()
|
self.create_dict[event.pathname] = time.time()
|
||||||
|
|
||||||
|
@ -268,7 +270,20 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
# this part is like a garbage collector
|
# this part is like a garbage collector
|
||||||
for k, t in self.create_dict.items():
|
for k, t in self.create_dict.items():
|
||||||
now = time.time()
|
now = time.time()
|
||||||
if now - t > 300:
|
if now - t > 5:
|
||||||
|
# check if file exist
|
||||||
|
# When whole directory is copied to the organized dir,
|
||||||
|
# inotify doesn't fire IN_CLOSE_WRITE, hench we need special way of
|
||||||
|
# handling those cases.
|
||||||
|
if os.path.exists(k):
|
||||||
|
# check if file is open
|
||||||
|
command = "lsof "+k
|
||||||
|
f = os.popen(command)
|
||||||
|
if not f.readlines():
|
||||||
|
self.logger.info("Handling file: %s", k)
|
||||||
|
self.handle_created_file(False, k, os.path.basename(k))
|
||||||
|
del self.create_dict[k]
|
||||||
|
else:
|
||||||
del self.create_dict[k]
|
del self.create_dict[k]
|
||||||
|
|
||||||
#check for any events received from Airtime.
|
#check for any events received from Airtime.
|
||||||
|
|
|
@ -16,7 +16,7 @@ def copy_dir(src_dir, dest_dir):
|
||||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
shutil.rmtree(dest_dir)
|
shutil.rmtree(dest_dir)
|
||||||
if not (os.path.exists(dest_dir)):
|
if not (os.path.exists(dest_dir)):
|
||||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||||
shutil.copytree(src_dir, dest_dir)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
def create_dir(path):
|
def create_dir(path):
|
|
@ -11,7 +11,7 @@ try:
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
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)
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
import traceback
|
|
||||||
from optparse import *
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import datetime
|
|
||||||
import logging
|
|
||||||
import logging.config
|
|
||||||
import shutil
|
|
||||||
import string
|
|
||||||
import platform
|
|
||||||
from configobj import ConfigObj
|
|
||||||
from subprocess import Popen
|
|
||||||
|
|
||||||
if os.geteuid() != 0:
|
|
||||||
print "Please run this as root."
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
PATH_INI_FILE = '/etc/airtime/media-monitor.cfg'
|
|
||||||
|
|
||||||
def create_path(path):
|
|
||||||
if not (os.path.exists(path)):
|
|
||||||
print "Creating directory " + path
|
|
||||||
os.makedirs(path)
|
|
||||||
|
|
||||||
def copy_dir(src_dir, dest_dir):
|
|
||||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
|
||||||
print "Removing old directory "+dest_dir
|
|
||||||
shutil.rmtree(dest_dir)
|
|
||||||
if not (os.path.exists(dest_dir)):
|
|
||||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
|
||||||
shutil.copytree(src_dir, dest_dir)
|
|
||||||
|
|
||||||
def get_current_script_dir():
|
|
||||||
current_script_dir = os.path.realpath(__file__)
|
|
||||||
index = current_script_dir.rindex('/')
|
|
||||||
return current_script_dir[0:index]
|
|
||||||
|
|
||||||
def copy_monit_file(current_script_dir):
|
|
||||||
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/")
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
# load config file
|
|
||||||
try:
|
|
||||||
config = ConfigObj(PATH_INI_FILE)
|
|
||||||
except Exception, e:
|
|
||||||
print 'Error loading config file: ', e
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
current_script_dir = get_current_script_dir()
|
|
||||||
|
|
||||||
copy_monit_file(current_script_dir)
|
|
||||||
|
|
||||||
p = Popen("/etc/init.d/airtime-media-monitor stop >/dev/null 2>&1", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
print "Creating log directories"
|
|
||||||
create_path(config["log_dir"])
|
|
||||||
#os.system("chmod -R 755 " + config["log_dir"])
|
|
||||||
os.system("chown -R pypo:pypo "+config["log_dir"])
|
|
||||||
|
|
||||||
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
|
||||||
|
|
||||||
print "Setting permissions"
|
|
||||||
os.system("chmod -R 755 "+config["bin_dir"])
|
|
||||||
#os.system("chmod -R 755 "+config["bin_dir"]+"/airtime-media-monitor)
|
|
||||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
|
||||||
|
|
||||||
print "Installing media-monitor daemon"
|
|
||||||
shutil.copy(config["bin_dir"]+"/airtime-media-monitor-init-d", "/etc/init.d/airtime-media-monitor")
|
|
||||||
|
|
||||||
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
print "Waiting for processes to start..."
|
|
||||||
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
except Exception, e:
|
|
||||||
print "exception:" + str(e)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
python media-monitor-install-files.py
|
|
||||||
python media-monitor-initialize.py
|
|
|
@ -16,7 +16,7 @@ def copy_dir(src_dir, dest_dir):
|
||||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
shutil.rmtree(dest_dir)
|
shutil.rmtree(dest_dir)
|
||||||
if not (os.path.exists(dest_dir)):
|
if not (os.path.exists(dest_dir)):
|
||||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||||
shutil.copytree(src_dir, dest_dir)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
def create_dir(path):
|
def create_dir(path):
|
|
@ -70,17 +70,19 @@ try:
|
||||||
architecture = platform.architecture()[0]
|
architecture = platform.architecture()[0]
|
||||||
natty = is_natty()
|
natty = is_natty()
|
||||||
|
|
||||||
|
print "* Detecting system architecture for Liquidsoap"
|
||||||
|
|
||||||
if architecture == '64bit' and natty:
|
if architecture == '64bit' and natty:
|
||||||
print "Installing 64-bit liquidsoap binary (Natty)"
|
print " * Installing 64-bit liquidsoap binary (Natty)"
|
||||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||||
elif architecture == '32bit' and natty:
|
elif architecture == '32bit' and natty:
|
||||||
print "Installing 32-bit liquidsoap binary (Natty)"
|
print " * Installing 32-bit liquidsoap binary (Natty)"
|
||||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||||
elif architecture == '64bit' and not natty:
|
elif architecture == '64bit' and not natty:
|
||||||
print "Installing 64-bit liquidsoap binary"
|
print " * Installing 64-bit liquidsoap binary"
|
||||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
shutil.copy("%s/../liquidsoap_bin/liquidsoap-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||||
elif architecture == '32bit' and not natty:
|
elif architecture == '32bit' and not natty:
|
||||||
print "Installing 32-bit liquidsoap binary"
|
print " * Installing 32-bit liquidsoap binary"
|
||||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
shutil.copy("%s/../liquidsoap_bin/liquidsoap-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||||
else:
|
else:
|
||||||
print "Unknown system architecture."
|
print "Unknown system architecture."
|
||||||
|
@ -101,7 +103,7 @@ try:
|
||||||
print "Unable to connect to the Airtime server."
|
print "Unable to connect to the Airtime server."
|
||||||
|
|
||||||
#restart airtime-playout
|
#restart airtime-playout
|
||||||
print "Waiting for pypo processes to start..."
|
print "* Waiting for pypo processes to start..."
|
||||||
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
p = Popen("/etc/init.d/airtime-playout stop", 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)
|
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
||||||
|
|
|
@ -1,163 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
from optparse import *
|
|
||||||
import sys
|
|
||||||
import shutil
|
|
||||||
import platform
|
|
||||||
from configobj import ConfigObj
|
|
||||||
from subprocess import Popen
|
|
||||||
sys.path.append('/usr/lib/airtime/api_clients/')
|
|
||||||
import api_client
|
|
||||||
|
|
||||||
if os.geteuid() != 0:
|
|
||||||
print "Please run this as root."
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
|
|
||||||
|
|
||||||
def create_path(path):
|
|
||||||
if not (os.path.exists(path)):
|
|
||||||
print "Creating directory " + path
|
|
||||||
os.makedirs(path)
|
|
||||||
|
|
||||||
def copy_dir(src_dir, dest_dir):
|
|
||||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
|
||||||
shutil.rmtree(dest_dir)
|
|
||||||
if not (os.path.exists(dest_dir)):
|
|
||||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
|
||||||
shutil.copytree(src_dir, dest_dir)
|
|
||||||
|
|
||||||
def get_current_script_dir():
|
|
||||||
current_script_dir = os.path.realpath(__file__)
|
|
||||||
index = current_script_dir.rindex('/')
|
|
||||||
return current_script_dir[0:index]
|
|
||||||
|
|
||||||
def is_natty():
|
|
||||||
try:
|
|
||||||
f = open('/etc/lsb-release')
|
|
||||||
except IOError as e:
|
|
||||||
#File doesn't exist, so we're not even dealing with Ubuntu
|
|
||||||
return False
|
|
||||||
|
|
||||||
for line in f:
|
|
||||||
split = line.split("=")
|
|
||||||
split[0] = split[0].strip(" \r\n")
|
|
||||||
split[1] = split[1].strip(" \r\n")
|
|
||||||
if split[0] == "DISTRIB_CODENAME" and (split[1] == "natty" or split[1] == "oneiric"):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def copy_monit_file(current_script_dir):
|
|
||||||
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/")
|
|
||||||
|
|
||||||
try:
|
|
||||||
# load config file
|
|
||||||
try:
|
|
||||||
config = ConfigObj(PATH_INI_FILE)
|
|
||||||
except Exception, e:
|
|
||||||
print 'Error loading config file: ', e
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
current_script_dir = get_current_script_dir()
|
|
||||||
|
|
||||||
copy_monit_file(current_script_dir)
|
|
||||||
|
|
||||||
p = Popen("/etc/init.d/airtime-playout stop >/dev/null 2>&1", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
create_path(config["pypo_log_dir"])
|
|
||||||
os.system("chmod -R 755 " + config["pypo_log_dir"])
|
|
||||||
os.system("chown -R pypo:pypo "+config["pypo_log_dir"])
|
|
||||||
|
|
||||||
create_path(config["liquidsoap_log_dir"])
|
|
||||||
os.system("chmod -R 755 " + config["liquidsoap_log_dir"])
|
|
||||||
os.system("chown -R pypo:pypo "+config["liquidsoap_log_dir"])
|
|
||||||
|
|
||||||
create_path(config["bin_dir"]+"/bin")
|
|
||||||
create_path(config["cache_dir"])
|
|
||||||
create_path(config["file_dir"])
|
|
||||||
create_path(config["tmp_dir"])
|
|
||||||
|
|
||||||
architecture = platform.architecture()[0]
|
|
||||||
natty = is_natty()
|
|
||||||
|
|
||||||
if architecture == '64bit' and natty:
|
|
||||||
print "Installing 64-bit liquidsoap binary (Natty)"
|
|
||||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
|
||||||
elif architecture == '32bit' and natty:
|
|
||||||
print "Installing 32-bit liquidsoap binary (Natty)"
|
|
||||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
|
||||||
elif architecture == '64bit' and not natty:
|
|
||||||
print "Installing 64-bit liquidsoap binary"
|
|
||||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
|
||||||
elif architecture == '32bit' and not natty:
|
|
||||||
print "Installing 32-bit liquidsoap binary"
|
|
||||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
|
||||||
else:
|
|
||||||
print "Unknown system architecture."
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
copy_dir("%s/.."%current_script_dir, config["bin_dir"]+"/bin/")
|
|
||||||
|
|
||||||
# delete /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap.cfg
|
|
||||||
# as we don't use it anymore.(CC-2552)
|
|
||||||
os.remove(config["bin_dir"]+"/bin/liquidsoap_scripts/liquidsoap.cfg")
|
|
||||||
|
|
||||||
print "Setting permissions"
|
|
||||||
os.system("chmod 755 "+os.path.join(config["bin_dir"], "liquidsoap_scripts/notify.sh"))
|
|
||||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
|
||||||
os.system("chown -R pypo:pypo "+config["cache_base_dir"])
|
|
||||||
|
|
||||||
print "Installing pypo daemon"
|
|
||||||
shutil.copy(config["bin_dir"]+"/bin/airtime-playout-init-d", "/etc/init.d/airtime-playout")
|
|
||||||
|
|
||||||
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
#copy logrotate script
|
|
||||||
shutil.copy(config["bin_dir"]+"/bin/liquidsoap_scripts/airtime-liquidsoap.logrotate", "/etc/logrotate.d/airtime-liquidsoap")
|
|
||||||
|
|
||||||
|
|
||||||
# we should access the DB and generate liquidsoap.cfg under /etc/airtime/
|
|
||||||
api_client = api_client.api_client_factory(config)
|
|
||||||
ss = api_client.get_stream_setting()
|
|
||||||
|
|
||||||
# if api_client is somehow not working, just use original cfg file
|
|
||||||
if(ss is not None):
|
|
||||||
data = ss['msg']
|
|
||||||
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
|
|
||||||
fh.write("################################################\n")
|
|
||||||
fh.write("# THIS FILE IS AUTO GENERATED. DO NOT CHANGE!! #\n")
|
|
||||||
fh.write("################################################\n")
|
|
||||||
for d in data:
|
|
||||||
buffer = d[u'keyname'] + " = "
|
|
||||||
if(d[u'type'] == 'string'):
|
|
||||||
temp = d[u'value']
|
|
||||||
if(temp == ""):
|
|
||||||
temp = ""
|
|
||||||
buffer += "\"" + temp + "\""
|
|
||||||
else:
|
|
||||||
temp = d[u'value']
|
|
||||||
if(temp == ""):
|
|
||||||
temp = "0"
|
|
||||||
buffer += temp
|
|
||||||
buffer += "\n"
|
|
||||||
fh.write(buffer)
|
|
||||||
fh.write("log_file = \"/var/log/airtime/pypo-liquidsoap/<script>.log\"\n");
|
|
||||||
fh.close()
|
|
||||||
else:
|
|
||||||
print "Unable to connect to the Airtime server."
|
|
||||||
print "Waiting for processes to start..."
|
|
||||||
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
|
|
||||||
except Exception, e:
|
|
||||||
print "exception:" + str(e)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
python pypo-install-files.py
|
|
||||||
python pypo-initialize.py
|
|
|
@ -32,7 +32,7 @@ try:
|
||||||
remove_file("/etc/init.d/airtime-playout")
|
remove_file("/etc/init.d/airtime-playout")
|
||||||
|
|
||||||
#remove bin, cache, tmp and file dir
|
#remove bin, cache, tmp and file dir
|
||||||
print "* Removing Pypo Program directories"
|
print " * Removing Pypo Program Directory"
|
||||||
shutil.rmtree(config['bin_dir'], ignore_errors=True)
|
shutil.rmtree(config['bin_dir'], ignore_errors=True)
|
||||||
shutil.rmtree(config['cache_dir'], ignore_errors=True)
|
shutil.rmtree(config['cache_dir'], ignore_errors=True)
|
||||||
shutil.rmtree(config['file_dir'], ignore_errors=True)
|
shutil.rmtree(config['file_dir'], ignore_errors=True)
|
||||||
|
|
|
@ -16,7 +16,7 @@ def copy_dir(src_dir, dest_dir):
|
||||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
shutil.rmtree(dest_dir)
|
shutil.rmtree(dest_dir)
|
||||||
if not (os.path.exists(dest_dir)):
|
if not (os.path.exists(dest_dir)):
|
||||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||||
shutil.copytree(src_dir, dest_dir)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
def create_dir(path):
|
def create_dir(path):
|
||||||
|
@ -43,13 +43,13 @@ try:
|
||||||
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/')
|
||||||
|
|
||||||
#create temporary media-storage directory
|
#create temporary media-storage directory
|
||||||
print "Creating temporary media storage directory"
|
#print "Creating temporary media storage directory"
|
||||||
create_dir(config["base_recorded_files"])
|
create_dir(config["base_recorded_files"])
|
||||||
#os.system("chmod -R 755 "+config["base_recorded_files"])
|
#os.system("chmod -R 755 "+config["base_recorded_files"])
|
||||||
os.system("chown -R pypo:pypo "+config["base_recorded_files"])
|
os.system("chown -R pypo:pypo "+config["base_recorded_files"])
|
||||||
|
|
||||||
#create log directories
|
#create log directories
|
||||||
print "Creating log directories"
|
#print "Creating log directories"
|
||||||
create_dir(config["log_dir"])
|
create_dir(config["log_dir"])
|
||||||
os.system("chmod -R 755 " + config["log_dir"])
|
os.system("chmod -R 755 " + config["log_dir"])
|
||||||
os.system("chown -R pypo:pypo "+config["log_dir"])
|
os.system("chown -R pypo:pypo "+config["log_dir"])
|
||||||
|
@ -58,7 +58,7 @@ try:
|
||||||
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
||||||
|
|
||||||
#set python file permissions
|
#set python file permissions
|
||||||
print "Setting permissions"
|
#print "Setting permissions"
|
||||||
os.system("chmod -R 755 "+config["bin_dir"])
|
os.system("chmod -R 755 "+config["bin_dir"])
|
||||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
||||||
|
|
|
@ -12,7 +12,7 @@ try:
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
|
||||||
#start daemon
|
#start daemon
|
||||||
print "Waiting for show-recorder processes to start..."
|
print "* Waiting for show-recorder processes to start..."
|
||||||
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
p = Popen("/etc/init.d/airtime-show-recorder stop", 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)
|
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
from optparse import *
|
|
||||||
import sys
|
|
||||||
import shutil
|
|
||||||
from configobj import ConfigObj
|
|
||||||
from subprocess import Popen
|
|
||||||
|
|
||||||
if os.geteuid() != 0:
|
|
||||||
print "Please run this as root."
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
PATH_INI_FILE = '/etc/airtime/recorder.cfg'
|
|
||||||
|
|
||||||
def create_path(path):
|
|
||||||
if not (os.path.exists(path)):
|
|
||||||
print "Creating directory " + path
|
|
||||||
os.makedirs(path)
|
|
||||||
|
|
||||||
def copy_dir(src_dir, dest_dir):
|
|
||||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
|
||||||
print "Removing old directory "+dest_dir
|
|
||||||
shutil.rmtree(dest_dir)
|
|
||||||
if not (os.path.exists(dest_dir)):
|
|
||||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
|
||||||
shutil.copytree(src_dir, dest_dir)
|
|
||||||
|
|
||||||
def get_current_script_dir():
|
|
||||||
current_script_dir = os.path.realpath(__file__)
|
|
||||||
index = current_script_dir.rindex('/')
|
|
||||||
return current_script_dir[0:index]
|
|
||||||
|
|
||||||
def copy_monit_file(current_script_dir):
|
|
||||||
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/")
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
# load config file
|
|
||||||
try:
|
|
||||||
config = ConfigObj(PATH_INI_FILE)
|
|
||||||
except Exception, e:
|
|
||||||
print 'Error loading config file: ', e
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
current_script_dir = get_current_script_dir()
|
|
||||||
|
|
||||||
copy_monit_file(current_script_dir)
|
|
||||||
|
|
||||||
p = Popen("/etc/init.d/airtime-show-recorder stop >/dev/null 2>&1", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
print "Creating temporary media storage directory"
|
|
||||||
create_path(config["base_recorded_files"])
|
|
||||||
#os.system("chmod -R 755 "+config["base_recorded_files"])
|
|
||||||
os.system("chown -R pypo:pypo "+config["base_recorded_files"])
|
|
||||||
|
|
||||||
print "Creating log directories"
|
|
||||||
create_path(config["log_dir"])
|
|
||||||
os.system("chmod -R 755 " + config["log_dir"])
|
|
||||||
os.system("chown -R pypo:pypo "+config["log_dir"])
|
|
||||||
|
|
||||||
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
|
||||||
|
|
||||||
print "Setting permissions"
|
|
||||||
os.system("chmod -R 755 "+config["bin_dir"])
|
|
||||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
|
||||||
|
|
||||||
print "Installing show-recorder daemon"
|
|
||||||
shutil.copy(config["bin_dir"]+"/airtime-show-recorder-init-d", "/etc/init.d/airtime-show-recorder")
|
|
||||||
|
|
||||||
p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
print "Waiting for processes to start..."
|
|
||||||
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
except Exception, e:
|
|
||||||
print "exception:" + str(e)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
python recorder-install-files.py
|
|
||||||
python recorder-initialize.py
|
|
|
@ -24,11 +24,11 @@ except Exception, e:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#remove init.d script
|
#remove init.d script
|
||||||
print "* Removing Show-Recorder init.d script"
|
print " * Removing Show-Recorder init.d Script"
|
||||||
remove_file('/etc/init.d/airtime-show-recorder')
|
remove_file('/etc/init.d/airtime-show-recorder')
|
||||||
|
|
||||||
#remove bin dir
|
#remove bin dir
|
||||||
print "* Removing Show-Recorder Program Directories"
|
print " * Removing Show-Recorder Program Directory"
|
||||||
shutil.rmtree(config["bin_dir"], ignore_errors=True)
|
shutil.rmtree(config["bin_dir"], ignore_errors=True)
|
||||||
|
|
||||||
#remove log dir
|
#remove log dir
|
||||||
|
|
|
@ -54,13 +54,17 @@ if (PEAR::isError($CC_DBC)) {
|
||||||
//echo "* Connected to database".PHP_EOL;
|
//echo "* Connected to database".PHP_EOL;
|
||||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Application_Model_Preference::GetSupportFeedback() == '1'){
|
if(Application_Model_Preference::GetSupportFeedback() == '1'){
|
||||||
$infoArray = Application_Model_Preference::GetSystemInfo(true);
|
$infoArray = Application_Model_Preference::GetSystemInfo(true);
|
||||||
|
|
||||||
|
$url = 'http://stat.sourcefabric.org/index.php?p=airtime';
|
||||||
|
//$url = 'http://stat-dev.sourcefabric.org/index.php?p=airtime';
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_URL, 'http://stat.sourcefabric.org/index.php?p=airtime');
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
|
||||||
$data = json_encode($infoArray);
|
$data = json_encode($infoArray);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue