Merge branch '2.3.x' of dev.sourcefabric.org:airtime into 2.3.x

This commit is contained in:
Martin Konecny 2013-04-14 18:10:58 -04:00
commit 6e7e3c81e8
46 changed files with 47743 additions and 47603 deletions

View File

@ -724,7 +724,7 @@ class ApiController extends Zend_Controller_Action
{
$request = $this->getRequest();
$msg = $request->getParam('msg');
$msg = $request->getParam('msg_post');
$stream_id = $request->getParam('stream_id');
$boot_time = $request->getParam('boot_time');
@ -971,14 +971,14 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$data = json_decode($request->getParam('data'));
$data = json_decode($request->getParam('data'), $assoc = true);
foreach ($data as $pair) {
list($id, $info) = $pair;
// TODO : move this code into model -- RG
$cuein = $info->cuein;
$cueout = $info->cueout;
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
$cueout = isset($info['cueout']) ? $info['cueout'] : $file->getDbLength();
$file->setDbCuein($cuein);
$file->setDbCueout($cueout);
$file->setDbSilanCheck(true);

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,9 @@ var AIRTIME = (function(AIRTIME){
mod.updateCalendarStatusIcon = function(json) {
if (window.location.pathname.toLowerCase() != baseUrl+"schedule") {
//make sure we are only executing this code on the calendar view, not
//the Now Playing view.
if (window.location.pathname.toLowerCase().indexOf("schedule") >= 0) {
return;
}

View File

@ -143,6 +143,11 @@ fi
#We don't want any of our python services running if we are doing an upgrade/reinstall.
#They will be automatically restarted later on.
echo "* Temporarily stopping any previous running services"
set +e
monit unmonitor airtime-media-monitor >/dev/null 2>&1
monit unmonitor airtime-liquidsoap >/dev/null 2>&1
monit unmonitor airtime-playout >/dev/null 2>&1
set -e
if [ -e /etc/init.d/airtime-media-monitor ]; then
invoke-rc.d airtime-media-monitor stop > /dev/null 2>&1
fi
@ -172,6 +177,8 @@ set -e
echo -e "\n******************************** Install Begin *********************************"
rm -rf "/usr/lib/airtime"
mkdir -p /usr/lib/airtime
if [ "$python_service" -eq "0" ]; then
$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh
@ -208,6 +215,7 @@ if [ "$mediamonitor" = "t" -o "$pypo" = "t" ]; then
fi
#An attempt to force apache to realize that files are updated on upgrade...
touch /usr/share/airtime/public/index.php
if [ "$python_service" -eq "0" ]; then

View File

@ -72,7 +72,6 @@ if [ "$python_service" -eq "0" ]; then
fi
fi
mkdir -p /usr/lib/airtime
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
cp -R $AIRTIMEROOT/python_apps/std_err_override /usr/lib/airtime

View File

@ -13,7 +13,7 @@ require_once(__DIR__.'/airtime-constants.php');
// -------------------------------------------------------------------------
$iniExists = file_exists("/etc/airtime/airtime.conf");
if ($iniExists){
if ($iniExists) {
//reinstall, Will ask if we should rewrite config files.
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
$CC_CONFIG = Config::getConfig();

View File

@ -21,13 +21,9 @@ monit unmonitor airtime-liquidsoap >/dev/null 2>&1
monit unmonitor airtime-playout >/dev/null 2>&1
set -e
#virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
#. ${virtualenv_bin}activate
#uninitialize Airtime services
python $AIRTIMEROOT/python_apps/pypo/install/pypo-uninitialize.py
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-uninitialize.py
#python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-uninitialize.py
if [ "$purge" = "t" ]; then
#call Airtime uninstall script

View File

@ -364,8 +364,12 @@ class AirtimeApiClient(object):
def notify_liquidsoap_status(self, msg, stream_id, time):
logger = self.logger
try:
post_data = {"msg": msg}
post_data = {"msg_post": msg}
#encoded_msg is no longer used server_side!!
encoded_msg = urllib.quote('dummy')
self.services.update_liquidsoap_status.req(post_data,
msg=encoded_msg,
stream_id=stream_id,
boot_time=time).retry(5)
except Exception, e:

View File

@ -15,6 +15,7 @@ NAME="Liquidsoap Playout Engine"
DAEMON=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
PIDFILE=/var/run/airtime-liquidsoap.pid
EXEC='/usr/bin/airtime-liquidsoap'
start () {
chown pypo:pypo /var/log/airtime/pypo
@ -24,18 +25,22 @@ start () {
touch $PIDFILE
chown pypo:pypo $PIDFILE
#start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
#--pidfile $PIDFILE --nicelevel -15 --startas $DAEMON
start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
--pidfile $PIDFILE --nicelevel -15 --startas $DAEMON
--nicelevel -15 --startas $DAEMON --exec $EXEC
}
stop () {
#send term signal after 10 seconds
timeout -k 5 10 /usr/lib/airtime/airtime_virtualenv/bin/python \
timeout -s9 10s /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.
start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --pidfile $PIDFILE
#start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --pidfile $PIDFILE
start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --exec $EXEC
rm -f $PIDFILE
sleep 3
sleep 2
}
start_with_monit () {

View File

@ -192,6 +192,7 @@ def check_dj_client(user,password) =
ret = get_process_lines("python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_auth.py --dj #{user} #{password}")
#ret has now the value of the live client (dj1,dj2, or djx), or "ERROR"/"unknown" ...
hd = list.hd(ret)
log("Live DJ authenticated: #{hd}")
hd == "True"
end

View File

@ -51,7 +51,7 @@ class ListenerStat(Thread):
dom = xml.dom.minidom.parseString(document)
sources = dom.getElementsByTagName("source")
mount_stats = {}
mount_stats = None
for s in sources:
#drop the leading '/' character
mount_name = s.getAttribute("mount")[1:]
@ -97,7 +97,8 @@ class ListenerStat(Thread):
if v["enable"] == 'true':
try:
if v["output"] == "icecast":
stats.append(self.get_icecast_stats(v))
mount_stats = self.get_icecast_stats(v)
if mount_stats: stats.append(mount_stats)
else:
stats.append(self.get_shoutcast_stats(v))
self.update_listener_stat_error(v["mount"], 'OK')

View File

@ -58,7 +58,8 @@ class ReplayGainUpdater(Thread):
total += 1
try:
self.api_client.update_replay_gain_values(processed_data)
if len(processed_data):
self.api_client.update_replay_gain_values(processed_data)
except Exception as e:
self.logger.error(e)
self.logger.debug(traceback.format_exc())

View File

@ -45,10 +45,13 @@ class SilanAnalyzer(Thread):
command = ['nice', '-n', '19', 'silan', '-b', '-f', 'JSON', full_path]
try:
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
out = proc.communicate()[0].strip('\r\n')
info = json.loads(out)
data['cuein'] = str('{0:f}'.format(info['sound'][0][0]))
data['cueout'] = str('{0:f}'.format(info['sound'][-1][1]))
comm = proc.communicate()
if len(comm):
out = comm[0].strip('\r\n')
info = json.loads(out)
if len(info['sound']) >= 2:
data['cuein'] = str('{0:f}'.format(info['sound'][0][0]))
data['cueout'] = str('{0:f}'.format(info['sound'][-1][1]))
except Exception, e:
self.logger.error(str(command))
self.logger.error(e)

View File

@ -3,9 +3,8 @@
set httpd port 2812
check process airtime-liquidsoap
with pidfile "/var/run/airtime-liquidsoap.pid"
start program = "/etc/init.d/airtime-liquidsoap start" with timeout 5 seconds
check process airtime-liquidsoap matching "airtime-liquidsoap.*airtime.*ls_script"
start program = "/etc/init.d/airtime-liquidsoap start" with timeout 30 seconds
stop program = "/etc/init.d/airtime-liquidsoap stop"
if mem > 600 MB for 3 cycles then restart

View File

@ -9,6 +9,7 @@ import telnetlib
import copy
from threading import Thread
import subprocess
import traceback
from Queue import Empty
@ -119,7 +120,6 @@ class PypoFetch(Thread):
self.listener_timeout = 0
self.logger.info("New timeout: %s" % self.listener_timeout)
except Exception, e:
import traceback
top = traceback.format_exc()
self.logger.error('Exception: %s', e)
self.logger.error("traceback: %s", top)
@ -142,7 +142,7 @@ class PypoFetch(Thread):
tn.write('exit\n')
tn.read_all()
except Exception, e:
logger.error(str(e))
logger.error(traceback.format_exc())
finally:
lock.release()
@ -536,8 +536,12 @@ class PypoFetch(Thread):
#being incorrect!)
if not self.is_file_opened(path):
os.remove(path)
self.logger.info("File '%s' removed" % path)
else:
self.logger.info("File '%s' not removed. Still busy!" % path)
except Exception, e:
self.logger.error(e)
self.logger.error("Problem removing file '%s'" % f)
self.logger.error(traceback.format_exc())
def manual_schedule_fetch(self):
success, self.schedule_data = self.api_client.get_schedule()
@ -588,7 +592,6 @@ class PypoFetch(Thread):
self.logger.info("Queue timeout. Fetching schedule manually")
self.persistent_manual_schedule_fetch(max_attempts=5)
except Exception, e:
import traceback
top = traceback.format_exc()
self.logger.error('Exception: %s', e)
self.logger.error("traceback: %s", top)