Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
c5f9288aab
20 changed files with 80 additions and 69 deletions
|
@ -909,7 +909,17 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$duration = $UTCEndDateTime->diff($UTCStartDateTime);
|
$duration = $UTCEndDateTime->diff($UTCStartDateTime);
|
||||||
|
|
||||||
|
$day = intval($duration->format('%d'));
|
||||||
|
if($day > 0){
|
||||||
|
$hour = intval($duration->format('%h'));
|
||||||
|
$min = intval($duration->format('%i'));
|
||||||
|
$hour += $day * 24;
|
||||||
|
$hour = min($hour, 99);
|
||||||
|
$sign = $duration->format('%r');
|
||||||
|
$result = sprintf('%s%02dh %02dm', $sign, $hour, $min);
|
||||||
|
}else{
|
||||||
$result = $duration->format('%r%Hh %Im');
|
$result = $duration->format('%r%Hh %Im');
|
||||||
|
}
|
||||||
}catch (Exception $e){
|
}catch (Exception $e){
|
||||||
$result = "Invalid Date";
|
$result = "Invalid Date";
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,9 @@ class Application_Model_StoredFile {
|
||||||
"mime" => "DbMime",
|
"mime" => "DbMime",
|
||||||
"md5" => "DbMd5",
|
"md5" => "DbMd5",
|
||||||
"ftype" => "DbFtype",
|
"ftype" => "DbFtype",
|
||||||
"language" => "DbLanguage"
|
"language" => "DbLanguage",
|
||||||
|
"filepath" => "DbFilepath",
|
||||||
|
"directory" => "DbDirectory"
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -223,9 +225,21 @@ class Application_Model_StoredFile {
|
||||||
foreach ($c['user'] as $constant => $value) {
|
foreach ($c['user'] as $constant => $value) {
|
||||||
if (preg_match('/^MDATA_KEY/', $constant)) {
|
if (preg_match('/^MDATA_KEY/', $constant)) {
|
||||||
if (isset($this->_dbMD[$value])) {
|
if (isset($this->_dbMD[$value])) {
|
||||||
|
if ($value == 'filepath') {
|
||||||
|
$directoryPK = $this->getDbColMetadataValue('directory');
|
||||||
|
if ($directoryPK == 1) {
|
||||||
|
$musicDir = Application_Model_MusicDir::getDirByPK($directoryPK);
|
||||||
|
$md[$constant] = $musicDir->getDirectory() . $this->getDbColMetadataValue($value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$md[$constant] = $this->getDbColMetadataValue($value);
|
$md[$constant] = $this->getDbColMetadataValue($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$md[$constant] = $this->getDbColMetadataValue($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $md;
|
return $md;
|
||||||
|
@ -686,7 +700,7 @@ Logging::log("getting media! - 2");
|
||||||
|
|
||||||
if($type == "au"){//&& isset( $audioResults )) {
|
if($type == "au"){//&& isset( $audioResults )) {
|
||||||
$row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
|
$row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
|
||||||
$row['image'] = '<img src="/css/images/icon_audioclip.png">';
|
$row['image'] = '<img title="Track preview" src="/css/images/icon_audioclip.png">';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row['image'] = '<img src="/css/images/icon_playlist.png">';
|
$row['image'] = '<img src="/css/images/icon_playlist.png">';
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<div><span>Isrc Number:</span><span><?php echo ($this->md["MDATA_KEY_ISRC"]);?></span></div>
|
<div><span>Isrc Number:</span><span><?php echo ($this->md["MDATA_KEY_ISRC"]);?></span></div>
|
||||||
<div><span>Website:</span><span><?php echo ($this->md["MDATA_KEY_URL"]);?></span></div>
|
<div><span>Website:</span><span><?php echo ($this->md["MDATA_KEY_URL"]);?></span></div>
|
||||||
<div><span>Language:</span><span><?php echo ($this->md["MDATA_KEY_LANGUAGE"]);?></span></div>
|
<div><span>Language:</span><span><?php echo ($this->md["MDATA_KEY_LANGUAGE"]);?></span></div>
|
||||||
|
<div><span>File Path:</span><span><?php echo ($this->md["MDATA_KEY_FILEPATH"]);?></span></div>
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ function updateProgressBarValue(){
|
||||||
songPercentDone = 0;
|
songPercentDone = 0;
|
||||||
currentSong = null;
|
currentSong = null;
|
||||||
} else {
|
} else {
|
||||||
if (currentSong.media_item_played == true && currentShow.length > 0){
|
if (currentShow.length > 0){
|
||||||
scheduled_play_line_to_switch.attr("class", "line-to-switch on");
|
scheduled_play_line_to_switch.attr("class", "line-to-switch on");
|
||||||
scheduled_play_div.addClass("ready")
|
scheduled_play_div.addClass("ready")
|
||||||
scheduled_play_source = true;
|
scheduled_play_source = true;
|
||||||
|
|
|
@ -414,7 +414,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$image = $(nRow).find('td.sb-image');
|
$image = $(nRow).find('td.sb-image');
|
||||||
//check if the file exists.
|
//check if the file exists.
|
||||||
if (aData.image === true) {
|
if (aData.image === true) {
|
||||||
$image.html('<img src="/css/images/icon_audioclip.png"></img>')
|
$image.html('<img title="Track preview" src="/css/images/icon_audioclip.png"></img>')
|
||||||
.click(function() {
|
.click(function() {
|
||||||
open_show_preview(aData.instance, aData.pos);
|
open_show_preview(aData.instance, aData.pos);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -35,7 +35,7 @@ apt-get update
|
||||||
|
|
||||||
# Updated package list
|
# Updated package list
|
||||||
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 libsoundtouch-ocaml \
|
php-pear php5-gd postgresql odbc-postgresql python libsoundtouch-ocaml \
|
||||||
libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \
|
libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \
|
||||||
libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \
|
libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \
|
||||||
php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \
|
php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \
|
||||||
|
|
|
@ -38,7 +38,7 @@ apt-get update
|
||||||
|
|
||||||
# Updated package list
|
# Updated package list
|
||||||
apt-get -y install tar gzip curl nginx php5-pgsql php5-fpm \
|
apt-get -y install tar gzip curl nginx php5-pgsql php5-fpm \
|
||||||
php-pear php5-gd postgresql odbc-postgresql python2.6 libsoundtouch-ocaml \
|
php-pear php5-gd postgresql odbc-postgresql python libsoundtouch-ocaml \
|
||||||
libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \
|
libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \
|
||||||
libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \
|
libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \
|
||||||
php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \
|
php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \
|
||||||
|
|
|
@ -35,6 +35,7 @@ AIRTIMEROOT=$SCRIPTPATH/../../
|
||||||
|
|
||||||
echo "* Creating /etc/airtime"
|
echo "* Creating /etc/airtime"
|
||||||
mkdir -p /etc/airtime
|
mkdir -p /etc/airtime
|
||||||
|
#if [ "$DO_UPGRADE" -eq "0" ]; then
|
||||||
if [ ! -e /etc/airtime/airtime.conf ]; then
|
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
|
||||||
fi
|
fi
|
||||||
|
@ -62,9 +63,6 @@ if [ "$python_service" -eq "0" ]; then
|
||||||
if [ "$pypo" = "t" ]; then
|
if [ "$pypo" = "t" ]; then
|
||||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
|
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
|
||||||
fi
|
fi
|
||||||
#if [ "$showrecorder" = "t" ]; then
|
|
||||||
# python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py
|
|
||||||
#fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /usr/lib/airtime
|
mkdir -p /usr/lib/airtime
|
||||||
|
|
|
@ -36,10 +36,6 @@ fi
|
||||||
if [ "$pypo" = "t" ]; then
|
if [ "$pypo" = "t" ]; then
|
||||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py
|
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py
|
||||||
fi
|
fi
|
||||||
#if [ "$showrecorder" = "t" ]; then
|
|
||||||
# python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py
|
|
||||||
#fi
|
|
||||||
|
|
||||||
|
|
||||||
# Start monit if it is not running, or restart if it is.
|
# 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
|
# Need to ensure monit is running before Airtime daemons are run. This is
|
||||||
|
|
|
@ -15,6 +15,8 @@ require_once(__DIR__.'/airtime-constants.php');
|
||||||
AirtimeInstall::ExitIfNotRoot();
|
AirtimeInstall::ExitIfNotRoot();
|
||||||
|
|
||||||
if (!file_exists('/etc/airtime/airtime.conf')) {
|
if (!file_exists('/etc/airtime/airtime.conf')) {
|
||||||
|
#airtime.conf doesn't exist, and we need it to connect to database
|
||||||
|
#Assume Airtime is not installed.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
* @copyright 2010 Sourcefabric O.P.S.
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once('DB.php');
|
|
||||||
require_once(__DIR__.'/airtime-constants.php');
|
require_once(__DIR__.'/airtime-constants.php');
|
||||||
require_once(dirname(__FILE__).'/AirtimeIni.php');
|
require_once(dirname(__FILE__).'/AirtimeIni.php');
|
||||||
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
||||||
|
|
|
@ -15,7 +15,7 @@ class AirtimeDatabaseUpgrade{
|
||||||
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120411174904');
|
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120411174904');
|
||||||
|
|
||||||
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
|
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
|
||||||
UpgradeCommon::nonSelectQueryDb($sql);
|
UpgradeCommon::queryDb($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -23,6 +23,9 @@ function get_conf_location(){
|
||||||
$conf_path = get_conf_location();
|
$conf_path = get_conf_location();
|
||||||
require_once $conf_path;
|
require_once $conf_path;
|
||||||
|
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||||
|
|
||||||
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
require_once 'common/UpgradeCommon.php';
|
require_once 'common/UpgradeCommon.php';
|
||||||
require_once 'ConfFileUpgrade.php';
|
require_once 'ConfFileUpgrade.php';
|
||||||
require_once 'DbUpgrade.php';
|
require_once 'DbUpgrade.php';
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
|
@ -21,7 +18,7 @@ class UpgradeCommon{
|
||||||
{
|
{
|
||||||
$sql = "SELECT valstr from cc_pref WHERE keystr = 'timezone'";
|
$sql = "SELECT valstr from cc_pref WHERE keystr = 'timezone'";
|
||||||
|
|
||||||
$result = self::selectQueryDb($sql);
|
$result = self::queryDb($sql);
|
||||||
$timezone = $result['valstr'];
|
$timezone = $result['valstr'];
|
||||||
|
|
||||||
date_default_timezone_set($timezone);
|
date_default_timezone_set($timezone);
|
||||||
|
@ -29,29 +26,28 @@ class UpgradeCommon{
|
||||||
|
|
||||||
public static function connectToDatabase($p_exitOnError = true)
|
public static function connectToDatabase($p_exitOnError = true)
|
||||||
{
|
{
|
||||||
global $CC_DBC, $CC_CONFIG;
|
try {
|
||||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
$con = Propel::getConnection();
|
||||||
if (PEAR::isError($CC_DBC)) {
|
} catch (Exception $e) {
|
||||||
echo $CC_DBC->getMessage().PHP_EOL;
|
echo $e->getMessage().PHP_EOL;
|
||||||
echo $CC_DBC->getUserInfo().PHP_EOL;
|
|
||||||
echo "Database connection problem.".PHP_EOL;
|
echo "Database connection problem.".PHP_EOL;
|
||||||
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
|
echo "Check if database exists with corresponding permissions.".PHP_EOL;
|
||||||
" with corresponding permissions.".PHP_EOL;
|
|
||||||
if ($p_exitOnError) {
|
if ($p_exitOnError) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
return false;
|
||||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function DbTableExists($p_name)
|
public static function DbTableExists($p_name)
|
||||||
{
|
{
|
||||||
global $CC_DBC;
|
$con = Propel::getConnection();
|
||||||
$sql = "SELECT * FROM ".$p_name;
|
try {
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$sql = "SELECT * FROM ".$p_name." LIMIT 1";
|
||||||
if (PEAR::isError($result)) {
|
$con->query($sql);
|
||||||
|
} catch (PDOException $e){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -238,24 +234,13 @@ class UpgradeCommon{
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function selectQueryDb($p_sql){
|
public static function queryDb($p_sql){
|
||||||
global $CC_DBC;
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$result = $CC_DBC->getRow($p_sql, $fetchmode=DB_FETCHMODE_ASSOC);
|
try {
|
||||||
if (PEAR::isError($result)) {
|
$result = $con->exec($p_sql);
|
||||||
echo "Error executing $sql. Exiting.";
|
} catch (Exception $e) {
|
||||||
exit(1);
|
echo "Error executing $p_sql. Exiting.";
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function nonSelectQueryDb($p_sql){
|
|
||||||
global $CC_DBC;
|
|
||||||
|
|
||||||
$result = $CC_DBC->query($p_sql);
|
|
||||||
if (PEAR::isError($result)) {
|
|
||||||
echo "Error executing $sql. Exiting.";
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
#!/usr/bin/env python2.6
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This file holds the implementations for all the API clients.
|
# This file holds the implementations for all the API clients.
|
||||||
#
|
#
|
||||||
|
|
|
@ -64,7 +64,6 @@ class MediaMonitorCommon:
|
||||||
except IOError:
|
except IOError:
|
||||||
self.logger.warn("File does not have correct permissions: '%s'", filepath)
|
self.logger.warn("File does not have correct permissions: '%s'", filepath)
|
||||||
readable = False
|
readable = False
|
||||||
self.logger.error("traceback: %s", traceback.format_exc())
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error("Unexpected exception thrown: %s", e)
|
self.logger.error("Unexpected exception thrown: %s", e)
|
||||||
readable = False
|
readable = False
|
||||||
|
|
|
@ -28,7 +28,7 @@ liquidsoap_start () {
|
||||||
|
|
||||||
liquidsoap_stop () {
|
liquidsoap_stop () {
|
||||||
monit unmonitor airtime-liquidsoap >/dev/null 2>&1
|
monit unmonitor airtime-liquidsoap >/dev/null 2>&1
|
||||||
/usr/lib/airtime/airtime_virtualenv/bin/python2.6 /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
/usr/lib/airtime/airtime_virtualenv/bin/python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
||||||
|
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
|
||||||
|
@ -65,7 +65,7 @@ monit_restart() {
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE0
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE0
|
||||||
rm -f $PIDFILE0
|
rm -f $PIDFILE0
|
||||||
|
|
||||||
/usr/lib/airtime/airtime_virtualenv/bin/python2.6 /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
/usr/lib/airtime/airtime_virtualenv/bin/python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
|
||||||
rm -f $PIDFILE1
|
rm -f $PIDFILE1
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ sys.path.append('/usr/lib/airtime/')
|
||||||
from api_clients import api_client
|
from api_clients import api_client
|
||||||
from configobj import ConfigObj
|
from configobj import ConfigObj
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
if os.geteuid() != 0:
|
if os.geteuid() != 0:
|
||||||
print "Please run this as root."
|
print "Please run this as root."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -100,10 +102,11 @@ try:
|
||||||
print e
|
print e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
logging.basicConfig(format='%(message)s')
|
||||||
|
|
||||||
#generate liquidsoap config file
|
#generate liquidsoap config file
|
||||||
#access the DB and generate liquidsoap.cfg under /etc/airtime/
|
#access the DB and generate liquidsoap.cfg under /etc/airtime/
|
||||||
ac = api_client.api_client_factory(config)
|
ac = api_client.api_client_factory(config, logging.getLogger())
|
||||||
ss = ac.get_stream_setting()
|
ss = ac.get_stream_setting()
|
||||||
|
|
||||||
if ss is not None:
|
if ss is not None:
|
||||||
|
|
|
@ -57,6 +57,7 @@ class PypoPush(Thread):
|
||||||
next_media_item_chain = None
|
next_media_item_chain = None
|
||||||
media_schedule = None
|
media_schedule = None
|
||||||
time_until_next_play = None
|
time_until_next_play = None
|
||||||
|
chains = None
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -65,10 +66,11 @@ class PypoPush(Thread):
|
||||||
else:
|
else:
|
||||||
media_schedule = self.queue.get(block=True, timeout=time_until_next_play)
|
media_schedule = self.queue.get(block=True, timeout=time_until_next_play)
|
||||||
|
|
||||||
|
chains = self.get_all_chains(media_schedule)
|
||||||
|
|
||||||
#We get to the following lines only if a schedule was received.
|
#We get to the following lines only if a schedule was received.
|
||||||
liquidsoap_queue_approx = self.get_queue_items_from_liquidsoap()
|
liquidsoap_queue_approx = self.get_queue_items_from_liquidsoap()
|
||||||
|
|
||||||
chains = self.get_all_chains(media_schedule)
|
|
||||||
current_event_chain = self.get_current_chain(chains)
|
current_event_chain = self.get_current_chain(chains)
|
||||||
if len(current_event_chain) > 0 and len(liquidsoap_queue_approx) == 0:
|
if len(current_event_chain) > 0 and len(liquidsoap_queue_approx) == 0:
|
||||||
#Something is scheduled but Liquidsoap is not playing anything!
|
#Something is scheduled but Liquidsoap is not playing anything!
|
||||||
|
@ -79,8 +81,10 @@ class PypoPush(Thread):
|
||||||
else:
|
else:
|
||||||
media_chain = filter(lambda item: (item["type"] == "file"), current_event_chain)
|
media_chain = filter(lambda item: (item["type"] == "file"), current_event_chain)
|
||||||
self.handle_new_media_schedule(media_schedule, liquidsoap_queue_approx, media_chain)
|
self.handle_new_media_schedule(media_schedule, liquidsoap_queue_approx, media_chain)
|
||||||
chains = self.get_all_chains(media_schedule)
|
|
||||||
|
#chains = self.get_all_chains(media_schedule)
|
||||||
next_media_item_chain = self.get_next_schedule_chain(chains)
|
next_media_item_chain = self.get_next_schedule_chain(chains)
|
||||||
|
|
||||||
self.logger.debug("Next schedule chain: %s", next_media_item_chain)
|
self.logger.debug("Next schedule chain: %s", next_media_item_chain)
|
||||||
if next_media_item_chain is not None:
|
if next_media_item_chain is not None:
|
||||||
tnow = datetime.utcnow()
|
tnow = datetime.utcnow()
|
||||||
|
@ -94,10 +98,8 @@ class PypoPush(Thread):
|
||||||
#We only get here when a new chain of tracks are ready to be played.
|
#We only get here when a new chain of tracks are ready to be played.
|
||||||
self.push_to_liquidsoap(next_media_item_chain)
|
self.push_to_liquidsoap(next_media_item_chain)
|
||||||
|
|
||||||
#TODO
|
chains.remove(next_media_item_chain)
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
chains = self.get_all_chains(media_schedule)
|
|
||||||
next_media_item_chain = self.get_next_schedule_chain(chains)
|
next_media_item_chain = self.get_next_schedule_chain(chains)
|
||||||
if next_media_item_chain is not None:
|
if next_media_item_chain is not None:
|
||||||
tnow = datetime.utcnow()
|
tnow = datetime.utcnow()
|
||||||
|
|
|
@ -38,27 +38,30 @@ echo -e "\n*** Creating Virtualenv for Airtime ***"
|
||||||
EXTRAOPTION=$(virtualenv --help | grep extra-search-dir)
|
EXTRAOPTION=$(virtualenv --help | grep extra-search-dir)
|
||||||
|
|
||||||
if [ "$?" -eq "0" ]; then
|
if [ "$?" -eq "0" ]; then
|
||||||
virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1
|
virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1
|
||||||
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
|
||||||
virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1
|
virtualenv --no-site-package -p /usr/bin/python /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n*** Installing Python Libraries ***"
|
echo -e "\n*** Installing Python Libraries ***"
|
||||||
/usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle -E /usr/lib/airtime/airtime_virtualenv || exit 1
|
/usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle || exit 1
|
||||||
|
|
||||||
|
PYTHON_VERSION=$(python -c "import sys; print 'python%s.%s' % (sys.version_info[0], sys.version_info[1])")
|
||||||
|
|
||||||
echo -e "\n*** Patching Python Libraries ***"
|
echo -e "\n*** Patching Python Libraries ***"
|
||||||
|
echo " * Patching virtualenv libraries in /usr/lib/airtime/airtime_virtualenv/lib/$PYTHON_VERSION"
|
||||||
PATCHES=${SCRIPTPATH}/patches/*
|
PATCHES=${SCRIPTPATH}/patches/*
|
||||||
for file in $(find $PATCHES -print); do
|
for file in $(find $PATCHES -print); do
|
||||||
if [ -d $file ]; then
|
if [ -d $file ]; then
|
||||||
DIRNAME=$(basename $file)
|
DIRNAME=$(basename $file)
|
||||||
echo -e "\n ---Applying Patches for $DIRNAME---"
|
echo -e "\n ---Applying Patches for $DIRNAME---"
|
||||||
else
|
else
|
||||||
patch -N -p0 -i $file
|
patch -N -p7 -i $file -d /usr/lib/airtime/airtime_virtualenv/lib/$PYTHON_VERSION
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue